Building Boost 1.50 with bjam on MSVC 2010
I'm trying to build the latest Boost (1.50) using MSVC 2010. I have MSVC 2003 and 2008 installed on the same machine (Windows Vista), and have successfully been able to build Boost 1.50 using both toolsets. However I'm having trouble with msvc 2010.
The following is the bjam command I use after having called bootstap.bat:
bjam --without-mpi --without-python --toolset=msvc-7.1 --build-type=complete -d+2
bjam --without-mpi --without-python --toolset=msvc-9.0 --build-type=complete -d+2
bjam --without-mpi --without-python --toolset=msvc-10.0 --build-type=complete -d+2
When building MSVC 2010, I get the following error messages:
file bin.v2\libs\exception\build\msvc-10.0\release\link-static\runtime-link-static\clone_current_exception_non_intrusive.obj.rsp
"libs\exception\src\clone_current_exception_non_intrusive.cpp" -Fo"bin.v2\libs\exception\build\msvc-10.0\release\link-static\runtime-link-static\clone_current_exception_non_intrusi
ve.obj" -TP /O2 /Ob2 /W3 /GR /Zc:forScope /Zc:wchar_t /MT /wd4675 /EHs -c
-DBOOST_ALL_NO_LIB=1
-DNDEBUG
"-I."
compile-c-c++ bin.v2\libs\exception\build\msvc-10.0\release\link-static\runtime-link-static\clone_current_exception_non_intrusive.obj
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 >nul
cl /Zm800 -nologo #"bin.v2\libs\exception\build\msvc-10.0\release\link-static\runtime-link-static\clone_current_exception_non_intrusive.obj.rsp"
Command line error D2016 : '/Ze' and '/Za' command-line options are incompatible
...skipped <pbin.v2\libs\exception\build\msvc-10.0\release\link-static\runtime-link-static>libboost_exception-vc100-s-1_50.lib for lack of <pbin.v2\libs\exception\build\msvc-10.0\r
elease\link-static\runtime-link-static>clone_current_exception_non_intrusive.obj...
...skipped <pstage\lib>libboost_exception-vc100-s-1_50.lib for lack of <pbin.v2\libs\exception\build\msvc-10.0\release\link-static\runtime-link-static>libboost_exception-vc100-s-1_
50.lib...
file bin.v2\libs\filesystem\build\msvc-10.0\release\link-static\runtime-link-static\codecvt_error_category.obj.rsp
"libs\filesystem\src\codecvt_error_category.cpp" -Fo"bin.v2\libs\filesystem\build\msvc-10.0\release\link-static\runtime-link-static\codecvt_error_category.obj" -TP /O2 /Ob2 /W3
/GR /Zc:forScope /Zc:wchar_t /MT /wd4675 /EHs -c
-DBOOST_ALL_NO_LIB=1
-DBOOST_FILESYSTEM_STATIC_LINK=1
-DBOOST_SYSTEM_STATIC_LINK=1
-DNDEBUG
"-I."
compile-c-c++ bin.v2\libs\filesystem\build\msvc-10.0\release\link-static\runtime-link-static\codecvt_error_category.obj
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 >nul
cl /Zm800 -nologo #"bin.v2\libs\filesystem\build\msvc-10.0\release\link-static\runtime-link-static\codecvt_error_category.obj.rsp"
Command line error D2016 : '/Ze' and '/Za' command-line options are incompatible
file bin.v2\libs\filesystem\build\msvc-10.0\release\link-static\runtime-link-static\operations.obj.rsp
"libs\filesystem\src\operations.cpp" -Fo"bin.v2\libs\filesystem\build\msvc-10.0\release\link-static\runtime-link-static\operations.obj" -TP /O2 /Ob2 /W3 /GR /Zc:forScope /Zc:wch
ar_t /MT /wd4675 /EHs -c
-DBOOST_ALL_NO_LIB=1
-DBOOST_FILESYSTEM_STATIC_LINK=1
-DBOOST_SYSTEM_STATIC_LINK=1
-DNDEBUG
"-I."
compile-c-c++ bin.v2\libs\filesystem\build\msvc-10.0\release\link-static\runtime-link-static\operations.obj
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 >nul
cl /Zm800 -nologo #"bin.v2\libs\filesystem\build\msvc-10.0\release\link-static\runtime-link-static\operations.obj.rsp"
Command line error D2016 : '/Ze' and '/Za' command-line options are incompatible
file bin.v2\libs\filesystem\build\msvc-10.0\release\link-static\runtime-link-static\path.obj.rsp
"libs\filesystem\src\path.cpp" -Fo"bin.v2\libs\filesystem\build\msvc-10.0\release\link-static\runtime-link-static\path.obj" -TP /O2 /Ob2 /W3 /GR /Zc:forScope /Zc:wchar_t /MT /wd
4675 /EHs -c
-DBOOST_ALL_NO_LIB=1
-DBOOST_FILESYSTEM_STATIC_LINK=1
-DBOOST_SYSTEM_STATIC_LINK=1
-DNDEBUG
"-I."
compile-c-c++ bin.v2\libs\filesystem\build\msvc-10.0\release\link-static\runtime-link-static\path.obj
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 >nul
cl /Zm800 -nologo #"bin.v2\libs\filesystem\build\msvc-10.0\release\link-static\runtime-link-static\path.obj.rsp"
Command line error D2016 : '/Ze' and '/Za' command-line options are incompatible
I have very little experience with bjam other than executing the command lines described above. I believe everything is setup correctly, all the compilers are on the PATH environment variable. eg:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin
Furthermore I can't see where in the bjam configs for msvc that the '/Ze' and '/Za' are defined.
Is there something else I'm missing?
Instead of adding the compiler to the path, have you tried launching bjam from Visual Studio Command Prompt (found on your Start Menu)?
I never put anything on PATH - I just run that, go to boost folder, bootstrap and build.
Related
I am attempting to build and run a c++ program from GitHub, although i keep running into problems presumably with Cmake and the boost libraries. It is the first time i have tried building a program, so there is probably something obvious missing.
The program in question is from the following GitHub repository: https://github.com/antimix/PrusaSlicer. I am opening the folder i Visual Studio Code as an administrator (to remove some other error) with the Cmake and Cmake tools extensions installed. I have installed 1.75.0 Boost from this site: https://boost.teeks99.com/. From the Visual Code terminal I get the following error(s):
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
[cmake] Could NOT find Boost (missing: system filesystem thread log locale regex
[cmake] chrono atomic date_time) (found version "1.75.0")
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
[cmake] C:/Program Files/CMake/share/cmake-3.20/Modules/FindBoost.cmake:2344 (find_package_handle_standard_args)
[cmake] CMakeLists.txt:266 (find_package)
And here is the full log:
[variant] Loaded new set of variants
[kit] Successfully loaded 8 kits from C:\Users\*user*\AppData\Local\CMakeTools\cmake-tools-kits.json
[main] Configuring folder: PrusaSlicer-dribbling_2.2.0
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" "-Hc:/Program Files/Prusa3D/PrusaSlicer-dribbling_2.2.0" "-Bc:/Program Files/Prusa3D/PrusaSlicer-dribbling_2.2.0/build" -G "Visual Studio 16 2019" -T host=x64 -A win32
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE "-Hc:/Program Files/Prusa3D/PrusaSlicer-dribbling_2.2.0" "-Bc:/Program Files/Prusa3D/PrusaSlicer-dribbling_2.2.0/build" -G "Visual Studio 16 2019" -T host=x64 -A win32
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
[cmake] -- SLIC3R_ASAN: OFF
[cmake] -- SLIC3R_BUILD_SANDBOXES: OFF
[cmake] -- SLIC3R_BUILD_TESTS: ON
[cmake] -- SLIC3R_FHS: OFF
[cmake] -- SLIC3R_GTK: 2
[cmake] -- SLIC3R_GUI: ON
[cmake] -- SLIC3R_MSVC_COMPILE_PARALLEL: ON
[cmake] -- SLIC3R_MSVC_PDB: ON
[cmake] -- SLIC3R_PCH: ON
[cmake] -- SLIC3R_PERL_XS: OFF
[cmake] Building without Win10 Netfabb STL fixing service support
[cmake] -- SLIC3R_PROFILE: OFF
[cmake] -- SLIC3R_STATIC: ON
[cmake] -- SLIC3R_WX_STABLE: ON
[cmake] -- SLIC3R_STATIC: ON
[cmake] -- CMAKE_PREFIX_PATH: (default)
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
[cmake] Could NOT find Boost (missing: system filesystem thread log locale regex
[cmake] chrono atomic date_time) (found version "1.75.0")
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
[cmake] C:/Program Files/CMake/share/cmake-3.20/Modules/FindBoost.cmake:2344 (find_package_handle_standard_args)
[cmake] CMakeLists.txt:266 (find_package)
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "C:/Program Files/Prusa3D/PrusaSlicer-dribbling_2.2.0/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "C:/Program Files/Prusa3D/PrusaSlicer-dribbling_2.2.0/build/CMakeFiles/CMakeError.log".
Also, here is the two logs that the terminal talk about if that is of interest:
CMakeOutput.log
The system is: Windows - 10.0.18363 - AMD64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler:
Build flags:
Id flags:
The output was:
0
Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 21-02-2021 22:55:20.
Project "C:\Program Files\Prusa3D\PrusaSlicer-dribbling_2.2.0\build\CMakeFiles\3.20.0-rc1\CompilerIdC\CompilerIdC.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "Debug\".
Creating directory "Debug\CompilerIdC.tlog\".
InitializeBuildStatus:
Creating "Debug\CompilerIdC.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX64\x86\CL.exe /c /nologo /W0 /WX- /diagnostics:column /Od /Oy- /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc142.pdb" /Gd /TC /analyze- /FC /errorReport:queue CMakeCCompilerId.c
CMakeCCompilerId.c
Link:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX64\x86\link.exe /ERRORREPORT:QUEUE /OUT:".\CompilerIdC.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".\CompilerIdC.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdC.lib" /MACHINE:X86 /SAFESEH Debug\CMakeCCompilerId.obj
CompilerIdC.vcxproj -> C:\Program Files\Prusa3D\PrusaSlicer-dribbling_2.2.0\build\CMakeFiles\3.20.0-rc1\CompilerIdC\CompilerIdC.exe
PostBuildEvent:
for %%i in (cl.exe) do #echo CMAKE_C_COMPILER=%%~$PATH:i
:VCEnd
CMAKE_C_COMPILER=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x86\cl.exe
FinalizeBuildStatus:
Deleting file "Debug\CompilerIdC.tlog\unsuccessfulbuild".
Touching "Debug\CompilerIdC.tlog\CompilerIdC.lastbuildstate".
Done Building Project "C:\Program Files\Prusa3D\PrusaSlicer-dribbling_2.2.0\build\CMakeFiles\3.20.0-rc1\CompilerIdC\CompilerIdC.vcxproj" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.39
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CompilerIdC.exe"
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CompilerIdC.vcxproj"
The C compiler identification is MSVC, found in "C:/Program Files/Prusa3D/PrusaSlicer-dribbling_2.2.0/build/CMakeFiles/3.20.0-rc1/CompilerIdC/CompilerIdC.exe"
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler:
Build flags:
Id flags:
The output was:
0
Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 21-02-2021 22:55:21.
Project "C:\Program Files\Prusa3D\PrusaSlicer-dribbling_2.2.0\build\CMakeFiles\3.20.0-rc1\CompilerIdCXX\CompilerIdCXX.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "Debug\".
Creating directory "Debug\CompilerIdCXX.tlog\".
InitializeBuildStatus:
Creating "Debug\CompilerIdCXX.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX64\x86\CL.exe /c /nologo /W0 /WX- /diagnostics:column /Od /Oy- /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc142.pdb" /Gd /TP /analyze- /FC /errorReport:queue CMakeCXXCompilerId.cpp
CMakeCXXCompilerId.cpp
Link:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX64\x86\link.exe /ERRORREPORT:QUEUE /OUT:".\CompilerIdCXX.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".\CompilerIdCXX.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdCXX.lib" /MACHINE:X86 /SAFESEH Debug\CMakeCXXCompilerId.obj
CompilerIdCXX.vcxproj -> C:\Program Files\Prusa3D\PrusaSlicer-dribbling_2.2.0\build\CMakeFiles\3.20.0-rc1\CompilerIdCXX\CompilerIdCXX.exe
PostBuildEvent:
for %%i in (cl.exe) do #echo CMAKE_CXX_COMPILER=%%~$PATH:i
:VCEnd
CMAKE_CXX_COMPILER=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x86\cl.exe
FinalizeBuildStatus:
Deleting file "Debug\CompilerIdCXX.tlog\unsuccessfulbuild".
Touching "Debug\CompilerIdCXX.tlog\CompilerIdCXX.lastbuildstate".
Done Building Project "C:\Program Files\Prusa3D\PrusaSlicer-dribbling_2.2.0\build\CMakeFiles\3.20.0-rc1\CompilerIdCXX\CompilerIdCXX.vcxproj" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.11
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CompilerIdCXX.exe"
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CompilerIdCXX.vcxproj"
The CXX compiler identification is MSVC, found in "C:/Program Files/Prusa3D/PrusaSlicer-dribbling_2.2.0/build/CMakeFiles/3.20.0-rc1/CompilerIdCXX/CompilerIdCXX.exe"
Detecting C compiler ABI info compiled with the following output:
Change Dir: C:/Program Files/Prusa3D/PrusaSlicer-dribbling_2.2.0/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/MSBuild/Current/Bin/MSBuild.exe cmTC_e9c90.vcxproj /p:Configuration=Debug /p:Platform=win32 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
CMakeCCompilerABI.c
cl /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_e9c90.dir\Debug\\" /Fd"cmTC_e9c90.dir\Debug\vc142.pdb" /Gd /TC /analyze- /errorReport:queue "C:\Program Files\CMake\share\cmake-3.20\Modules\CMakeCCompilerABI.c"
cmTC_e9c90.vcxproj -> C:\Program Files\Prusa3D\PrusaSlicer-dribbling_2.2.0\build\CMakeFiles\CMakeTmp\Debug\cmTC_e9c90.exe
Detecting CXX compiler ABI info compiled with the following output:
Change Dir: C:/Program Files/Prusa3D/PrusaSlicer-dribbling_2.2.0/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/MSBuild/Current/Bin/MSBuild.exe cmTC_65605.vcxproj /p:Configuration=Debug /p:Platform=win32 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
CMakeCXXCompilerABI.cpp
cl /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_65605.dir\Debug\\" /Fd"cmTC_65605.dir\Debug\vc142.pdb" /Gd /TP /analyze- /errorReport:queue "C:\Program Files\CMake\share\cmake-3.20\Modules\CMakeCXXCompilerABI.cpp"
cmTC_65605.vcxproj -> C:\Program Files\Prusa3D\PrusaSlicer-dribbling_2.2.0\build\CMakeFiles\CMakeTmp\Debug\cmTC_65605.exe
CMakeError.log
Determining if the include file pthread.h exists failed with the following output:
Change Dir: C:/Program Files/Prusa3D/PrusaSlicer-dribbling_2.2.0/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/MSBuild/Current/Bin/MSBuild.exe cmTC_3680a.vcxproj /p:Configuration=Debug /p:Platform=win32 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
CheckIncludeFile.c
cl /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_3680a.dir\Debug\\" /Fd"cmTC_3680a.dir\Debug\vc142.pdb" /Gd /TC /analyze- /errorReport:queue "C:\Program Files\Prusa3D\PrusaSlicer-dribbling_2.2.0\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c"
C:\Program Files\Prusa3D\PrusaSlicer-dribbling_2.2.0\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c(1,10): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory [C:\Program Files\Prusa3D\PrusaSlicer-dribbling_2.2.0\build\CMakeFiles\CMakeTmp\cmTC_3680a.vcxproj]
I have looked around at some different threads to find a solution but without luck. Most of them revolve around setting the system environment variables for Boost, but it seems that Cmake gives a message that it ignores this variable. I have also found a thread that suggests adding a line in the CMakeLists.txt to set the boost path before loading the libraries (as far as I understand), but none of these things unfortunately helped.
Hope some of you have a solution for this headscratcher...
I try to build SRT with CMake on Windows 10 using VS2019 as generator.
Thru the Configure step, I have:
The C compiler identification is MSVC 19.23.28106.4 The CXX compiler
identification is MSVC 19.23.28106.4 Check for working C compiler:
C:/Program Files (x86)/Microsoft Visual
Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x86/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual
Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x86/cl.exe
-- broken CMake Error at C:/Program Files/CMake/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60
(message): The C compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x86/cl.exe"
is not able to compile a simple test program. It fails with the
following output:
Change Dir: C:/Users/MLUser/Desktop/SRT/srt-1.4.0/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe
cmTC_3ea98.vcxproj /p:Configuration=Debug /p:Platform=Win32
/p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version
16.3.1+1def00d3d for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) C/C++ Optimizing Compiler Version 19.23.28106.4 for x86
testCCompiler.c
Copyright (C) Microsoft Corporation. All rights reserved.
cl /c /I./MIDL /Zi /W3 /WX- /diagnostics:column /MP /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _LOCAL_NODE
/D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope
/Zc:inline /Fo"cmTC_3ea98.dir\Debug\"
/Fd"cmTC_3ea98.dir\Debug\vc142.pdb" /Gd /TC /analyze-
/errorReport:queue
"C:\Users\MLUser\Desktop\SRT\srt-1.4.0\build\CMakeFiles\CMakeTmp\testCCompiler.c"
cmTC_3ea98.vcxproj -> C:\Users\MLUser\Desktop\SRT\srt-1.4.0\build\CMakeFiles\CMakeTmp\Debug\cmTC_3ea98.exe
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(1992,5):
warning MSB3073: The command
""C:\Users\MLUser\Desktop\SRT\srt-1.4.0\build\CMakeFiles\CMakeTmp\Debug\cmTC_3ea98.exe"
/RegServer" exited with code 1.
[C:\Users\MLUser\Desktop\SRT\srt-1.4.0\build\CMakeFiles\CMakeTmp\cmTC_3ea98.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(1998,5):
error MSB8011: Failed to register output. Please try enabling Per-user
Redirection or register the component from a command prompt with
elevated permissions.
[C:\Users\MLUser\Desktop\SRT\srt-1.4.0\build\CMakeFiles\CMakeTmp\cmTC_3ea98.vcxproj]
CMake will not be able to correctly generate this project. Call
Stack (most recent call first): CMakeLists.txt:15 (project)
UPD
I tried to launch Cmake GUI both with admin and no admin rights.
OK, I see that I had custom properties in: C:\Users\[User]\AppData\Local\Microsoft\MSBuild\v4.0.
It *.props files where it was configured to register output.
I removed them, and passed "output redirection" issue.
I try to build program from command line with CL.
Run next command:
CL -I"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" C:\dev\projects\console-interaction-tester\main.cpp
And I caught error:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include\crtdefs.h(10): fatal error C1083: ...... corecrt.h: No such file or directory
I tried all flags from VS ouptup, like /nologo /TP /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 /showIncludes but it doesn't work.
I need sample of command, what can ignore UniversalCRT, or instruction how fix path. I wanted to add includes dir with corecrt.h but classic location C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\includes doesn't exists!
Install Windows SDK.
Run the VS2017 installer again, and select it (or plainly select the full C++ dev package).
While I am trying to run a simulink model the following error is encountered in relation with compilation and linking of C/C++ code
C:\Comms\slprj\_sfprj\quantizer_sim\_self\sfun\src>call "mexopts.bat"
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
### Compiling "quantizer_sim_sfun.c"
cl.exe /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /I "C:\Program Files\MATLAB\R2012b\extern\include" /I "C:\Program Files\MATLAB\R2012b\simulink\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\mex\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\debugger\include" "quantizer_sim_sfun.c"
quantizer_sim_sfun.c
### Compiling "quantizer_sim_sfun_registry.c"
cl.exe /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /I "C:\Program Files\MATLAB\R2012b\extern\include" /I "C:\Program Files\MATLAB\R2012b\simulink\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\mex\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\debugger\include" "quantizer_sim_sfun_registry.c"
quantizer_sim_sfun_registry.c
### Compiling "c1_quantizer_sim.c"
cl.exe /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /I "C:\Program Files\MATLAB\R2012b\extern\include" /I "C:\Program Files\MATLAB\R2012b\simulink\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\mex\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\debugger\include" "c1_quantizer_sim.c"
c1_quantizer_sim.c
### Compiling "c2_quantizer_sim.c"
cl.exe /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /I "C:\Program Files\MATLAB\R2012b\extern\include" /I "C:\Program Files\MATLAB\R2012b\simulink\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\mex\include" /I "C:\Program Files\MATLAB\R2012b\stateflow\c\debugger\include" "c2_quantizer_sim.c"
c2_quantizer_sim.c
### Linking ...
link.exe /nologo /dll /OPT:NOREF /export:mexFunction /OUT:quantizer_sim_sfun.mexw64 /map:"quantizer_sim_sfun.map" "C:\Program Files\MATLAB\R2012b\stateflow\c\mex\lib\win64\sfc_mex.lib" "C:\Program Files\MATLAB\R2012b\stateflow\c\debugger\lib\win64\sfc_debug.lib" "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libmx.lib" "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libmex.lib" "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libmat.lib" "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libfixedpoint.lib" "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libut.lib" "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libmwmathutil.lib" "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libemlrt.lib" "C:\Program Files\MATLAB\R2012b\lib\win64\libippmwipt.lib" "C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft\libmwblascompat32.lib" #quantizer_sim_sfun.mol
LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe"' : return code '0x450'
Stop.
Error using quantizer_script (line 24)
Error using targetman>throw_make_error (line 588)
(SLSF Diagnostic)
Currently Matlab is configured with Visual Studio 2010 Compiler. In Addition I checked that the LIBPATH is correctly set from Matlab. I am also running Matlab with administator's permissions.
How can the LINK and NMAKE errors be solved?
Visual Studio Express editions are no longer supported.
When you run mex -setup choose the SDK 7.1 (download here, select x64 compilers during installation).
Also be sure you install the .NET Framework 4.0 runtime.
Big however: With the SDK, there is a bug, where compilers get removed (details from MS)! Check it out here too. The patch is on Microsoft's website.
See this support article for tips on how to download and configure the SDK for MATLAB. Maybe confirm that the compilers were selected in the installation.
I am using Visual Studio 2010 to create a small c++ executable. Since I now want to use a different editor I have to call cl.exe and link.exe from the command line.
It is great that VS provides the used command-lines in Project->Properties->C/C++->Commandline and ->Linker->CommandLine
however, they dont work quite like they should:
In the compiler command line I added /c and removed the file-renaming-stuff /Fp /Fa /Fo /Fd (http://msdn.microsoft.com/en-us/library/fwkeyyhe.aspx)
In the linker command line I removed the /MANIFEST and /Manifest
(http://msdn.microsoft.com/en-us/library/y0zzbyt4.aspx)
the result is this:
cl.exe main.cpp /c /Zi /nologo /W3 /WX-
/O1 /Oi /Os /Oy /GL
/D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE"
/Gm- /EHsc /GS /Gy /fp:precise
/Zc:wchar_t /Zc:forScope /Gd /analyze- /errorReport:queue
link.exe *.obj /OUT:"test2.exe" /INCREMENTAL:NO /NOLOGO
"kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib"
"comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib"
"oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib"
/ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'"
/DEBUG /PDB:"F:\prj\visualstudio2010\test2\Release\test2.pdb"
/SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF
/PGD:"F:\prj\visualstudio2010\test2\Release\test2.pgd"
/LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE
The resulting exe works the same way as if i had built it using the GUI, but the problem is that it is 145kb instead of 22kb for some reason. Should I just accept that or is there something obvious that the GUI has and that I am missing?
As an alternative to manually reproducing the individual command line args you can use msbuild.exe to build an entire solution from the command line:
On my machine the command would look like the following:
"c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" /t:Build /verbosity:minimal /maxcpucount /p:Configuration=Debug;Platform="x64" "C:\path\to\some_sln.sln"
Full documentation on msbuild can be found here.
I would try running that and see if you're getting the exe size you expect.
You can see full build log, including command line switches, in the project output directory, program_name.log file. You can also build the project from command line: http://msdn.microsoft.com/en-us/library/vstudio/xee0c8y7.aspx
Actually, it's something the original poster apparently figured out on their own but a critical part of running Visual Studio tools from the command line is to run the following batch file to set your environment variables correctly. Otherwise, you will get an error about missing DLLs, and so on. (This is Visual Studio 2008, Windows 7, but other combinations may be quite similar.)
C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat
which simply runs:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat
You can compile a C++ project from a command line or .bat file. This works for VS2019:
rem path to Visual studio. No quotation marks:
set vspath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
rem path to vcvars files
set batpath=%vspath%\VC\Auxiliary\Build
rem set system path
path %batpath%;%path%
rem set all paths and include directories for 64-bit mode compilation
call vcvars64.bat x64
rem compile:
cl [options] test.cpp /Fetest.exe
rem pause to see if compilation succeeds
pause
rem run the compiled program
test.exe
pause