Never-build package [xxx] must be recompiled / SHARING VIOLATION [Delphi documentation issue]

£可爱£侵袭症+ 提交于 2019-12-22 08:34:46

问题


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\'.

  1. Why isn't the A.dpk file found?
  2. Why Delphi wants to recompile the A package anyway?
  3. 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?


回答1:


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.



来源:https://stackoverflow.com/questions/27881187/never-build-package-xxx-must-be-recompiled-sharing-violation-delphi-documen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!