1

Web サイトから提供された Windows cmake ファイルを使用して Visual Studio Express 2013 でnloptをコンパイルしようとすると、サブディレクトリ内の構成を介して正常に動作しますが、次のエラー メッセージが表示されてコンパイルが失敗します。cmake -DCMAKE_BUILD_TYPE=Release -DNLOPT_BUILD_SHARED=On -G"NMake Makefiles" ..buildnmake

[ 40%] Building C object CMakeFiles/nlopt.dir/cobyla/cobyla.c.obj
cobyla.c
e:\dev\nlopt\nlopt-2.4.1\cobyla\cobyla.c(1503) : fatal
 error C1001: An internal error has occurred in the compiler.
(compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 228)
 To work around this problem, try simplifying or changing the program near the l
ocations listed above.
Please choose the Technical Support command on the Visual C++
 Help menu, or open the Technical Support help file for more information
INTERNAL COMPILER ERROR in 'c:\MSVS12\VC\bin\cl.exe'
    Please choose the Technical Support command on the Visual C++
    Help menu, or open the Technical Support help file for more information
NMAKE : fatal error U1077: 'c:\MSVS12\VC\bin\cl.exe' : return code '0x1'
Stop.
NMAKE : fatal error U1077: 'c:\MSVS12\VC\bin\nmake.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'c:\MSVS12\VC\bin\nmake.exe' : return code '0x2'
Stop.
ERROR: Build script of nlopt failed with errorcode 1.
4

2 に答える 2

0

cl.exe問題は、クラッシュの原因となる最適化フラグ /O2です。/O1 だけで cobyla.c をコンパイルするには、通常どおり cmake ステップを実行しますが、開始する前に次のファイルを変更しますnmake

ビルドディレクトリを開いて、ビルドCMakeFiles/nlopt.dir/build.makeするディレクティブを見つけますcobyla.c.obj

そこ、行番号522あたりで変化

$(C_DEFINES) /FoCMakeFiles\nlopt.dir\cobyla\cobyla.c.obj

$(C_DEFINES) /O1 /FoCMakeFiles\nlopt.dir\cobyla\cobyla.c.obj

次に、実行nmakeするとビルドされます ( warning を発しますcl : Command line warning D9025 : overriding '/O2' with '/O1'が、それはまさに私たちが望んでいたことです)。

于 2015-02-03T13:12:13.583 に答える