简体   繁体   English

Windows Boost 1.64 VS2017缺少Python库

[英]Windows Boost 1.64 VS2017 missing Python libraries

I am trying to build Boost 1.64 on Windows with VS2017. 我正在尝试使用VS2017在Windows上构建Boost 1.64。 Everything builds without errors, but my output libs directory is missing some .lib s and .dll s. 一切都没有错误,但我的输出libs目录缺少一些.lib.dll Specifically, the primary missing library that I need is Boost.Python. 具体来说,我需要的主要缺失库是Boost.Python。

My most recent attempt at building looks like this, although I have tried many different combinations of options: 我最近的建筑尝试看起来像这样,虽然我尝试了很多不同的选项组合:

.\b2 --prefix=c:\boost --build-dir=boost_build --layout=versioned toolset=msvc-14.1 address-model=64 -j4 --with-python -a --reconfigure --stage-dir=stage --build-type=complete --debug-configuration -d2 stage >build.log 2>&1

And my build output looks like this: 我的构建输出如下所示:

notice: found boost-build.jam at C:/boost_1_64_0/boost_1_64_0/boost-build.jam
notice: loading Boost.Build from C:/boost_1_64_0/boost_1_64_0/tools/build/src
notice: Searching 'C:\Windows' 'C:\Users\tsanders' 'C:\Users\tsanders' 'C:\boost_1_64_0\boost_1_64_0\tools/build/src' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/kernel' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/util' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/build' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/tools' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/contrib' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/.' for site-config configuration file 'site-config.jam'.
notice: Configuration file 'site-config.jam' not found in 'C:\Windows' 'C:\Users\tsanders' 'C:\Users\tsanders' 'C:\boost_1_64_0\boost_1_64_0\tools/build/src' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/kernel' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/util' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/build' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/tools' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/contrib' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/.'.
notice: Searching 'C:\Users\tsanders' 'C:\Users\tsanders' 'C:\boost_1_64_0\boost_1_64_0\tools/build/src' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/kernel' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/util' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/build' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/tools' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/contrib' 'C:/boost_1_64_0/boost_1_64_0/tools/build/src/.' for user-config configuration file 'user-config.jam'.
notice: Loading user-config configuration file 'user-config.jam' from 'C:/Users/tsanders'.
notice: [python-cfg] Configuring python...
notice: [python-cfg]   user-specified cmd-or-prefix: "C:\Miniconda2\python.exe"
notice: [python-cfg]   user-specified includes: "C:\Miniconda2\include"
notice: [python-cfg]   user-specified libraries: "C:\Miniconda2\libs"
notice: [python-cfg] Checking interpreter command "C:\Miniconda2\python.exe"...
notice: [python-cfg] running command 'DIR /-C /A:S "C:\Miniconda2\python.exe" 2>&1'
notice: [python-cfg] running command 'C:\Miniconda2\python.exe -c "from sys import *; print('version=%d.%d\nplatform=%s\nprefix=%s\nexec_prefix=%s\nexecutable=%s' % (version_info[0],version_info[1],platform,prefix,exec_prefix,executable))" 2>&1'
notice: [python-cfg] ...requested configuration matched!
notice: [python-cfg] Details of this Python configuration:
notice: [python-cfg]   interpreter command: "C:\Miniconda2\python.exe"
notice: [python-cfg]   include path: "C:\Miniconda2\include"
notice: [python-cfg]   library path: "C:\Miniconda2\libs"
notice: [python-cfg]   DLL search path: "C:\Miniconda2"
notice: [python-cfg] Checking for NumPy...
notice: [python-cfg] running command 'C:\Miniconda2\python.exe -c "import sys; sys.stderr = sys.stdout; import numpy; print(numpy.get_include())"'
notice: [python-cfg] NumPy enabled
notice: Searching '.' for project-config configuration file 'project-config.jam'.
notice: Loading project-config configuration file 'project-config.jam' from '.'.
notice: [msvc-cfg] msvc-14.0 detected, command: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.exe'
notice: [msvc-cfg] msvc-12.0 detected, command: 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe'
notice: [msvc-cfg] msvc-11.0 detected, command: 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cl.exe'
notice: [msvc-cfg] msvc-14.1 detected, command: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64\cl.exe'
notice: will use 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64\cl.exe' for msvc, condition <toolset>msvc-14.1
'notice: [generate-setup-cmd] 14.10.25017 is 14.1'
'notice: [generate-setup-cmd] 14.10.25017 is 14.1'
'notice: [generate-setup-cmd] 14.10.25017 is 14.1'
'notice: [generate-setup-cmd] 14.10.25017 is 14.1'
notice: [msvc-cfg] condition: '<toolset>msvc-14.1/<architecture>/<address-model>', setup: 'call "C:\Users\tsanders\AppData\Local\Temp\b2_msvc_14.10.25017_vcvars32_.cmd" >nul
'
notice: [msvc-cfg] condition: '<toolset>msvc-14.1/<architecture>/<address-model>32', setup: 'call "C:\Users\tsanders\AppData\Local\Temp\b2_msvc_14.10.25017_vcvars32_.cmd" >nul
'
notice: [msvc-cfg] condition: '<toolset>msvc-14.1/<architecture>x86/<address-model>', setup: 'call "C:\Users\tsanders\AppData\Local\Temp\b2_msvc_14.10.25017_vcvars32_.cmd" >nul
'
notice: [msvc-cfg] condition: '<toolset>msvc-14.1/<architecture>x86/<address-model>32', setup: 'call "C:\Users\tsanders\AppData\Local\Temp\b2_msvc_14.10.25017_vcvars32_.cmd" >nul
'
notice: [msvc-cfg] condition: '<toolset>msvc-14.1/<architecture>/<address-model>64', setup: 'call "C:\Users\tsanders\AppData\Local\Temp\b2_msvc_14.10.25017_vcvarsx86_amd64_.cmd" >nul
'
notice: [msvc-cfg] condition: '<toolset>msvc-14.1/<architecture>x86/<address-model>64', setup: 'call "C:\Users\tsanders\AppData\Local\Temp\b2_msvc_14.10.25017_vcvarsx86_amd64_.cmd" >nul
'
notice: [msvc-cfg] condition: '<toolset>msvc-14.1/<architecture>ia64/<address-model>', setup: 'call "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvarsall.bat"  >nul
'
notice: [msvc-cfg] condition: '<toolset>msvc-14.1/<architecture>ia64/<address-model>64', setup: 'call "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvarsall.bat"  >nul
'
notice: [msvc-cfg] condition: '<toolset>msvc-14.1/<architecture>arm/<address-model>', setup: 'call "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvarsall.bat"  >nul
'
notice: [msvc-cfg] condition: '<toolset>msvc-14.1/<architecture>arm/<address-model>32', setup: 'call "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvarsall.bat"  >nul
'
notice: [zlib] Using pre-installed library
notice: [zlib] Condition
notice: [bzip2] Using pre-installed library
notice: [bzip2] Condition
Performing configuration checks

    - 32-bit                   : yes
    - arm                      : no
    - mips1                    : no
    - power                    : no
    - sparc                    : no
    - x86                      : yes
    - symlinks supported       : yes

