Trouble building boost 1.48 - c++

I am having trouble building boost 1.48 using my normal build command line, which in a Visual Studio x64 Win64 command prompt consists of:
bjam -j 8 --without-mpi --without-python --build-dir=vc100-bld-64-bit
--build-type=complete --toolset=msvc-10.0 architecture=x86
address-model=64 --stagedir=64-bit-vc100 debug-symbols=on
debug-store=database stage
The errors I get are ...failed compile lines towards the bottom of the following output excerpt which complain about precompiled header inconsistencies:
...patience...
...patience...
...patience...
...patience...
...found 9190 targets...
...updating 3251 targets...
common.mkdir 64-bit-vc100
common.mkdir 64-bit-vc100\lib
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static\runtime-link-static
compile-c-c++-pch vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static\runtime-link-static\pch.pch
pch.pch.cpp
compile-c-c++ vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static\runtime-link-static\assoc_laguerre.obj
assoc_laguerre.cpp
libs\math\build\..\src\tr1\assoc_laguerre.cpp(6) : error C2858: command-line option 'program database name (/Fde:\dev\devel\libs\boost\boost_1_48_0\vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store
-database\link-static\runtime-link-static\libboost_math_tr1-vc100-sgd-1_48.pdb)' inconsistent with precompiled header, which used '/Fde:\dev\devel\libs\boost\boost_1_48_0\vc100.pdb'
libs\math\build\..\src\tr1\assoc_laguerre.cpp(6) : error C2859: e:\dev\devel\libs\boost\boost_1_48_0\vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static\runtime-link-static\libbo
ost_math_tr1-vc100-sgd-1_48.pdb is not the pdb file that was used when this precompiled header was created, recreate the precompiled header.
call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64 >nul
cl /Zm800 -nologo #"vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static\runtime-link-static\assoc_laguerre.obj.rsp"
...failed compile-c-c++ vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static\runtime-link-static\assoc_laguerre.obj...
compile-c-c++ vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static\runtime-link-static\assoc_legendre.obj
assoc_legendre.cpp
libs\math\build\..\src\tr1\assoc_legendre.cpp(6) : error C2858: command-line option 'program database name (/Fde:\dev\devel\libs\boost\boost_1_48_0\vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store
-database\link-static\runtime-link-static\libboost_math_tr1-vc100-sgd-1_48.pdb)' inconsistent with precompiled header, which used '/Fde:\dev\devel\libs\boost\boost_1_48_0\vc100.pdb'
Is there something about my build command that makes the build fail?
Update: The problems occur due to the debug-store=database command line option to bjam. Is this option's syntax incorrect or did it change in 1.48?
Update 2: If you turn off precompiled headers by adding the pch=off option to the command, this problem goes away, but the build is probably slower, because precompiled headers are disabled.

Related

"Cannot open input file 'libcrypto.lib'" while installing libtorrent C++ library

I am attempting to install the libtorrent C++ library (cloned from GitHub repository) on Windows 11 with OpenSSL 1.1.1i installed and Visual Studio 2022.
Invoking b2 in my libtorrent source folder is returning the error LINK : fatal error LNK1181: cannot open input file 'libcrypto.lib'.
The file libcrypto.lib definitely exists in C:\Users\Me\openssl and C:\Users\Me\openssl is in my PATH. Installation was running fine until this point.
My steps were:
$ set LIB="C:\Users\Me\openssl";%LIB%
$ set INCLUDE="C:\Users\Me\openssl\include";%INCLUDE%
$ set BOOST_ROOT=c:\boost_1_80_0
$ set BOOST_BUILD_PATH=%BOOST_ROOT%\tools\build
$ cd "C:\Users\Me\libtorrent"
$ b2
The last step returns:
...updating 3 targets... msvc.link.dll
bin\msvc-14.3\debug\cxxstd-14-iso\threading-multi\torrent-rasterbar.dll
LINK : fatal error LNK1181: cannot open input file 'libcrypto.lib'
call "bin\standalone\msvc\msvc-14.3\msvc-setup.bat" >nul link /NOLOGO /INCREMENTAL:NO
#"bin\msvc-14.3\debug\cxxstd-14-iso\threading-multi\torrent-rasterbar.dll.rsp"
...failed msvc.link.dll
bin\msvc-14.3\debug\cxxstd-14-iso\threading-multi\torrent-rasterbar.dll
bin\msvc-14.3\debug\cxxstd-14-iso\threading-multi\torrent.lib
bin\msvc-14.3\debug\cxxstd-14-iso\threading-multi\torrent-rasterbar.pdb...
...removing
bin\msvc-14.3\debug\cxxstd-14-iso\threading-multi\torrent-rasterbar.pdb
...failed updating 3 targets...
Edit: Fixed a typo
Solved by copying libcrypto.lib to LIB path specified in user-config.jam.

Boost build fails with "failed common.mkdir build"

