2

I would like to use Boost.python on a Win7 machine for a python 3.4 project that will connect to our C++ DLL. I'm working my way through the boost.python tutorial and cannot get it to work (see step 14 below). I don't think this issue is related to python 3.4 but something easier (missing path settings in the Visual Studio Command Prompt). I can't figure out how to fix it! Help!

Here are the details of what I'm doing:

As I said it's a Win7 (virtual) Machine and I'm trying to run with 32 bit python/Visual studio. I do have python 3.4 installed and in the path...

Starting from this discussion: How to use Boost in Visual Studio 2010

I do the following:

  1. Start Visual Studio 2010 Command Prompt: Menu->Programs->Microsoft Visual Studio 2010->Visual Studio Tools->Visual Studio Command Prompt
  2. cd C:\Boost\boost_1_55_0
  3. bootstrap
  4. b2 toolset=msvc-10.0 --build-type=complete --with-python --libdir=C:\Boost\lib\i386 install Initial warning link.jam: No such file or directory

    C:\Boost\boost_1_55_0>dir C:\Boost\lib\i386
     Volume in drive C has no label.
     Volume Serial Number is BCA0-48C6
    
     Directory of C:\Boost\lib\i386
    
    06/19/2014  11:45 AM    <DIR>          .
    06/19/2014  11:45 AM    <DIR>          ..
    06/19/2014  11:45 AM           217,088 boost_python-vc100-1_55.dll
    06/19/2014  11:45 AM           188,908 boost_python-vc100-1_55.lib
    06/19/2014  11:43 AM           496,640 boost_python-vc100-gd-1_55.dll
    06/19/2014  11:43 AM           190,156 boost_python-vc100-gd-1_55.lib
    06/19/2014  11:42 AM           217,088 boost_python-vc100-mt-1_55.dll
    06/19/2014  11:42 AM           190,156 boost_python-vc100-mt-1_55.lib
    06/19/2014  11:25 AM           496,640 boost_python-vc100-mt-gd-1_55.dll
    06/19/2014  11:25 AM           191,452 boost_python-vc100-mt-gd-1_55.lib
    06/19/2014  11:30 AM         5,757,576 libboost_python-vc100-1_55.lib
    06/19/2014  11:29 AM        22,050,448 libboost_python-vc100-gd-1_55.lib
    06/19/2014  11:24 AM         5,758,472 libboost_python-vc100-mt-1_55.lib
    06/19/2014  11:23 AM        22,051,792 libboost_python-vc100-mt-gd-1_55.lib
    06/19/2014  11:32 AM         6,247,162 libboost_python-vc100-mt-s-1_55.lib
    06/19/2014  11:31 AM        21,969,684 libboost_python-vc100-mt-sgd-1_55.lib
    06/19/2014  11:35 AM         6,246,266 libboost_python-vc100-s-1_55.lib
    06/19/2014  11:33 AM        21,968,340 libboost_python-vc100-sgd-1_55.lib
                  16 File(s)    114,237,868 bytes
                   2 Dir(s)  14,676,119,552 bytes free
    
  5. Open Visual Studio 2010 and create New "Empty project" called Python.Boost

  6. Right Click on Property Manager->Release|Win32->Microsoft.Cpp.Win32.user and select Properties
  7. Select 'VC++ Directories'
  8. Edit the 'Include Directories' to add C:\Boost\include\boost_1_55_0\boost;C:\Python34\include
  9. Edit the 'Library Directories' to add C:\Boost\lib\i386;C:\Python34\libs
  10. Following instructions from here: http://www.boost.org/doc/libs/1_55_0/libs/python/doc/tutorial/doc/html/python/hello.html
  11. Create user-config.jam in home directory with following content:

    #  MSVC configuration
    using msvc : 10.0 ;
    # Python configuration:
    using python : 3.4 : C:\\Python34 : C:\\Python34\\include : C:\\Python34\\libs ;
    
  12. Open a Windows Command Prompt (started from Python.Boost project through Tools->Visual Studio Command Prompt

  13. cd C:\Boost\boost_1_55_0\libs\python\example\tutorial
  14. bjam

    C:\Boost\boost_1_55_0\libs\python\example\tutorial> bjam
    link.jam: No such file or directory
    ...patience... 
    ...patience... 
    ...found 1685 targets... 
    ...updating 6 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_55.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:\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.pdb ...skipped <p.>hello_ext.pyd for lack of
    <pbin\msvc-10.0\debug>hello_ext.pyd... ...failed updating 2 targets...
    ...skipped 1 target...
    

What am I missing? Seems like the paths are not set as expected? Help appreciated!

Community
  • 1
  • 1
Robert Ekendahl
  • 277
  • 2
  • 11

1 Answers1

0

I found the answer to this the failure above but I'm running into a new issue (Using Python 3.4 makes the linker fail).

To get around this issue I did the following from the command line:

set lib=c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib;C:\Boost\lib\i386;C:\Python34\libs

Followed by another bjam run. With the modified lib setting the linker finds the correct file. This causes another linking issue when using Python3.4 (I will open a separate request for help with that).

As an experiment I moved back to Python2.7 by modifying my 'config-user.jam' to be this:

using python : 2.7 : C:\\Python27 : C:\\Python27\\include : C:\\Python27\\libs ;

Then the program successfully linked and I could then run the hello.py program (using python2.7)

The linker issue with 3.4 looks nastier and I've seen comments around it's issue in other places. I will try to use Python 3.2 as well (or any "3" release) to see if that works. I don't need to use 3.4 but I do need at least Python3.

Robert Ekendahl
  • 277
  • 2
  • 11