1

我有一个针对不同目标平台和主机平台运行的构建环境,使用 ant 来完成主要工作。对于一个目标平台(Qualcomm 的 BREW MP,本机 C/C++),我需要使用这个 ant 目标执行编译:

<target name="build.brew.target" if="${cfg.build.brew}" depends="brew.clean">
  <exec dir="${src.cpp.brew}/brew" executable="cs-make" failonerror="true" newenvironment="false">
    <env key="PATH" value="${env.PATH}" />
    <arg line="-f brew.mak" />
  </exec>
...
</target>

cs-make 是 BREW SDK 中的一个 make 实用程序,它运行在 makefile (brew.mak) 中定义的构建。
从 cmd 提示符 (Win7/64) 执行时,ant 返回错误,例如

ant build.brew.target

ant 打印出由 cl.exe(Visual Studio 2010 Express 的一部分)报告的错误:

 [exec] "C:/PROGRA~1/Qualcomm/BREWMP~1/TOOLSE~1.246/bin/cifc.exe"  -bar Win32_Debug/../res/brew.bar -IC:\Dev\lib\cpp\libspeex\include -I. -IC:/PROGRA~1/Qualcomm/BrewMPSDK/Platforms/BREW4/sdk/inc -IC:/PROGRA~1/Qualcomm/BrewMPSDK/Platforms/BREW4/sdk/../inc -I../inc -I../../common -IC:\Dev\ignore\BOOST_~1 -IWin32_Debug ../res/brew.car
 [exec] "C:/PROGRA~1/Qualcomm/BREWMP~1/TOOLSE~1.246/bin/cifc.exe"  -bar Win32_Debug/../res/brew.bar -IC:\Dev\lib\cpp\libspeex\include -I. -IC:/PROGRA~1/Qualcomm/BrewMPSDK/Platforms/BREW4/sdk/inc -IC:/PROGRA~1/Qualcomm/BrewMPSDK/Platforms/BREW4/sdk/../inc -I../inc -I../../common -IC:\Dev\ignore\BOOST_~1 -IWin32_Debug -M ../res/brew.car > Win32_Debug/../res/brew.bar.dep
 [exec] if exist Win32_Debug/../res/brew.bar (copy /b /v Win32_Debug\..\res\brew.bar +,,Win32_Debug\..\res\brew.bar>nul) else (echo on>Win32_Debug/../res/brew.bar)
 [exec] "C:/PROGRA~1/Qualcomm/BREWMP~1/TOOLSE~1.246/bin/cifc.exe"  -IC:\Dev\lib\cpp\libspeex\include -I. -IC:/PROGRA~1/Qualcomm/BrewMPSDK/Platforms/BREW4/sdk/inc -IC:/PROGRA~1/Qualcomm/BrewMPSDK/Platforms/BREW4/sdk/../inc -I../inc -I../../common -IC:\Dev\ignore\BOOST_~1 -IWin32_Debug ../res/brew.cif -pre Win32_Debug/brew.clif -M > Win32_Debug/brew.clif.dep
 [exec] "C:/PROGRA~1/Qualcomm/BREWMP~1/TOOLSE~1.246/bin/cifc.exe"  -IC:\Dev\lib\cpp\libspeex\include -I. -IC:/PROGRA~1/Qualcomm/BrewMPSDK/Platforms/BREW4/sdk/inc -IC:/PROGRA~1/Qualcomm/BrewMPSDK/Platforms/BREW4/sdk/../inc -I../inc -I../../common -IC:\Dev\ignore\BOOST_~1 -IWin32_Debug ../res/brew.cif -pre Win32_Debug/brew.clif
 [exec] "C:/PROGRA~1/Qualcomm/BREWMP~1/TOOLSE~1.246/bin/cifc.exe"   -mod brew -mif Win32_Debug/brew.mif Win32_Debug/brew.clif


 [exec] cs-make: *** [Win32_Debug/AEEAppGen.o] Error -1073741515


 [exec] "c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC//bin/cl.exe" -nologo -D_WIN32_WINNT=0x0400 -MTd -Z7 -EHsc -GS -Zl -RTC1 -Od -Ob1 -W3 -WX -wd4244 -wd4146 -wd4005 -wd4355 -c     -DAEE_SIMULATOR -D_DEBUG -D_DEBUG -DAEE_SIMULATOR  -IC:\Dev\lib\cpp\libspeex\include -I. -IC:/PROGRA~1/Qualcomm/BrewMPSDK/Platforms/BREW4/sdk/inc -IC:/PROGRA~1/Qualcomm/BrewMPSDK/Platforms/BREW4/sdk/../inc -I../inc -I../../common -IC:\Dev\ignore\BOOST_~1 -IWin32_Debug -I"c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC//Include" -I"c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC//PlatformSDK/Include" -FoWin32_Debug/AEEAppGen.o C:/PROGRA~1/Qualcomm/BrewMPSDK/Platforms/BREW4/sdk/src/AEEAppGen.c

BUILD FAILED
C:\Dev\brew.xml:27: The following error occurred while executing this line:
C:\Dev\brew.xml:43: exec returned: 2

我找不到任何关于错误 -1073741515 的信息,所以我不知道有什么问题。但是:如果我运行相同的命令(在与我之前的 ant 调用相同的 cmd 窗口中),一切正常。

cs-make -f brew.mak

我的第一个想法是——并且仍然是我最好的选择——这一定与我的环境有关。为此,我将其添加newenvironment="false"到我的 exec 行。没有成功。
欢迎任何提示...

4

1 回答 1

0

对于工作来说,这是一个为时已晚的问题。在我第一次遇到这个错误后,我认为它必须是 %PATH% 或其他环境变量。所以我添加了这一行:

<env key="PATH" value="${env.PATH}" />

我从项目中的其他地方复制了这个,但没有交叉检查它是否为我的环境保存了正确的 %PATH%。
由于它不起作用,我搜索并找到了newenvironment="false"exec 目标的参数并添加了它 - 但由于目标中的上述行没有包含正确的 env.PATH 值,所以出错了。

这对我有用:

<target name="build.brew.target" if="${cfg.build.brew}" depends="brew.clean">
  <exec dir="${src.cpp.brew}/brew" executable="cs-make" failonerror="true" newenvironment="false">
    <arg line="-f brew.mak" />
  </exec>
  ...
</target>
于 2013-09-08T12:30:30.650 回答