Component configuration:

    - atomic                   : not building
    - chrono                   : not building
    - container                : not building
    - context                  : not building
    - coroutine                : not building
    - coroutine2               : not building
    - date_time                : not building
    - exception                : not building
    - fiber                    : not building
    - filesystem               : not building
    - graph                    : not building
    - graph_parallel           : not building
    - iostreams                : not building
    - locale                   : not building
    - log                      : not building
    - math                     : not building
    - metaparse                : not building
    - mpi                      : not building
    - program_options          : not building
    - python                   : building
    - random                   : not building
    - regex                    : not building
    - serialization            : not building
    - signals                  : not building
    - system                   : not building
    - test                     : not building
    - thread                   : not building
    - timer                    : not building
    - type_erasure             : not building
    - wave                     : not building

...found 1 target...

Things to note: 注意事项:

  • I use Miniconda instead of a traditional Python install. 我使用Miniconda而不是传统的Python安装。 Could be an issue, although the output from --debug-configuration definitely seems to indicate that it is finding everything correctly. 可能是一个问题,虽然--debug-configuration的输出肯定表明它正在找到正确的一切。
  • After adding some debug messages, I found that the 1 target that it finds is the all target; 添加一些调试消息后,我发现它找到的1 targetall目标; I don't see any kind of build output for the boost.python sources like I see if I build additional libraries. 我没有看到boost.python源的任何类型的构建输出,就像我看到我是否构建了额外的库。
  • Adding extra debug output hasn't been particularly helpful; 添加额外的调试输出并不是特别有用; even with maximum debug output I have not been able to find any errors or warnings related to Python. 即使有最大的调试输出,我也无法找到任何与Python相关的错误或警告。
  • I have also tried to start from the boost.python quickstart , which compiles successfully but fails to link because it cannot find boost_python.dll . 我也尝试从boost.python快速启动开始,它成功编译但无法链接,因为它无法找到boost_python.dll (Although technically I think it should be looking for something like boost_python-vc141-mt-1_64.dll ...) (虽然从技术上讲我认为它应该寻找类似boost_python-vc141-mt-1_64.dll ... boost_python-vc141-mt-1_64.dll 。)