I am trying to build Boost 1.77 using Visual Studio Enterprise 2017 on Windows 10:
I download file boost_1_77_0.zip and uncompress it.
I open an "x86 Native Tools Command Prompt" and cd to the boost_1_77_0 directory.
I run bootstrap.
I run b2...
.\b2 --build-dir=build/x86 address-model=32 architecture=x86 toolset=msvc-14.1 --build-type=complete stage
...this fails and in file boost_1_77_0\build\x86\boost\bin.v2\config.log I have:
...found 20 targets...
...updating 16 targets...
if not exist "build\\" mkdir "build"
...failed common.mkdir build...
...skipped build\x86 for lack of build...
...skipped build\x86\boost for lack of build\x86...
[snip]
...skipped build\x86\boost\bin.v2\check\predef\msvc-14.1\release\address-model-32\architecture-x86\runtime-link-static\threading-multi for lack of build\x86\boost\bin.v2\check\predef\msvc-14.1\release\address-model-32\architecture-x86\runtime-link-static...
...skipped <pbuild\x86\boost\bin.v2\check\predef\msvc-14.1\release\address-model-32\architecture-x86\runtime-link-static\threading-multi>predef_check_cc_09a06289f4560e2f553bb0cbbec71436.obj for lack of build\x86\boost\bin.v2\check\predef\msvc-14.1\release\address-model-32\architecture-x86\runtime-link-static\threading-multi...
...skipped 3 targets...
...found 1 target...
...updating 1 target...
config-cache.write build\x86\boost\bin.v2\project-cache.jam
This program is blocked by group policy. For more information, contact your system administrator.
type "C:\Users\my_username\AppData\Local\Temp\jam5298fccb.000" > "build\x86\boost\bin.v2\project-cache.jam"
...failed config-cache.write build\x86\boost\bin.v2\project-cache.jam...
...failed updating 1 target...
Any idea what I'm doing wrong? I see that error about group policy but I can't find the root cause of it. When I execute that "type" command at the command line it completes successfully.
Edit: I found a solution which I posted below as an answer. Stackoverflow forbids me from marking that answer as accepted because my account is not old enough.
Something within the bowels of the boost build system is attempting to do something for which I lack the necessary permissions. The workaround was to launch a command window from within Visual Studio (rather than from the windows start menu) and invoke the build from there. The organization is forced to allow VS to run with elevated permissions, and these are inherited by the command window, which then allows the boost build to succeed.

boost - adding path to 'corecrt.h'

I have a hello.cpp file and I used a tutorial about boost installation from here.
I did everything like they said and I have a problem trying to run it.
I get:
...found 9 targets...
...updating 3 targets...
compile-c-c++ bin\msvc-14.0\debug\hello.obj
hello.cpp
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\crtdefs.h(10): fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory
call "C:\Users\Paula\AppData\Local\Temp\b2_msvc_14.0_vcvarsall_x86.cmd" >nul
cl /Zm800 -nologo #"bin\msvc-14.0\debug\hello.obj.rsp"
...failed compile-c-c++ bin\msvc-14.0\debug\hello.obj...
...skipped <pbin\msvc-14.0\debug>hello.exe for lack of <pbin\msvc-14.0\debug>hello.obj...
...skipped <pbin\msvc-14.0\debug>hello.pdb for lack of <pbin\msvc-14.0\debug>hello.obj...
...failed updating 1 target...
...skipped 2 targets...
I have corecrt.h in:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10150.0\ucrt
and in:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt
I tried setting includes and libraries like here Unable to compile and link simple C++ program with Visual Studio 2015 command line tools but it doesn't work for me. I tried to find help here: Introducing the Universal CRT, but I'm not creating any project in VS, just trying to run one with a Command Prompt and I'm not sure what to do in my case. I'm totally new in this topic and I know my question may be stupid, but I really need it. I spent many hours trying to solve it and I have nothing.
Found solution here: https://svn.boost.org/trac/boost/ticket/11487
1) Go to %TEMP% folder
2) Remove all b2_*.cmd files

build Boost in release mode

