boostorg / process

Boost Process
https://www.boost.org/libs/process
115 stars 112 forks source link

MSVC compile error #385

Open OgreTransporter opened 1 month ago

OgreTransporter commented 1 month ago

I tried to build boost as in the documentation with b2. However, I get the following error message:

16:44:14 compile-c-c++ build-143-x64\boost\bin.v2\libs\process\build\msvc-14.3\debug\x86_64\threading-multi\shell.obj
16:44:14 shell.cpp
16:44:14 Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:
16:44:14 - add -D_WIN32_WINNT=0x0601 to the compiler command line; or
16:44:14 - add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions.
16:44:14 Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).
16:44:14 msvc.link.dll build-143-x64\boost\bin.v2\libs\process\build\msvc-14.3\debug\x86_64\threading-multi\boost_process-vc143-mt-gd-x64-1_86.dll
16:44:14 process_handle_windows.obj : error LNK2019: Unresolved external symbol "RtlNtStatusToDosError" in function ""void __cdecl boost::process::v2::detail::suspend_(void *,class boost::system::error_code &)" (?suspend_@detail@v2@process@boost@@YAXPEAXAEAVerror_code@system@4@@Z)".
16:44:14 env.obj : error LNK2001: Unresolved external symbol "RtlNtStatusToDosError".
16:44:14 proc_info.obj : error LNK2001: Unresolved external symbol "RtlNtStatusToDosError".
16:44:14 process_handle_windows.obj : error LNK2019: Unresolved external symbol "NtResumeProcess" in function ""void __cdecl boost::process::v2::detail::resume_(void *,class boost::system::error_code &)" (?resume_@detail@v2@process@boost@@YAXPEAXAEAVerror_code@system@4@@Z)".
16:44:14 process_handle_windows.obj : error LNK2019: Unresolved external symbol "NtSuspendProcess" in function ""void __cdecl boost::process::v2::detail::suspend_(void *,class boost::system::error_code &)" (?suspend_@detail@v2@process@boost@@YAXPEAXAEAVerror_code@system@4@@Z)".
16:44:14 env.obj : error LNK2019: Unresolved external symbol "NtQueryInformationProcess" in function ""struct boost::process::v2::ext::env_view __cdecl boost::process::v2::ext::env(void *,class boost::system::error_code &)" (?env@ext@v2@process@boost@@YA?AUenv_view@1234@PEAXAEAVerror_code@system@4@@Z)".
16:44:14 proc_info.obj : error LNK2001: Unresolved external symbol "NtQueryInformationProcess".
16:44:14 build-143-x64\boost\bin.v2\libs\process\build\msvc-14.3\debug\x86_64\threading-multi\boost_process-vc143-mt-gd-x64-1_86.dll : fatal error LNK1120: 4 unresolved external links
OgreTransporter commented 1 month ago

Fixed by 8b3e90234b7eb6ab06e32b6da4fb17eb09d42571

OgreTransporter commented 1 month ago

New error:

...failed updating 2 targets...
   common.copy D:\workspace\boost\install\lib\boost_process-vc143-mt-gd-x64-1_86.lib
   common.copy D:\workspace\boost\install\lib\boost_process-vc143-mt-x64-1_86.lib

Edit:

common.copy D:\workspace\boost\install\lib\boost_process-vc143-mt-gd-x64-1_86.lib
The system cannot find the specified file.

     copy /b "build-143-x64\boost\bin.v2\libs\process\build\msvc-14.3\debug\x86_64\threading-multi\boost_process-vc143-mt-gd-x64-1_86.lib" + this-file-does-not-exist-A698EE7806899E69 "D:\workspace\boost\install\lib\boost_process-vc143-mt-gd-x64-1_86.lib"

 ...failed common.copy D:\workspace\boost\install\lib\boost_process-vc143-mt-gd-x64-1_86.lib...
klemens-morgenstern commented 1 month ago

Can you share the commands used for the last error?

OgreTransporter commented 1 month ago
cd /d D:\workspace\boost
SET WORKSPACE=%CD%
SET PATH=D:\VisualStudio\Tools\Git\bin;D:\VisualStudio\Tools\Python\3.11.9;%PATH%
git clone https://github.com/madler/zlib.git %CD%\deps\zlib\src
git clone https://git.code.sf.net/p/bzip2/bzip2 %CD%\deps\bzip2\src
git clone --recursive https://github.com/boostorg/boost.git %CD%\src
powershell -ExecutionPolicy ByPass -C "if((Get-Content -Path ($env:WORKSPACE+'\src\libs\process\build\Jamfile') -Raw).IndexOf('lib shell32') -lt 0) { Start-BitsTransfer -Dynamic -Source 'https://raw.githubusercontent.com/boostorg/process/develop/build/Jamfile' -Destination ($env:WORKSPACE+'\src\libs\process\build\Jamfile') }"
echo using python : 3.11 : D:\VisualStudio\Tools\Python\3.11.9\python.exe>%CD%\src\user-config.jam
echo     : D:\VisualStudio\Tools\Python\3.11.9\include>>%CD%\src\user-config.jam
echo     : D:\VisualStudio\Tools\Python\3.11.9\libs ;>>%CD%\src\user-config.jam
powershell -ExecutionPolicy ByPass -C "(Get-Content -Path ($env:WORKSPACE+'\src\user-config.jam') -Raw).Replace('\','\\') | Set-Content -Path ($env:WORKSPACE+'\src\user-config.jam')"
cd src
call bootstrap.bat
b2.exe headers --user-config=%CD%\user-config.jam
b2.exe --user-config=%CD%\user-config.jam -j %NUMBER_OF_PROCESSORS% --toolset=msvc-14.3 --build-type=complete --build-dir=build-143-x64 -sBZIP2_SOURCE=%WORKSPACE%\deps\bzip2\src -sBZIP2_BINARY=bzip2static -sBZIP2_INCLUDE=%WORKSPACE%\deps\bzip2\install\include -sBZIP2_LIBPATH=%WORKSPACE%\deps\bzip2\install\lib -sZLIB_SOURCE=%WORKSPACE%\deps\zlib\src -sZLIB_BINARY=zlibstatic -sZLIB_INCLUDE=%WORKSPACE%\deps\zlib\install\include -sZLIB_LIBPATH=%WORKSPACE%\deps\zlib\install\lib architecture=x86 address-model=64 threading=multi stage --stagedir=%WORKSPACE%\install

At the end it says:

...updated 6078 targets...

...failed updating 2 targets...
   common.copy D:\workspace\boost\install\lib\boost_process-vc143-mt-gd-x64-1_86.lib
   common.copy D:\workspace\boost\install\lib\boost_process-vc143-mt-x64-1_86.lib

Unfortunately, there is not much in the build log: build.log

msvc.link.dll build-143-x64\boost\bin.v2\libs\process\build\msvc-14.3\debug\x86_64\threading-multi\boost_process-vc143-mt-gd-x64-1_86.dll
common.copy D:\workspace\boost\install\lib\boost_process-vc143-mt-gd-x64-1_86.lib
Das System kann die angegebene Datei nicht finden.

    copy /b "build-143-x64\boost\bin.v2\libs\process\build\msvc-14.3\debug\x86_64\threading-multi\boost_process-vc143-mt-gd-x64-1_86.lib" + this-file-does-not-exist-A698EE7806899E69 "D:\workspace\boost\install\lib\boost_process-vc143-mt-gd-x64-1_86.lib"

...failed common.copy D:\workspace\boost\install\lib\boost_process-vc143-mt-gd-x64-1_86.lib...
klemens-morgenstern commented 1 month ago

I have no idea what's going on. Maybe try to remove bin.v2 and build from scratch?