I have tried a number of combinations of options for bootstrap.bat (eg --with-libraries=python , --with-python=C:\\Miniconda2\\python.exe , --with-python-root=C:\\Miniconda2 ) and b2.exe , but nothing seems to make a difference. 我已经为bootstrap.bat尝试了许多选项组合(例如--with-libraries=python , - --with-python=C:\\Miniconda2\\python.exe , - --with-python-root=C:\\Miniconda2 )和b2.exe ,但似乎没有任何区别。

If I download precompiled boost_python libraries and put them alongside the rest of the libraries that I have built, my project builds and runs as expected. 如果我下载预编译的boost_python库并将它们与我构建的其余库一起放置,我的项目将按预期构建和运行。 Building the python libraries myself is the only thing that I am still stuck on. 自己构建python库是我唯一坚持的事情。

I know I'm not alone; 我知道我并不孤单; I posted this question in a Reddit thread , and another user mentioned that he had the same issue; 我在Reddit帖子中发布了这个问题,另一个用户提到他有同样的问题; unfortunately his solution was to "eventually hit on the right set of options for both bootstrap and b2". 不幸的是,他的解决方案是“最终选择了bootstrap和b2的正确选项”。

Has anyone else run into an issue like this? 有没有其他人遇到这样的问题?

I ended up tracing this back to my user-config.jam , where my Python version was unspecified. 我最终将其追溯到我的user-config.jam ,我的Python版本未指定。

Originally, I had this configuration: 最初,我有这个配置:

using python 
    : # version
    : C:\\Miniconda2\\python.exe
    : C:\\Miniconda2\\include
    : C:\\Miniconda2\\libs
    ;

The documentation seems to indicate that leaving "version" empty is fine; 文档似乎表明将“版本”留空是好的; I think an empty version is supposed to mean either "default version" or "all versions". 我认为空版本应该是指“默认版本”或“所有版本”。 However, this caused boost to silently skip building the python libraries. 然而,这导致了无声地跳过构建python库的推动。

Everything is building as expected when explicitly specifying the Python version: 在明确指定Python版本时,所有内容都按预期构建:

using python 
    : 2.7                        # version
    : C:\\Miniconda2\\python.exe # interpreter
    : C:\\Miniconda2\\include    # include dir
    : C:\\Miniconda2\\libs       # library dir
    ;

Building python boost 1.64 libs with Visual Studio seems to be broken . 使用Visual Studio构建python boost 1.64 libs似乎已被打破

Replace <boost_root>/‪libs/python/build/Jamfile by this . 替换<boost_root>/‪libs/python/build/Jamfile通过

I am building it this way : 我建立它这种方式

wget.exe https://dl.dropboxusercontent.com/u/59547297/Libraries/boost_1_64_0.zip -OC:\thirdparty\vs2015\x64\boost_1_64_0.zip    
7za.exe x C:\thirdparty\vs2015\x64\boost_1_64_0.zip -oC:\thirdparty\vs2015\x64
xcopy /y boost_1_64_0\Jamfile C:\thirdparty\vs2015\x64\boost_1_64_0\libs\python\build\Jamfile
del C:\thirdparty\vs2015\x64\boost_1_64_0.zip
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
C:
cd C:\thirdparty\vs2015\x64\boost_1_64_0
call bootstrap.bat
b2 --toolset=msvc-14.0 address-model=64 --build-type=complete stage -j 8

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM