nmake 编译错误

Posted

技术标签:

【中文标题】nmake 编译错误【英文标题】:nmake compilation error 【发布时间】:2011-05-24 15:15:44 【问题描述】:

我对 C 非常陌生,正在尝试为 Apache 编译为特定的 .so 模块,但我遇到了问题。

我得到的来自nmake 的致命错误附在下面。命令前面的“cl”来自哪里?我执行的批处理文件也被附加了。

任何帮助将不胜感激。

Windows 命令行输出

    cl /nologo /W3 /WX /LD /MT /Ot /Ox /Oi /Oy /Ob2 /GF /Gy /I include  /I "..\httpd\i
nclude" /I "..\httpd\srclib\apr\include" /I "..\httpd\srclib\apr-util\include" /I "..\http
d\os\win32" /I "C:\Program Files\Microsoft SDKs\Windows\v7.0A\include" /I "C:\Program File
s\Microsoft Visual Studio 10.0\VC\include" /D WIN32 /c %CD%\src\mod_auth_sspi.c /FoRelease
\mod_auth_sspi.obj
'cl' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'cl' : return code '0x1'
Stop.

从here修改了make.bat

echo off

::Configuration Area
set PLATSDKDIR=C:\Program Files\Microsoft SDKs\Windows\v7.0A
REM I could not find SetEnv anywhere for Win7 / VS2010:
REM set SDK_Init=c:\Programs\Microsoft SDKs\Windows\v6.1\Bin\SetEnv.Cmd
REM maybe could use setx XXX somehow for the above?
set MSVCDIR=C:\Program Files\Microsoft Visual Studio 10.0\VC
set NMAKE_Opts=/NOLOGO
set APACHE22_HOME=..\httpd
REM i am not sure what the meaning of the above paramater is, do i need to point to apache source code or apache server to compile?
set APSRC=1
set NMAKEHOME=C:\Program Files\Microsoft Visual Studio 10.0\VC\bin
set BUILD_TYPE=Release
set DEBUG=0

REM %SDK_Init% not set so have commented this out 
REM call "%SDK_Init%" /%BUILD_TYPE%
call "%NMAKEHOME%\nmake" %NMAKE_Opts% "MSVCDIR=%MSVCDIR%" "PLATSDKDIR=%PLATSDKDIR%" "APACHE22_HOME=%APACHE22_HOME%" "APSRC=%APSRC%" "DEBUG=%DEBUG%" dist
@echo.
pause 

【问题讨论】:

【参考方案1】:

cl是vs c编译器,报错说找不到编译器。我想问题在这里:

call "%NMAKEHOME%\nmake" %NMAKE_Opts% "MSVCDIR=%MSVCDIR%" "PLATSDKDIR=%PLATSDKDIR%" "APACHE22_HOME=%APACHE22_HOME%" "APSRC=%APSRC%" "DEBUG=%DEBUG%" dist

【讨论】:

谢谢!我现在将 C:\Program Files\Microsoft Visual Studio 10.0\VC\bin 添加到系统环境变量 PATH 并以管理员身份运行批处理文件:现在可以识别 cl !!!但是,我现在遇到一个新错误,您是否有机会指导我了解为什么会出现这种情况: NMAKE : fatal error U1073: don't know how to make 'dist'

以上是关于nmake 编译错误的主要内容,如果未能解决你的问题,请参考以下文章

如果在批处理过程中 nmake 失败,则返回错误和电子邮件

如何让 nmake 克服错误(make -k 的行为)

NMAKE:致命错误 U1077:“cl.exe”:返回代码“0x1”停止。在命令提示符下

用MAKEFILE编译汇编代码常见错误

尝试编译 argon2_elixir 时,nmake 失败

-e 第 1 行,“'755']”附近的 nmake 语法错误