Cannot successfully install Boost.Python - c++

I am trying to install Boost.Python on my computer. (Windows7 64bit, Visual Studio 2012, Python 2.7 64bit and Boost 1.54)
Following the instruction, I've successfully installed the Boost Library, and then I have to separately install Boost.Python.
However, as I followed the instruction at here. I am stuck at step 3.1.4.
I input C:\boost_1_54_0\…\quickstart> bjam toolset=msvc --verbose-test test
Then there are 135 unresolved external errors pop out. One of them is:
exec.obj : error LNK2019: unresolved external symbol
__imp__PyEval_GetGlobals referenced in function "class boost::python::api::object __cdecl boost::python::eval(class
boost::python::str,class boost::python::api::object,class
boost::python::api::object)"
(?eval#python#boost##YA?AVobject#api#12#Vstr#12#V3412#1#Z)........\bin.v2\libs\python\build\msvc-11.0\debug\boost_python-vc110-gd-1_54.dll
May I know how can I work around this?
=========================================================
Edit:
Following #Kyle 's advice, I've uninstalled the 64bit Python and replace it with a 32bit Python (2.7.5).
Then I've wrote a very simple code, which is like follows:
#include <boost\python.hpp> // This header used to raise error before
#include <Python.h>
using namespace std;
void main()
{
return;
}
It works well. Then my curiosity pushed me one step further, and I tried the example in my first post. It turns out that those 135 unresolved external errors are gone. Instead, I've got this:
msvc.link.dll bin\msvc-11.0\debug\extending.pyd LINK : fatal error
LNK1104: cannot open file 'boost_python-vc110-mt-gd-1_54.lib'
call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
nullink /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /MACHINE:X86 /MANIFEST /subsystem:console
/out:"bin\msvc-11.0\debug\extending.pyd"
/IMPLIB:"bin\msvc-11.0\debug\extendi ng.lib"
/LIBPATH:"C:\Python2.7.5\libs"
#"bin\msvc-11.0\debug\extending.pyd.rsp "
if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
...failed msvc.link.dll bin\msvc-11.0\debug\extending.pyd
bin\msvc-11.0\debug\extending.lib bin\msvc-11.0\debug\extending.pdb...
...skipped test_ext for lack of extending.pyd...
msvc.link bin\test_embed.test\msvc-11.0\debug\test_embed.exe LINK : warning
LNK4001: no object files specified; libraries used LINK : error
LNK2001: unresolved external symbol _mainCRTStartup
bin\test_embed.test\msvc-11.0\debug\test_embed.exe : fatal error
LNK1120: 1 unresolved externals
call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 nul
link /NOLOGO /INCREMENTAL:NO /DEBUG /MACHINE:X86 /MANIFEST /subsystem:console
/out:"bin\test_embed.test\msvc-11.0\debug\test_embed.exe"
/LIBPATH:"C:\Python2.7.5\libs"
#"bin\test_embed.test\msvc-11.0\debug\test_embed.exe.rsp"
if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
...failed msvc.link bin\test_embed.test\msvc-11.0\debug\test_embed.exe
bin\test_ embed.test\msvc-11.0\debug\test_embed.pdb...
...removing bin\test_embed.test\msvc-11.0\debug\test_embed.pdb
...skipped test_embed.run for lack of test_embed.exe...
...failed updating 5 targets...
...skipped 4 targets...
Sorry to bother you with a large chunk of error message, I just want to provide as more information as I can.
About this boost_python-vc110-gd-1_54.dll, I can find it at C:\local\boost_1_54_0_32bit\lib32-msvc-11.0, while the root of my Boost is C:\local\boost_1_54_0_32bit\.
Can anyone help me work around with this?

Like Kyle C mentioned, this is happening because it can't find the lib. If you want to use 64-bit, you need to specify address-model=64 on the command line, plus have the 64-bit version of python correctly specified in your user-config.jam file.
I documented what I had to do to get this running, see the bottom for 64-bit specific config.

This means that the linker can't properly link to the Python lib. I have run into this before when trying to link to 64bit Python. You should try installing 32bit python and see if that works.

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.

PIP Install Statsmodels failed with exit code 1120

I have been attempting to download the statsmodels package all day with no luck. I have downloaded the most recent C++ build tools and believe everything is downloaded correctly. When I attempt to pip install statsmodels, I am returned the following error message below. I have also attempted to run pip install statsmodels==0.6.0 which returns with exit status of 2. Not really sure what I can do except uninstall python and c++ build tools then re download. Any advice would be appreciated. Thank you.
set build\lib.win32-3.7\statsmodels/_version.py to '0.10.0'
running build_ext
Creating library build\temp.win32-3.7\Release\statsmodels/tsa/innovations\_arma_innovations.cp37-win32.lib and object build\temp.win32-3.7\Release\statsmodels/tsa/innovations\_arma_innovations.cp37-win32.exp
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
MSVCRT.lib(chandler4gs.obj) : error LNK2001: unresolved external symbol __except_handler4_common
build\lib.win32-3.7\statsmodels\tsa\innovations\_arma_innovations.cp37-win32.pyd : fatal error LNK1120: 1 unresolved externals
error: Command "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\bin\HostX86\x86\link.exe /nologo /INCREMENTAL:NO /LTCG /nodefaultlib:libucrt.lib ucrt.lib /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c:\\users\\dp1069\\appdata\\local\\programs\\python\\python37-32\\lib\\site-packages\\numpy\\core\\lib /LIBPATH:c:\users\dp1069\appdata\local\programs\python\python37-32\libs /LIBPATH:c:\users\dp1069\appdata\local\programs\python\python37-32\PCbuild\win32 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\ATLMFC\lib\x86 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\lib\x86 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x86 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x86 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\ATLMFC\lib\x64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\lib\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64 npymath.lib /EXPORT:PyInit__arma_innovations build\temp.win32-3.7\Release\statsmodels/tsa/innovations/_arma_innovations.obj /OUT:build\lib.win32-3.7\statsmodels\tsa\innovations\_arma_innovations.cp37-win32.pyd /IMPLIB:build\temp.win32-3.7\Release\statsmodels/tsa/innovations\_arma_innovations.cp37-win32.lib" failed with exit status 1120
Command "c:\users\dp1069\appdata\local\programs\python\python37-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\dp1069\\AppData\\Local\\Temp\\pip-install-qd4q52qu\\statsmodels\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\dp1069\AppData\Local\Temp\pip-record-dhpbb7se\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\dp1069\AppData\Local\Temp\pip-install-qd4q52qu\statsmodels\
You are using pip version 18.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build>
For all of those that may come across this issue and have all of the dependency packages already installed, the solution was quite simple. Navigate to https://www.lfd.uci.edu/~gohlke/pythonlibs/ , find your package and follow instructions to download the package via python wheel.

Crypto++ build with msvc /MDd cryptlib.lib Can't find cryptopp.lib when linking

I built the last available version of the library (5.6.5) wanting to use it in a Qt msvc project. The issue is, that the linker want's for some reason the cryptopp.lib that is produced when building the fips dll.
This is my config (only the relevant):
INCLUDEPATH += $$PWD/thirdparty/Win/cryptopp/include
LIBS += -L$$PWD/thirdparty/Win/cryptopp/debug/ -lcryptlib
The compiler output:
LINK : fatal error LNK1104: cannot open file 'cryptopp.lib'
EDIT:
The link command + the result: Which the result is the same as above.
link /NOLOGO /DYNAMICBASE /NXCOMPAT /NODEFAULTLIB:MSVCRT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:debug\QtTrafficBrowser.exe #C:\Users\Mij\AppData\Local\Temp\QtTrafficBrowser.exe.1316.6203.jom
LINK : fatal error LNK1104: cannot open file 'cryptopp.lib'
jom: C:\Users\Mij\qt_creator\qtTrafficBrowser\build-QtTrafficBrowser-Desktop_Qt_5_8_0_MSVC2015_32bit-Debug\Makefile.Debug [debug\QtTrafficBrowser.exe] Error 1104
jom: C:\Users\Mij\qt_creator\qtTrafficBrowser\build-QtTrafficBrowser-Desktop_Qt_5_8_0_MSVC2015_32bit-Debug\Makefile [debug] Error 2
I am not trying to use the DLL!! I know it's different and I knew it from the start so stop asking me not to use it. The problem is that when linking with cryptlib.lib the linker asks for cryptopp.lib also. Is it clear?
I was dumb.
I added the dll.h into my project, that's why it was asking for the cryptopp.lib.
Removed it, and boom, works.
People having a similar issue, look at this also. LNK1104 Cryptopp.lib with CRYPTOPP_DEFAULT_NO_DLL defined in dll project

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

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?