I want to use boost.python
with python 3.2+
(preferably 3.4) and Visual Studio 2010.
When I try to make the libs\python\example\tutorial
example against any Python3 (I have tested 3.0, 3.2 and 3.4) it doesn't link (see below). When I link it against 2.7 it works.
The only change I make between attempts is updating user-config.jam
in my home directory.
So it works when user-config.jam
is:
# MSVC configuration
using msvc : 10.0 ;
# Python configuration:
using python : 2.7 : C:\\Python27 : C:\\Python27\\include : C:\\Python27\\libs ;
When I run bjam
I get:
C:\Boost\boost_1_55_0\libs\python\example\tutorial>bjam
link.jam: No such file or directory
...patience...
...patience...
...found 1678 targets...
...updating 8 targets...
compile-c-c++ bin\msvc-10.0\debug\hello.obj
hello.cpp
msvc.link.dll bin\msvc-10.0\debug\hello_ext.pyd
Creating library bin\msvc-10.0\debug\hello_ext.lib and object bin\msvc-10.0\debug\hello_ext.exp
msvc.manifest.dll bin\msvc-10.0\debug\hello_ext.pyd
common.copy boost_python-vc100-gd-1_55.dll
..\..\..\..\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_55.dll
1 file(s) copied.
common.copy hello_ext.pyd
bin\msvc-10.0\debug\hello_ext.pyd
1 file(s) copied.
capture-output bin\hello.test\msvc-10.0\debug\hello
1 file(s) copied.
**passed** bin\hello.test\msvc-10.0\debug\hello.test
...updated 8 targets...
If I change user-config.jam
to:
# MSVC configuration
using msvc : 10.0 ;
# Python configuration:
using python : 3.4 : C:\\Python34 : C:\\Python34\\include : C:\\Python34\\libs ;
and to bjam clean
and then bjam
I get:
C:\Boost\boost_1_55_0\libs\python\example\tutorial>bjam
link.jam: No such file or directory
...patience...
...patience...
...found 1685 targets...
...updating 9 targets...
compile-c-c++ bin\msvc-10.0\debug\hello.obj
hello.cpp
msvc.link.dll bin\msvc-10.0\debug\hello_ext.pyd
Creating library bin\msvc-10.0\debug\hello_ext.lib and object bin\msvc-10.0\debug\hello_ext.exp
hello.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) struct _object * __cdecl boost::python::detail::init_module(struct PyModuleDef &,void (__cdecl*)(void))" (__imp_?init_module@detail@python@boost@@YAPAU_object@@AAUPyModuleDef@@P6AXXZ@Z) referenced in function _PyInit_hello_ext
bin\msvc-10.0\debug\hello_ext.pyd : fatal error LNK1120: 1 unresolved externals
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:\Python34\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...
...removing bin\msvc-10.0\debug\hello_ext.lib
...removing bin\msvc-10.0\debug\hello_ext.pdb
common.copy boost_python-vc100-gd-1_55.dll
..\..\..\..\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_55.dll
1 file(s) copied.
...skipped <p.>hello_ext.pyd for lack of <pbin\msvc-10.0\debug>hello_ext.pyd...
...failed updating 3 targets...
...skipped 1 target...
...updated 2 targets...
Looking online I find a couple of references to this error but no solutions... Here is the best link:
http://lists.boost.org/boost-build/2011/06/25147.php
I have seen many people talking about using Python3 and boost.python so I must be missing something... Do I need to compile boost specifically for Python 3 somehow?
Help?
/Robert