简体   繁体   English

未找到单元:'System.pas' 或二进制等效项 (.dcu):在 jenkins 上编译

[英]Unit not found: 'System.pas' or binary equivalents (.dcu) : Compiling on jenkins

I'm using Jenkins to generate automatic build every 15 minutes for a test project.我正在使用 Jenkins 每 15 分钟为一个测试项目生成一次自动构建。

When compiling for Delphi itself does not give a problem, now when I run by jenkins it gives the following problem ...为 Delphi 本身编译时不会出现问题,现在当我由 jenkins 运行时,它会出现以下问题......

C:\\Program Files (x86)\\Embarcadero\\RAD Studio\\7.0\\Bin\\CodeGear.Delphi.Targets(136,3): error : Project1.dpr(1) Fatal: F1027 Unit not found: 'System.pas' or binary equivalents (.dcu) C:\\Program Files (x86)\\Embarcadero\\RAD Studio\\7.0\\Bin\\CodeGear.Delphi.Targets(136,3): error : Project1.dpr(1) Fatal: F1027 Unit not found: 'System.pas' or二进制等价物 (.dcu)

I have already tried to run by windows command this way.我已经尝试以这种方式通过 windows 命令运行。

cd "C:\Users\carlos.santos\Desktop\teste"
call build.bat

And Build.bat in this way.而Build.bat就是这种方式。

call "C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\bin\rsvars.bat"
msbuild "Project1.dproj" /p:config=Release /p:Warn=0

I have already tried to run by the Rad Studio plugin itself for Jenkins this way and it also did not work.我已经尝试通过这种方式为 Jenkins 运行 Rad Studio 插件本身,但它也不起作用。

詹金斯的 Rad Studio

I have already seen in some forums that if I have many paths or do not have the default paths of Delphi in Library path can be a problem, but I have tested this too and nothing ..我已经在一些论坛中看到,如果我有很多路径或者在库路径中没有 Delphi 的默认路径可能是一个问题,但我也测试过这个,但没有。

Here are the paths I have.这是我拥有的路径。

$ (BDS) \\ lib; $(BDS)\\lib; $ (BDS) \\ Imports; $ (BDS) \\ 进口; $ (BDS) \\ Lib \\ Indy10; $(BDS)\\Lib\\Indy10; $ (BDSCOMMONDIR) \\ Dcp; $(BDSCOMMONDIR)\\Dcp; $ (BDS) \\ include; $ (BDS) \\ 包括; $ (BDS) \\ RaveReports \\ Lib; $ (BDS) \\ RaveReports \\ Lib; $ (BDSCOMMONDIR) \\ Bpl; $ (BDSCOMMONDIR) \\ Bpl; $(BDS)\\lib\\debug; $(BDS)\\lib\\debug; $(BDS)\\bin; $(BDS)\\bin; $(DELPHI)\\Bin; $(DELPHI)\\Bin;

The Content of rsvars.bat are there: rsvars.bat 的内容在那里:

@SET BDS=C:\Program Files (x86)\Embarcadero\RAD Studio\7.0
@SET BDSCOMMONDIR=C:\Users\Public\Documents\RAD Studio\7.0
@SET FrameworkDir=C:\Windows\Microsoft.NET\Framework\v2.0.50727
@SET FrameworkVersion=v2.0.50727
@SET FrameworkSDKDir=
@SET PATH=%FrameworkDir%;%FrameworkSDKDir%;%PATH%
@SET LANGDIR=EN

I have third party component installed in my Delphi, but I do not know if it influences anything.我的 Delphi 中安装了第三方组件,但我不知道它是否会影响任何东西。 Anyone who can help me will be grateful.任何能帮助我的人将不胜感激。

the difference between the properties executed by jenkins and cmd are these: jenkins 和 cmd 执行的属性之间的区别是:

图片1

图片2

图3

it was resolved putting the paramether _EnvLibraryPath with my Delphi LibraryPath parameter on msbuild call, example:解决了将参数_EnvLibraryPath与我的 Delphi LibraryPath 参数放在 msbuild 调用上的问题,例如:

call "C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\bin\rsvars.bat"
msbuild "C:\Users\carlos.santos\Desktop\teste\Project1.dproj" /p:_EnvLibraryPath="C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\lib\EN;C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\lib"

There may be another cause for that same problem.同样的问题可能有另一个原因。 I have just experienced it and solved it.我刚刚经历了它并解决了它。 In my case, it was related to the fact that I had another configuration besides Release and Debug, ie ReleaseConsumer.就我而言,这与我有除 Release 和 Debug 之外的另一种配置,即 ReleaseConsumer 的事实有关。 My build command included specifying the configuration:我的构建命令包括指定配置:

DoJenkinsTasks "US2D_GUI" "Config=ReleaseConsumer;Platform=Win64"

Now, I got that same error as mentioned above.现在,我遇到了与上面提到的相同的错误。 The cause is that it can't find the ReleaseConsumer folder with dcu files.原因是它找不到包含 dcu 文件的 ReleaseConsumer 文件夹。 I solved it by creating, under c:\\Program Files (x86)\\Embarcadero\\Studio\\19.0\\lib\\win64\\, a new folder releaseConsumer and copying all dcu files from release to it.我通过在 c:\\Program Files (x86)\\Embarcadero\\Studio\\19.0\\lib\\win64\\ 下创建一个新文件夹 releaseConsumer 并将所有 dcu 文件从 release 复制到它来解决它。

Run msbuild with the /v:diagnostic option, and you will see that none of the default environment paths are set:使用/v:diagnostic选项运行msbuild ,您将看到没有设置任何默认环境路径:

Initial Properties:
___ResourcePath                = 
__ObjectPath                   = 
__ResourcePath                 = 
_EnvDCPOutput                  = 
_EnvLibraryPath                = 
_EnvNamespace                  = 
_EnvPackageOutput              = 
_ObjectPath                    = 
_OutputDRCFiles                = false
_ProjectFiles                  = @(DelphiCompile)
_ResolveGENTLBBindingsTarget   = 

This is because you are missing the %APPDATA%\\CodeGear directory on your build server (under the user that is running the builds).这是因为您在构建服务器上(在运行构建的用户下)缺少%APPDATA%\\CodeGear目录。

Particularly, you need the CodeGear\\BDS\\7.0\\EnvOptions.proj settings file, which contains all the environment variables.特别是,您需要CodeGear\\BDS\\7.0\\EnvOptions.proj设置文件,其中包含所有环境变量。 Put that in place and you'll see msbuild 's diagnostics shows properties like this one:把它放在适当的位置,你会看到msbuild的诊断显示如下属性:

Initial Properties:
___ResourcePath                = C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\lib;\Imports;C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\Imports;C:\Users\Public\Documents\RAD Studio\7.0\Dcp;C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\include;C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\lib;C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\Lib\Indy10;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM