编译问题

编译问题

我在用此方法我正在做的研究,但我在设置方面遇到了一些困难。在页面的大约一半处,它说要运行./bootstrap.sh --with-python=python3 sudo ./b2 --with-python --with-filesystem --with-system --with-regex install,然后标记响应应该是什么。它几乎完美地工作,但有几个文件我无法弄清楚如何安装;特别是/usr/local/lib/libboost_python3.so/usr/local/lib/libboost_numpy3.so。以下是完整的响应:(请注意,这root@cole-desktop:/home/cole/Downloads/Mass/boost_1_66_0# ./bootstrap.sh --with-python=python3是自动填充的,我只需按回车键即可。)

   Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2
Detecting Python version... 3.8
Detecting Python root... /usr
Unicode/ICU support for Boost.Regex?... not found.
Backing up existing Boost.Build configuration in project-config.jam.2
Generating Boost.Build configuration in project-config.jam...

Bootstrapping is done. To build, run:

    ./b2
    
To adjust configuration, edit 'project-config.jam'.
Further information:

   - Command line help:
     ./b2 --help
     
   - Getting started guide: 
     http://www.boost.org/more/getting_started/unix-variants.html
     
   - Boost.Build documentation:
     http://www.boost.org/build/doc/html/index.html

root@cole-desktop:/home/cole/Downloads/Mass/boost_1_66_0# sudo ./b2 --with-python --with-filesystem --with-system --with-regex install
Performing configuration checks

    - 32-bit                   : no  (cached)
    - 64-bit                   : yes (cached)
    - arm                      : no  (cached)
    - mips1                    : no  (cached)
    - power                    : no  (cached)
    - sparc                    : no  (cached)
    - x86                      : yes (cached)
    - symlinks supported       : yes (cached)
    - has_icu builds           : no  (cached)

Component configuration:

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

...patience...
...patience...
...found 31231 targets...
...updating 11 targets...
gcc.compile.c++ bin.v2/libs/python/build/gcc-gnu-9/release/threadapi-pthread/threading-multi/converter/builtin_converters.o
libs/python/src/converter/builtin_converters.cpp: In function ‘void* boost::python::converter::{anonymous}::convert_to_cstring(PyObject*)’:
libs/python/src/converter/builtin_converters.cpp:51:35: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
   51 |       return PyUnicode_Check(obj) ? _PyUnicode_AsString(obj) : 0;

    "g++"   -O3 -finline-functions -Wno-inline -Wall -pthread -fPIC -m64  -DBOOST_ALL_NO_LIB=1 -DBOOST_PYTHON_SOURCE -DNDEBUG  -I"." -I"/usr/include/python3.8" -c -o "bin.v2/libs/python/build/gcc-gnu-9/release/threadapi-pthread/threading-multi/converter/builtin_converters.o" "libs/python/src/converter/builtin_converters.cpp"

...failed gcc.compile.c++ bin.v2/libs/python/build/gcc-gnu-9/release/threadapi-pthread/threading-multi/converter/builtin_converters.o...
...skipped <pbin.v2/libs/python/build/gcc-gnu-9/release/threadapi-pthread/threading-multi>libboost_python3.so.1.66.0 for lack of <pbin.v2/libs/python/build/gcc-gnu-9/release/threadapi-pthread/threading-multi>converter/builtin_converters.o...
...skipped <p/usr/local/lib>libboost_python3.so.1.66.0 for lack of <pbin.v2/libs/python/build/gcc-gnu-9/release/threadapi-pthread/threading-multi>libboost_python3.so.1.66.0...
...skipped <p/usr/local/lib>libboost_python3.so for lack of <p/usr/local/lib>libboost_python3.so.1.66.0...
...skipped <pbin.v2/libs/python/build/gcc-gnu-9/release/threadapi-pthread/threading-multi>libboost_numpy3.so.1.66.0 for lack of <pbin.v2/libs/python/build/gcc-gnu-9/release/threadapi-pthread/threading-multi>libboost_python3.so.1.66.0...
...skipped <p/usr/local/lib>libboost_numpy3.so.1.66.0 for lack of <pbin.v2/libs/python/build/gcc-gnu-9/release/threadapi-pthread/threading-multi>libboost_numpy3.so.1.66.0...
...skipped <p/usr/local/lib>libboost_numpy3.so for lack of <p/usr/local/lib>libboost_numpy3.so.1.66.0...
gcc.compile.c++ bin.v2/libs/python/build/gcc-gnu-9/release/link-static/threadapi-pthread/threading-multi/converter/builtin_converters.o
libs/python/src/converter/builtin_converters.cpp: In function ‘void* boost::python::converter::{anonymous}::convert_to_cstring(PyObject*)’:
libs/python/src/converter/builtin_converters.cpp:51:35: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
   51 |       return PyUnicode_Check(obj) ? _PyUnicode_AsString(obj) : 0;

    "g++"   -O3 -finline-functions -Wno-inline -Wall -pthread -m64  -DBOOST_ALL_NO_LIB=1 -DBOOST_PYTHON_SOURCE -DBOOST_PYTHON_STATIC_LIB -DNDEBUG  -I"." -I"/usr/include/python3.8" -c -o "bin.v2/libs/python/build/gcc-gnu-9/release/link-static/threadapi-pthread/threading-multi/converter/builtin_converters.o" "libs/python/src/converter/builtin_converters.cpp"

...failed gcc.compile.c++ bin.v2/libs/python/build/gcc-gnu-9/release/link-static/threadapi-pthread/threading-multi/converter/builtin_converters.o...
...skipped <pbin.v2/libs/python/build/gcc-gnu-9/release/link-static/threadapi-pthread/threading-multi>libboost_python3.a(clean) for lack of <pbin.v2/libs/python/build/gcc-gnu-9/release/link-static/threadapi-pthread/threading-multi>converter/builtin_converters.o...
...skipped <pbin.v2/libs/python/build/gcc-gnu-9/release/link-static/threadapi-pthread/threading-multi>libboost_python3.a for lack of <pbin.v2/libs/python/build/gcc-gnu-9/release/link-static/threadapi-pthread/threading-multi>converter/builtin_converters.o...
...skipped <p/usr/local/lib>libboost_python3.a for lack of <pbin.v2/libs/python/build/gcc-gnu-9/release/link-static/threadapi-pthread/threading-multi>libboost_python3.a...
...failed updating 2 targets...
...skipped 9 targets...

我相信该问题与计算机无法找到其中的某些路径有关pbin.v2,但我不知道那是什么/在哪里。

答案1

我也遇到过同样的情况。

对我有用的是

sudo cp -r /usr/local/include/python3.6m/ /usr/local/include/python3.6/

我不确定您有哪种 Python 配置,但解决方案是复制(或创建软链接),如上面的命令所示。问题是 Boost 在 python 文件夹中查找不存在的 m 的 pyconfig.h。

相关内容