永不建立包[xxx]必须重新编译/共享违规[Delphi文档问题](Never

编程入门 行业动态 更新时间:2024-10-27 23:22:38
永不建立包[xxx]必须重新编译/共享违规[Delphi文档问题](Never-build package [xxx] must be recompiled / SHARING VIOLATION [Delphi documentation issue])

我刚刚升级到Delphi XE7。 现在,在XE中完全符合的包不再编译。

我有包B需要将ImplicitBuild设置为OFF的包A. 首先,我编译并安装了包A.然后我尝试编译包B,但编译器说:

[dcc32致命错误] A.dpk(39):E2225永不建立包'A'必须重新编译。

[dcc32致命错误] B.dpk(34):E2202未找到所需的包'A'。

显然,由于编译器知道其内容(它知道ImplicitBuild设置为OFF),因此找到了包A. 另外,显然,我在“库路径”中添加了包A的路径。

如果我从包A中删除ImplicitBuild指令,编译器只会说:

“必需的包裹'A'未找到。”

Process Monitor显示了一个有趣的条目:

C:\ Users \ trei \ Documents \ Embarcadero \ Studio \ 15.0 \ Imports \ A.dcp < - 找不到路径

C:\ Users \ Public \ Documents \ Embarcadero \ Studio \ 15.0 \ Bpl \ A.bpl < - 共享违规

'C:\ Users \ trei \ Documents \ Embarcadero \ Studio \'中没有'15 .0'文件夹。

为什么找不到A.dpk文件? 为什么Delphi要重新编译A包呢? 为什么Delphi在'Imports'文件夹中搜索DCP文件? DCP存储在'c:\ Users \ Public \ Documents \ Embarcadero \ Studio \ 15.0 \ Dcp \ A.dcp'中

有趣的事实: 有一个与此消息相关的错误(错误#109584)但它在XE4中被标记为已修复。 http://qc.embarcadero.com/wc/qcmain.aspx?d=109584 回归?

I just upgraded to Delphi XE7. Now a package that complied perfectly in XE doesn't compile anymore.

I have package B that requires package A that has ImplicitBuild set to OFF. First thing first, I compiled and installed package A. Then I tried to compile package B but the compiler says:

[dcc32 Fatal Error] A.dpk(39): E2225 Never-build package 'A' must be recompiled.

[dcc32 Fatal Error] B.dpk(34): E2202 Required package 'A' not found.

Obviously, package A was found since the compiler knows its content (it know that the ImplicitBuild is set to OFF). Also, obviously, I added the path for package A in 'Library path'.

If I remove the ImplicitBuild directive from package A, the compiler simply says:

'Required package 'A' not found.'

Process Monitor shows an interesting entry:

C:\Users\trei\Documents\Embarcadero\Studio\15.0\Imports\A.dcp <-- PATH NOT FOUND

C:\Users\Public\Documents\Embarcadero\Studio\15.0\Bpl\A.bpl <-- SHARING VIOLATION

There is no '15.0' folder in 'C:\Users\trei\Documents\Embarcadero\Studio\'.

Why isn't the A.dpk file found? Why Delphi wants to recompile the A package anyway? Why is Delphi searching the DCP file in the 'Imports' folder? The DCP is stored in 'c:\Users\Public\Documents\Embarcadero\Studio\15.0\Dcp\A.dcp'

Interesting fact: There was a bug related to this message (bug #109584) but it was marked as fixed in XE4. http://qc.embarcadero.com/wc/qcmain.aspx?d=109584 Regression?

最满意答案

PATH env变量必须包含bpl文件夹。 设置通常会为您添加此文件夹。 如果不是这样,那么Delphi将找不到bpls,因为它们是作为dll加载的。 LoadLibrary不关心Package输出目录。 但是路径变量的大小有限制。 所以这可以解释为什么在你的全新Delphi安装中缺少这个。

在最新版本的Delphi中,您可以转到工具 - >选项 - >环境变量并添加path用户覆盖而不是修改env路径: C:\Users\Public\Documents\Embarcadero\Studio\15.0\Bpl;C:\Program Files (x86)\Embarcadero\Studio\15.0\bin;C:\Program Files (x86)\Embarcadero\Studio\15.0\bin64;C:\Users\Public\Documents\Embarcadero\Studio\15.0\Bpl\Win64;C:\Users\Public\Documents\Embarcadero\InterBase\redist\InterBaseXE3\win32_togo;C:\Users\Public\Documents\Embarcadero\InterBase\redist\InterBaseXE3\win64_togo;$(PATH)

最后的$(PATH)用作全局PATH env var的占位符。

这减少了PATH env var的大小,特别是如果您安装了许多版本的Delphi。

The PATH env variable must include the bpl folder. The setup usually adds this folder for you. If that is not the case, then Delphi will not find the bpls, because they are loaded as a dll. LoadLibrary does not care about the Package output directory. But there is a limit on the size of the path variable. So this can explain why this is missing in your brand new Delphi installation.

In recent versions of Delphi, you can go to Tools -> Options -> Environment Variables and add a path user override instead of modifying the env path: C:\Users\Public\Documents\Embarcadero\Studio\15.0\Bpl;C:\Program Files (x86)\Embarcadero\Studio\15.0\bin;C:\Program Files (x86)\Embarcadero\Studio\15.0\bin64;C:\Users\Public\Documents\Embarcadero\Studio\15.0\Bpl\Win64;C:\Users\Public\Documents\Embarcadero\InterBase\redist\InterBaseXE3\win32_togo;C:\Users\Public\Documents\Embarcadero\InterBase\redist\InterBaseXE3\win64_togo;$(PATH)

The $(PATH) at the end is used as a placeholder for the global PATH env var.

This reduces the size of the PATH env var, especially if you have many versions of Delphi installed.

更多推荐

本文发布于:2023-08-05 22:39:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1440219.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文档   xxx   Delphi

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!