2

I'm just trying to follow the instructions here to get the Quickstart example working. I am on Windows 7 and trying to use MSVC. I have Python 2.7 installed.

What I have done:

  • Download boost_1_57_0.zip and extract to C:\boost_1_57_0.
  • From command prompt in C:\boost_1_57_0, run:

    bootstrap
    

    then:

    .\b2
    

    as per the instructions under 5.1 here. After this I have a message saying "The Boost C++ Libraries were successfully built!".

  • Add C:\boost_1_57_0 to my path. The instructions don't say to do this, but since they want me to invoke bjam, and that's where it lives, I assume I need to do this.
  • Modify C:\boost_1_57_0\libs\python\example\quickstart\boost-build.jam so that the path is boost-build ../../../../tools/build/src ; and not boost-build ../../../../tools/build/v2 ;. This is as per the instructions here since the original path is wrong and if you don't do this the bjam invocation fails.
  • CD into C:\boost_1_57_0\libs\python\example\quickstart and run:

    bjam toolset=msvc --verbose-test test
    

The output I get is firstly:

...patience...
...patience...
...found 1926 targets...
...updating 55 targets...
common.mkdir bin
common.mkdir bin\test_ext.test
common.mkdir bin\test_ext.test\msvc-12.0
common.mkdir bin\test_ext.test\msvc-12.0\debug
common.mkdir bin\test_ext.test\msvc-12.0\debug\threading-multi
common.mkdir bin\msvc-12.0
common.mkdir bin\msvc-12.0\debug
common.mkdir bin\msvc-12.0\debug\threading-multi
compile-c-c++ bin\msvc-12.0\debug\threading-multi\extending.obj
extending.cpp
c:\python27\include\pymath.h(22) : warning C4273: 'round' : inconsistent dll linkage
    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(516) : see previous definition of 'round'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xtgmath.h(190) : warning C4273: '_hypot' : inconsistent dll linkage

followed by a long list of other header file entries, each complaining about inconsistent dll linkage, and then at the end a bunch of errors, highlights of which include:

LINK : fatal error LNK1207: incompatible PDB format in 'C:\boost_1_57_0\libs\python\example\quickstart\bin\msvc-12.0\debug\threading-multi\extending.pdb'; delete and rebuild

...failed msvc.link.dll bin\msvc-12.0\debug\threading-multi\extending.pyd bin\msvc-12.0\debug\threading-multi\extending.pdb...
...removing bin\msvc-12.0\debug\threading-multi\extending.pdb

LINK : warning LNK4001: no object files specified; libraries used
LINK : error LNK2001: unresolved external symbol _mainCRTStartup
bin\test_embed.test\msvc-12.0\debug\threading-multi\test_embed.exe : fatal error LNK1120: 1 unresolved externals

...failed msvc.link bin\test_embed.test\msvc-12.0\debug\threading-multi\test_embed.exe bin\test_embed.test\msvc-12.0\debug\threading-multi\test_embed.pdb...
...removing bin\test_embed.test\msvc-12.0\debug\threading-multi\test_embed.pdb
...skipped <pbin\test_embed.test\msvc-12.0\debug\threading-multi>test_embed.run for lack of <pbin\test_embed.test\msvc-12.0\debug\threading-multi>test_embed.exe...
...failed updating 4 targets...

Any ideas?

3 Answers 3

4

The problem is still present with 1.59. I've managed to get Boost.Build working again by editing the file:

D:\boost\boost_1_59_0\tools\build\src\tools\msvc.jam

I made two changes:

  1. Change this (lines #1351-1355):

         generators.register [ new msvc-linking-generator msvc.link.dll :
             OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : SHARED_LIB IMPORT_LIB :
             <toolset>msvc <suppress-import-lib>false ] ;
         generators.register [ new msvc-linking-generator msvc.link.dll :
             OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : SHARED_LIB :
             <toolset>msvc <suppress-import-lib>true ] ;
    

    to:

        generators.register [ new msvc-linking-generator msvc.link.dll :
            OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : SHARED_LIB IMPORT_LIB :
            <toolset>msvc ] ;
    
  2. Remove this line (#1472):

        toolset.flags msvc.link.dll LINKFLAGS <suppress-import-lib>true : /NOENTRY ;
    

I've tested this on Win7 with VS2012 and Python 2.7.

Sign up to request clarification or add additional context in comments.

1 Comment

I can confirm that current boost 1.62 has the same issue. This fix is working (tested on Windows 10 with msvc-12 and python-3.4).
1

I also saw that incompatible PDB format issue, but only with 1.57, which (since the Boost.Python source is the same for 1.57 and 1.55 and I can get it working on 1.55) I'm guessing is somehow related to the changes in the boost::build path.

I've documented what I had to do to get it working with 1.55, maybe that will be some help.

2 Comments

Thanks, sorry I had to leave this and haven't tried again for months, but now I've followed the instructions linked and it appears to work. For anyone else: it appears the easiest thing to do is use 1.55, since 1.56 and above have the pdb format problem. Also, I don't think I'd set up the user-config.jam as you suggest. BTW, you have a typo in the user-config.jam on your blog - you've mis-spelt 'python' here: "C:\\Pyhton27-32\\libs # link libs".
I've updated the gist, thanks for pointing out that error. Also 1.59 is out next week, I'm hoping this will be fixed then.
1

Madness I tell you.

Anyway, I finally succeeded in building the quickstart example on boost_1_68_0. A quick guidethrough:

  • (On windows, visual studio 2017 and SDK installed, python 3.5 installed)
  • Download and extract it in like C:\boost_1_68_0
  • Run bootstrap.bat
  • Build the boost-python libraries:

C:\boost_1_68_0>.\b2 --with-python -j4

  • Go to C:\boost_1_68_0\libs\python\example, and fix the Jamroot to find your header files

    project
  : requirements
    <include>C:\\boost_1_68_0
    <library>boost_python

  • Fix the tools\build\src\tools\msvc.jam file in the way Ralph in this post commented
  • As described here , patch embedding.cpp and extending.cpp by adding "#define BOOST_PYTHON_STATIC_LIB" as the first line everywhere
  • Copy the built python-boost libs (from C:\boost_1_68_0\stage\lib) to the quickstart folder
  • Finally build it

C:\boost_1_68_0\libs\python\example\quickstart>..\..\..\..\b2.exe -j4

Again, this is -crazy- complex. All the other stuff builds just fine, but the python linkage is really broken. Anyway, in case anyone tries, hope this helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.