That is with Boost 1.55.0.
In a Cygwin shell, after cmd /c "bootstrap.bat", my command is:
./b2 variant=release runtime-debugging=off -sICU_PATH=z:/icu-installed -sICU_LINK="/LIBPATH:z:\icu-installed\lib sicuuc.lib sicudt.lib sicuin.lib " --prefix=z:/boost-installed toolset=msvc link=static --without-python --reconfigure install
Output:
link.jam: No such file or directory
Performing configuration checks
- 32-bit : yes
- arm : no
- mips1 : no
- power : no
- sparc : no
- x86 : yes
- has_icu builds : no
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam
...
In bin.v2/config.log, I get this:
...found 8 targets...
...updating 7 targets...
common.mkdir bin.v2
common.mkdir bin.v2\libs
common.mkdir bin.v2\libs\context
common.mkdir bin.v2\libs\context\config
common.mkdir bin.v2\libs\context\config\msvc-12.0
common.mkdir bin.v2\libs\context\config\msvc-12.0\debug
compile-c-c++ bin.v2\libs\context\config\msvc-12.0\debug\32.obj
32.cpp
...updated 7 targets...
...found 2 targets...
...updating 1 target...
...
common.mkdir bin.v2\libs\regex\build\msvc-12.0\debug
compile-c-c++ bin.v2\libs\regex\build\msvc-12.0\debug\has_icu_test.obj
has_icu_test.cpp
...
msvc.link bin.v2\libs\regex\build\msvc-12.0\debug\has_icu.exe
sicuuc.lib(udata.ao) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in has_icu_test.obj
sicuuc.lib(udata.ao) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in has_icu_test.obj
...
So, for some reason, it uses Debug settings there.
How can I build Boost in Release mode?
Or are just the config test builds in Debug mode and the rest would actually be in Release mode? But why is that? And how can I also have the config test builds in Debug mode?
Esp., in this case, has_icu fails because I have build that lib in Release mode (/MD).
I find BlueGo tool quite helpful for building boost. You can configure Release/Debug modes and select other configurations too.

Boost.Python dll being skipped on compile

I am new to python programming and am looking to incorporate some C++ dll's into python. I found boost.python to be the most common answer to this issue and have been trying to test it with a simple 'hello world' application that comes with the boost.python package. Following the tutorial at http://www.boost.org/doc/libs/1_54_0/libs/python/doc/tutorial/doc/html/python/hello.html
I am running Windows 7 using Microsoft Visual Studio 10.0.
My python directory is 'C:\Python27', Boost is 'C:\Boost\boost_1_54_0'
I have set the user-config.jam file to using msvc : 10.0 ; and using python : 2.7 : C:\\Python27 ;
When I invoke bjam I get the following..
...failed msvc.link.dll C:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_54.dll C:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_54.lib C:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_54.pdb...
...removing C:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_54.lib
...removing C:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_54.pdb
...skipped <pbin\msvc-10.0\debug>hello_ext.pyd for lack of <pC:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug>boost_python-vc100-gd-1_54.lib...
...skipped <pbin\msvc-10.0\debug>hello_ext.lib for lack of <pC:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug>boost_python-vc100-gd-1_54.lib...
...skipped <pbin\msvc-10.0\debug>hello_ext.pdb for lack of <pC:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug>boost_python-vc100-gd-1_54.lib...
...skipped <p.>boost_python-vc100-gd-1_54.dll for lack of <pC:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug>boost_python-vc100-gd-1_54.dll...
...skipped <p.>hello_ext.pyd for lack of <pbin\msvc-10.0\debug>hello_ext.pyd...
...skipped <pbin\hello.test\msvc-10.0\debug>hello for lack of <pbin\msvc-10.0\debug>hello_ext.pyd...
...failed updating 3 targets...
...skipped 7 targets...
All that is created is an .obj file in:
C:\Boost\boost_1_54_0\libs\python\example\tutorial\bin\msvc-10.0\debug
From my basic limited knowledge it appears the files that are relied upon are being removed just before compilation. I have searched long and hard for a solution but to no avail. It feels like I am missing something very elementary.
Thank you.
EDIT: Updating to python 3.3 seems to have gotten me closer. It is no longer removing the two files from bin.v2, but it is still not compiling a .dll or .pyb file.
PS C:\Boost\boost_1_54_0\libs\python\example\tutorial> .\bjam
...patience...
...patience...
...found 1681 targets...
...updating 7 targets...
msvc.link.dll bin\msvc-10.0\debug\hello_ext.pyd
LINK : fatal error LNK1104: cannot open file 'boost_python-vc100-mt-gd-1_54.lib'
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 >nul
link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /MACHINE:X86 /MANIFEST /subsystem:console/out:"bin\msvc-10.0\debug\hello_ext.pyd"
/IMPLIB:"bin\msvc-10.0\debug\hello_ext.lib" /LIBPATH:"C:\Python33\libs" #"bin\msvc-10.0\debug\hello_ext.pyd.rsp"
if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
...failed msvc.link.dll bin\msvc-10.0\debug\hello_ext.pyd bin\msvc-10.0\debug\hello_ext.lib bin\msvc-10.0\debug\hello_ext.pdb bin\msvc-10.0\debug\hello_ext.pdb...
...skipped <p.>hello_ext.pyd for lack of <pbin\msvc-10.0\debug>hello_ext.pyd...
...failed updating 3 targets...
...skipped 1 target...
SOLVED: First I rebuilt boost.python by running b2 toolset=msvc-10.0 --with-python --user-config=user-config.jam --build-type=complete stage in C:\Boost\boost_1_54_0 then I copied the boost_python-vc100-mt-gd-1_54.lib file into the tutorial folder. Not sure this is the best solution but it seems to now be working.
I suggest to mention python installation path in your configuration file:
using python : 2.7 : C:\Python27\;
Did you cd into the same directory where jamroot and hello.cpp is located?