Giter Site home page Giter Site logo

boost-python-examples's People

Contributors

achimh3011 avatar fossabot avatar joshuroar avatar jschueller avatar reissgrvs avatar rick68 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

boost-python-examples's Issues

build on Ubuntu 16.04 with build.sh

The 'build.sh' script fails on building the embedding example.
Cmake output tells me:
-- Could NOT find Boost: missing: python-py3 (found /usr/local/lib/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0"))

A solution was removing '-DPYTHON_VERSION_SUFFIX=-py3' in line 10 of 'build.sh'.
After that the build of all the examples was successful, also the tests.

Environment:

  • OS: Ubuntu Linux
  • Version 16.04
  • Python Version 3.5
  • Boost Version 1.71
  • gcc (Ubuntu 5.5.0-12ubuntu1~16.04) 5.5.0 20171010

I couldn't build project

Hi, I'm new to Boost.Python and I got some errors on a build.

Environment:

  • Python 3.6 in conda environment
  • Linux Ubuntu 16.04

I tried cmake as following

(py36boost_python_example) young@young-desktop:~/Downloads/boost-python-examples-master/build$ cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /home/young/anaconda3/envs/py36boost_python_example/bin/python (found version "3.6.8") 
CMake Warning at /usr/share/cmake-3.5/Modules/FindBoost.cmake:725 (message):
  Imported targets not available for Boost version 106900
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindBoost.cmake:763 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.5/Modules/FindBoost.cmake:1332 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:8 (FIND_PACKAGE)


-- Boost version: 1.69.0
-- Found the following Boost libraries:
--   python
-- Found PythonInterp: /home/young/anaconda3/envs/py36boost_python_example/bin/python (found suitable version "3.6.8", minimum required is "3") 
-- Found PythonLibs: /home/young/anaconda3/envs/py36boost_python_example/lib/libpython3.6m.so (found suitable version "3.6.8", minimum required is "3") 
-- PYTHON_LIBRARIES = /home/young/anaconda3/envs/py36boost_python_example/lib/libpython3.6m.so
-- PYTHON_EXECUTABLE = /home/young/anaconda3/envs/py36boost_python_example/bin/python
-- PYTHON_INCLUDE_DIRS = /home/young/anaconda3/envs/py36boost_python_example/include/python3.6m
-- Boost_LIBRARIES = /usr/lib/x86_64-linux-gnu/libboost_python.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/young/Downloads/boost-python-examples-master/build

And I tried make but I ran into errors at compiling a project of 10-Embedding

(py36boost_python_example) young@young-desktop:~/Downloads/boost-python-examples-master/build$ make
Scanning dependencies of target hello
[  3%] Building CXX object 01-HelloWorld/CMakeFiles/hello.dir/hello.cpp.o
[  6%] Linking CXX shared module hello.so
[  6%] Built target hello
Scanning dependencies of target classes
[ 10%] Building CXX object 02-ExposingClasses/CMakeFiles/classes.dir/classes.cpp.o
[ 13%] Linking CXX shared module classes.so
[ 13%] Built target classes
Scanning dependencies of target ctor
[ 16%] Building CXX object 03-Constructors/CMakeFiles/ctor.dir/ctor.cpp.o
[ 20%] Linking CXX shared module ctor.so
[ 20%] Built target ctor
Scanning dependencies of target member
[ 23%] Building CXX object 04-ClassMembers/CMakeFiles/member.dir/member.cpp.o
[ 26%] Linking CXX shared module member.so
[ 26%] Built target member
Scanning dependencies of target inheritance
[ 30%] Building CXX object 05-Inheritance/CMakeFiles/inheritance.dir/inheritance.cpp.o
[ 33%] Linking CXX shared module inheritance.so
[ 33%] Built target inheritance
Scanning dependencies of target virtual
[ 36%] Building CXX object 06-VirtualFunctionsInPython/CMakeFiles/virtual.dir/virtual.cpp.o
[ 40%] Linking CXX shared module virtual.so
[ 40%] Built target virtual
Scanning dependencies of target operators
[ 43%] Building CXX object 07-Operators/CMakeFiles/operators.dir/operators.cpp.o
[ 46%] Linking CXX shared module operators.so
[ 46%] Built target operators
Scanning dependencies of target policies
[ 50%] Building CXX object 08-CallPolicies/CMakeFiles/policies.dir/policies.cpp.o
[ 53%] Linking CXX shared module policies.so
[ 53%] Built target policies
Scanning dependencies of target overload
[ 56%] Building CXX object 09-Overloading/CMakeFiles/overload.dir/overload.cpp.o
[ 60%] Linking CXX shared module overload.so
[ 60%] Built target overload
Scanning dependencies of target mymodule
[ 63%] Building CXX object 10-Embedding/CMakeFiles/mymodule.dir/mymodule.cpp.o
[ 66%] Linking CXX shared module mymodule.so
[ 66%] Built target mymodule
Scanning dependencies of target embedding
[ 70%] Building CXX object 10-Embedding/CMakeFiles/embedding.dir/mymodule.cpp.o
[ 73%] Building CXX object 10-Embedding/CMakeFiles/embedding.dir/embedding.cpp.o
[ 76%] Linking CXX executable embedding
CMakeFiles/embedding.dir/mymodule.cpp.o: In function `PyInit_mymodule':
mymodule.cpp:(.text+0x7e): undefined reference to `boost::python::detail::init_module(PyModuleDef&, void (*)())'
CMakeFiles/embedding.dir/embedding.cpp.o: In function `main':
embedding.cpp:(.text+0x210): undefined reference to `boost::python::exec_file(char const*, boost::python::api::object, boost::python::api::object)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_Size'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyUnicodeUCS4_FromEncodedObject'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyFile_FromString'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_Type'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyInt_Type'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_FromString'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyUnicodeUCS4_AsWideChar'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_FromStringAndSize'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `Py_InitModule4_64'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_FromFormat'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyNumber_Divide'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyNumber_InPlaceDivide'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyInt_AsLong'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_InternFromString'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyClass_Type'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_AsString'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyInt_FromLong'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyFile_AsFile'
collect2: error: ld returned 1 exit status
10-Embedding/CMakeFiles/embedding.dir/build.make:124: recipe for target '10-Embedding/embedding' failed
make[2]: *** [10-Embedding/embedding] Error 1
CMakeFiles/Makefile2:619: recipe for target '10-Embedding/CMakeFiles/embedding.dir/all' failed
make[1]: *** [10-Embedding/CMakeFiles/embedding.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2

I tried to build Boost Python with Python3 option like this

- Download the lastest version of Boost from http://www.boost.org/
- Execute bootstrap.sh
./bootstrap.sh --with-python=python3.6
- Compile Boost in directory :
./b2
- Install Boost headers
sudo ./b2 install

I've built Boost.Python in this directory

/home/young/Downloads/boost_1_69_0  
After build, instruction says  
add library path with  
/home/young/Downloads/boost_1_69_0/stage/lib  
add compiler include path with  
/home/young/Downloads/boost_1_69_0  

But after I try cmake I get different desired paths

young@young-desktop:~/Downloads/boost-python-examples-master/build$ cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /home/young/anaconda3/bin/python (found version "3.7.1") 
CMake Warning at /usr/share/cmake-3.5/Modules/FindBoost.cmake:725 (message):
  Imported targets not available for Boost version 106900
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindBoost.cmake:763 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.5/Modules/FindBoost.cmake:1332 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:8 (FIND_PACKAGE)


-- Boost version: 1.69.0
-- Found the following Boost libraries:
--   python
-- Found PythonInterp: /home/young/anaconda3/bin/python (found suitable version "3.7.1", minimum required is "3") 
-- Found PythonLibs: /home/young/anaconda3/lib/libpython3.7m.so (found suitable version "3.7.1", minimum required is "3") 
-- PYTHON_LIBRARIES = /home/young/anaconda3/lib/libpython3.7m.so
-- PYTHON_EXECUTABLE = /home/young/anaconda3/bin/python
-- PYTHON_INCLUDE_DIRS = /home/young/anaconda3/include/python3.7m
-- Boost_LIBRARIES = /usr/lib/x86_64-linux-gnu/libboost_python.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/young/Downloads/boost-python-examples-master/build

I'm using conda environment which resides in

/home/young/anaconda3/envs/py36boost_python_example/bin  

I'm new to this, please guide me how to configure variables for build and proper linking.

__Py_tracemalloc_config

I am trying to use boost-python3 and get the following error while running tests. I got exactly the same one when trying to test my own library using boost-python3
I suspect that is is due to boost-python3 built with python 3.8.2 using homebrew, while the standard brew python3 version is 3.7.7

Traceback (most recent call last):
File "hello.py", line 3, in
import hello
ImportError: dlopen(/scratch/source/boost-python-examples-master/build/01-HelloWorld/hello.so, 2): Symbol not found: __Py_tracemalloc_config
Referenced from: /usr/local/opt/boost-python3/lib/libboost_python38.dylib
Expected in: flat namespace
in /usr/local/opt/boost-python3/lib/libboost_python38.dylib

Test time = 0.03 sec

PYTHON_VERSION_SUFFIX issue

i think it must be
PYTHON_VERSION_SUFFIX=3
instead of
PYTHON_VERSION_SUFFIX=-py3
-py3 working, but Boost returns /usr/lib/libboost_python.so that usually links to /usr/lib/libboost_python2.so.

Build instructions for inclusion in existing project

Hi Achim,

This is a great tutorial, thank you so much for it. I'm currently in the process of rewriting a small portion of my (large) Python codebase in C++, and am wondering how to best configure CMake for that. I've noticed that you copy all your python scripts into the build directory, which for my use case is probably a bit inconvenient - my project is mainly Python, and only one foo/bar.py should be replaced by Boost.Python C++ code (so far). Therefore, I'd prefer to do an in-place build.

Do you have any experience with, or best-practice recommendations for this?

Thanks,
Thomas

the executable file doesn't return something

Hi ,
it's my first time trying boost python , and I have successfully built the hello world cmake file but when I run the output file it doesn't show anything whereas it suppose to print a greeting I suppose.

Test Error on tests 10 and 13 building under Ubuntu 16.04.2

I get the following error when building under Ubuntu 16.04.2

      Start 10: 10-Embedding
*** Error in `/home/kkiningh/Workspace/tbteset/boost-python/boost-python-examples/build/10-Embedding/embedding': double free or corruption (!prev): 0x000000000240eb60 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f1207e277e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x7fe0a)[0x7f1207e2fe0a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f1207e3398c]
/lib/x86_64-linux-gnu/libc.so.6(fclose+0x103)[0x7f1207e1d363]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x1579ad)[0x7f12088689ad]
/usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0(_ZN5boost6python9exec_fileENS0_3strENS0_3api6objectES3_+0xe8)[0x7f1208cd57e8]
/home/kkiningh/Workspace/tbteset/boost-python/boost-python-examples/build/10-Embedding/embedding(main+0x22a)[0x41795f]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f1207dd0830]
/home/kkiningh/Workspace/tbteset/boost-python/boost-python-examples/build/10-Embedding/embedding(_start+0x29)[0x412ca9]
======= Memory map: ========
00400000-0041d000 r-xp 00000000 fc:00 97015995                           /home/kkiningh/Workspace/tbteset/boost-python/boost-python-examples/build/10-Embedding/embedding
0061c000-0061d000 r--p 0001c000 fc:00 97015995                           /home/kkiningh/Workspace/tbteset/boost-python/boost-python-examples/build/10-Embedding/embedding
0061d000-0061e000 rw-p 0001d000 fc:00 97015995                           /home/kkiningh/Workspace/tbteset/boost-python/boost-python-examples/build/10-Embedding/embedding
02354000-0242b000 rw-p 00000000 00:00 0                                  [heap]
7f1200000000-7f1200021000 rw-p 00000000 00:00 0
7f1200021000-7f1204000000 ---p 00000000 00:00 0
7f1206f91000-7f1207269000 r--p 00000000 fc:00 78382848                   /usr/lib/locale/locale-archive
7f1207269000-7f1207371000 r-xp 00000000 fc:00 102498640                  /lib/x86_64-linux-gnu/libm-2.23.so
7f1207371000-7f1207570000 ---p 00108000 fc:00 102498640                  /lib/x86_64-linux-gnu/libm-2.23.so
7f1207570000-7f1207571000 r--p 00107000 fc:00 102498640                  /lib/x86_64-linux-gnu/libm-2.23.so
7f1207571000-7f1207572000 rw-p 00108000 fc:00 102498640                  /lib/x86_64-linux-gnu/libm-2.23.so
7f1207572000-7f1207574000 r-xp 00000000 fc:00 102500135                  /lib/x86_64-linux-gnu/libutil-2.23.so
7f1207574000-7f1207773000 ---p 00002000 fc:00 102500135                  /lib/x86_64-linux-gnu/libutil-2.23.so
7f1207773000-7f1207774000 r--p 00001000 fc:00 102500135                  /lib/x86_64-linux-gnu/libutil-2.23.so
7f1207774000-7f1207775000 rw-p 00002000 fc:00 102500135                  /lib/x86_64-linux-gnu/libutil-2.23.so
7f1207775000-7f1207778000 r-xp 00000000 fc:00 102498635                  /lib/x86_64-linux-gnu/libdl-2.23.so
7f1207778000-7f1207977000 ---p 00003000 fc:00 102498635                  /lib/x86_64-linux-gnu/libdl-2.23.so
7f1207977000-7f1207978000 r--p 00002000 fc:00 102498635                  /lib/x86_64-linux-gnu/libdl-2.23.so
7f1207978000-7f1207979000 rw-p 00003000 fc:00 102498635                  /lib/x86_64-linux-gnu/libdl-2.23.so
7f1207979000-7f1207992000 r-xp 00000000 fc:00 102502878                  /lib/x86_64-linux-gnu/libz.so.1.2.8
7f1207992000-7f1207b91000 ---p 00019000 fc:00 102502878                  /lib/x86_64-linux-gnu/libz.so.1.2.8
7f1207b91000-7f1207b92000 r--p 00018000 fc:00 102502878                  /lib/x86_64-linux-gnu/libz.so.1.2.8
7f1207b92000-7f1207b93000 rw-p 00019000 fc:00 102502878                  /lib/x86_64-linux-gnu/libz.so.1.2.8
7f1207b93000-7f1207bab000 r-xp 00000000 fc:00 102500129                  /lib/x86_64-linux-gnu/libpthread-2.23.so
7f1207bab000-7f1207daa000 ---p 00018000 fc:00 102500129                  /lib/x86_64-linux-gnu/libpthread-2.23.so
7f1207daa000-7f1207dab000 r--p 00017000 fc:00 102500129                  /lib/x86_64-linux-gnu/libpthread-2.23.so
7f1207dab000-7f1207dac000 rw-p 00018000 fc:00 102500129                  /lib/x86_64-linux-gnu/libpthread-2.23.so
7f1207dac000-7f1207db0000 rw-p 00000000 00:00 0
7f1207db0000-7f1207f6f000 r-xp 00000000 fc:00 102498645                  /lib/x86_64-linux-gnu/libc-2.23.so
7f1207f6f000-7f120816f000 ---p 001bf000 fc:00 102498645                  /lib/x86_64-linux-gnu/libc-2.23.so
7f120816f000-7f1208173000 r--p 001bf000 fc:00 102498645                  /lib/x86_64-linux-gnu/libc-2.23.so
7f1208173000-7f1208175000 rw-p 001c3000 fc:00 102498645                  /lib/x86_64-linux-gnu/libc-2.23.so
7f1208175000-7f1208179000 rw-p 00000000 00:00 0
7f1208179000-7f120818f000 r-xp 00000000 fc:00 102502725                  /lib/x86_64-linux-gnu/libgcc_s.so.1
7f120818f000-7f120838e000 ---p 00016000 fc:00 102502725                  /lib/x86_64-linux-gnu/libgcc_s.so.1
7f120838e000-7f120838f000 rw-p 00015000 fc:00 102502725                  /lib/x86_64-linux-gnu/libgcc_s.so.1
7f120838f000-7f1208501000 r-xp 00000000 fc:00 78383108                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f1208501000-7f1208701000 ---p 00172000 fc:00 78383108                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f1208701000-7f120870b000 r--p 00172000 fc:00 78383108                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f120870b000-7f120870d000 rw-p 0017c000 fc:00 78383108                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f120870d000-7f1208711000 rw-p 00000000 00:00 0
7f1208711000-7f1208a03000 r-xp 00000000 fc:00 78381336                   /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
7f1208a03000-7f1208c03000 ---p 002f2000 fc:00 78381336                   /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
7f1208c03000-7f1208c05000 r--p 002f2000 fc:00 78381336                   /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
7f1208c05000-7f1208c7c000 rw-p 002f4000 fc:00 78381336                   /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
7f1208c7c000-7f1208c9f000 rw-p 00000000 00:00 0
7f1208c9f000-7f1208ce8000 r-xp 00000000 fc:00 78384637                   /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0
7f1208ce8000-7f1208ee8000 ---p 00049000 fc:00 78384637                   /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0
7f1208ee8000-7f1208ee9000 r--p 00049000 fc:00 78384637                   /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0
7f1208ee9000-7f1208eeb000 rw-p 0004a000 fc:00 78384637                   /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0
7f1208eeb000-7f1208f11000 r-xp 00000000 fc:00 102498646                  /lib/x86_64-linux-gnu/ld-2.23.so
7f1208f73000-7f12090ee000 rw-p 00000000 00:00 0
7f120910d000-7f1209110000 rw-p 00000000 00:00 0
7f1209110000-7f1209111000 r--p 00025000 fc:00 102498646                  /lib/x86_64-linux-gnu/ld-2.23.so
7f1209111000-7f1209112000 rw-p 00026000 fc:00 102498646                  /lib/x86_64-linux-gnu/ld-2.23.so
7f1209112000-7f1209113000 rw-p 00000000 00:00 0
7ffcc5687000-7ffcc56a8000 rw-p 00000000 00:00 0                          [stack]
7ffcc5752000-7ffcc5754000 r--p 00000000 00:00 0                          [vvar]
7ffcc5754000-7ffcc5756000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
10/13 Test #10: 10-Embedding .....................***Exception: Other  0.21 sec
      Start 11: 11-Iterators
11/13 Test #11: 11-Iterators .....................   Passed    0.02 sec
      Start 12: 12-Exceptions
12/13 Test #12: 12-Exceptions ....................   Passed    0.01 sec
      Start 13: 13-AutoInstantiation
*** Error in `/home/kkiningh/Workspace/tbteset/boost-python/boost-python-examples/build/13-AutoInstantiation/auto_instance': double free or corruption (!prev): 0x0000000002581b60 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f8b153ec7e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x7fe0a)[0x7f8b153f4e0a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f8b153f898c]
/lib/x86_64-linux-gnu/libc.so.6(fclose+0x103)[0x7f8b153e2363]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x1579ad)[0x7f8b15e2d9ad]
/usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0(_ZN5boost6python9exec_fileENS0_3strENS0_3api6objectES3_+0xe8)[0x7f8b1629a7e8]
/home/kkiningh/Workspace/tbteset/boost-python/boost-python-examples/build/13-AutoInstantiation/auto_instance(main+0x22e)[0x41aa25]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f8b15395830]
/home/kkiningh/Workspace/tbteset/boost-python/boost-python-examples/build/13-AutoInstantiation/auto_instance(_start+0x29)[0x4158b9]
======= Memory map: ========
00400000-00421000 r-xp 00000000 fc:00 97135564                           /home/kkiningh/Workspace/tbteset/boost-python/boost-python-examples/build/13-AutoInstantiation/auto_instance
00620000-00621000 r--p 00020000 fc:00 97135564                           /home/kkiningh/Workspace/tbteset/boost-python/boost-python-examples/build/13-AutoInstantiation/auto_instance
00621000-00622000 rw-p 00021000 fc:00 97135564                           /home/kkiningh/Workspace/tbteset/boost-python/boost-python-examples/build/13-AutoInstantiation/auto_instance
024c7000-0259e000 rw-p 00000000 00:00 0                                  [heap]
7f8b10000000-7f8b10021000 rw-p 00000000 00:00 0
7f8b10021000-7f8b14000000 ---p 00000000 00:00 0
7f8b14556000-7f8b1482e000 r--p 00000000 fc:00 78382848                   /usr/lib/locale/locale-archive
7f8b1482e000-7f8b14936000 r-xp 00000000 fc:00 102498640                  /lib/x86_64-linux-gnu/libm-2.23.so
7f8b14936000-7f8b14b35000 ---p 00108000 fc:00 102498640                  /lib/x86_64-linux-gnu/libm-2.23.so
7f8b14b35000-7f8b14b36000 r--p 00107000 fc:00 102498640                  /lib/x86_64-linux-gnu/libm-2.23.so
7f8b14b36000-7f8b14b37000 rw-p 00108000 fc:00 102498640                  /lib/x86_64-linux-gnu/libm-2.23.so
7f8b14b37000-7f8b14b39000 r-xp 00000000 fc:00 102500135                  /lib/x86_64-linux-gnu/libutil-2.23.so
7f8b14b39000-7f8b14d38000 ---p 00002000 fc:00 102500135                  /lib/x86_64-linux-gnu/libutil-2.23.so
7f8b14d38000-7f8b14d39000 r--p 00001000 fc:00 102500135                  /lib/x86_64-linux-gnu/libutil-2.23.so
7f8b14d39000-7f8b14d3a000 rw-p 00002000 fc:00 102500135                  /lib/x86_64-linux-gnu/libutil-2.23.so
7f8b14d3a000-7f8b14d3d000 r-xp 00000000 fc:00 102498635                  /lib/x86_64-linux-gnu/libdl-2.23.so
7f8b14d3d000-7f8b14f3c000 ---p 00003000 fc:00 102498635                  /lib/x86_64-linux-gnu/libdl-2.23.so
7f8b14f3c000-7f8b14f3d000 r--p 00002000 fc:00 102498635                  /lib/x86_64-linux-gnu/libdl-2.23.so
7f8b14f3d000-7f8b14f3e000 rw-p 00003000 fc:00 102498635                  /lib/x86_64-linux-gnu/libdl-2.23.so
7f8b14f3e000-7f8b14f57000 r-xp 00000000 fc:00 102502878                  /lib/x86_64-linux-gnu/libz.so.1.2.8
7f8b14f57000-7f8b15156000 ---p 00019000 fc:00 102502878                  /lib/x86_64-linux-gnu/libz.so.1.2.8
7f8b15156000-7f8b15157000 r--p 00018000 fc:00 102502878                  /lib/x86_64-linux-gnu/libz.so.1.2.8
7f8b15157000-7f8b15158000 rw-p 00019000 fc:00 102502878                  /lib/x86_64-linux-gnu/libz.so.1.2.8
7f8b15158000-7f8b15170000 r-xp 00000000 fc:00 102500129                  /lib/x86_64-linux-gnu/libpthread-2.23.so
7f8b15170000-7f8b1536f000 ---p 00018000 fc:00 102500129                  /lib/x86_64-linux-gnu/libpthread-2.23.so
7f8b1536f000-7f8b15370000 r--p 00017000 fc:00 102500129                  /lib/x86_64-linux-gnu/libpthread-2.23.so
7f8b15370000-7f8b15371000 rw-p 00018000 fc:00 102500129                  /lib/x86_64-linux-gnu/libpthread-2.23.so
7f8b15371000-7f8b15375000 rw-p 00000000 00:00 0
7f8b15375000-7f8b15534000 r-xp 00000000 fc:00 102498645                  /lib/x86_64-linux-gnu/libc-2.23.so
7f8b15534000-7f8b15734000 ---p 001bf000 fc:00 102498645                  /lib/x86_64-linux-gnu/libc-2.23.so
7f8b15734000-7f8b15738000 r--p 001bf000 fc:00 102498645                  /lib/x86_64-linux-gnu/libc-2.23.so
7f8b15738000-7f8b1573a000 rw-p 001c3000 fc:00 102498645                  /lib/x86_64-linux-gnu/libc-2.23.so
7f8b1573a000-7f8b1573e000 rw-p 00000000 00:00 0
7f8b1573e000-7f8b15754000 r-xp 00000000 fc:00 102502725                  /lib/x86_64-linux-gnu/libgcc_s.so.1
7f8b15754000-7f8b15953000 ---p 00016000 fc:00 102502725                  /lib/x86_64-linux-gnu/libgcc_s.so.1
7f8b15953000-7f8b15954000 rw-p 00015000 fc:00 102502725                  /lib/x86_64-linux-gnu/libgcc_s.so.1
7f8b15954000-7f8b15ac6000 r-xp 00000000 fc:00 78383108                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f8b15ac6000-7f8b15cc6000 ---p 00172000 fc:00 78383108                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f8b15cc6000-7f8b15cd0000 r--p 00172000 fc:00 78383108                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f8b15cd0000-7f8b15cd2000 rw-p 0017c000 fc:00 78383108                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f8b15cd2000-7f8b15cd6000 rw-p 00000000 00:00 0
7f8b15cd6000-7f8b15fc8000 r-xp 00000000 fc:00 78381336                   /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
7f8b15fc8000-7f8b161c8000 ---p 002f2000 fc:00 78381336                   /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
7f8b161c8000-7f8b161ca000 r--p 002f2000 fc:00 78381336                   /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
7f8b161ca000-7f8b16241000 rw-p 002f4000 fc:00 78381336                   /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
7f8b16241000-7f8b16264000 rw-p 00000000 00:00 0
7f8b16264000-7f8b162ad000 r-xp 00000000 fc:00 78384637                   /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0
7f8b162ad000-7f8b164ad000 ---p 00049000 fc:00 78384637                   /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0
7f8b164ad000-7f8b164ae000 r--p 00049000 fc:00 78384637                   /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0
7f8b164ae000-7f8b164b0000 rw-p 0004a000 fc:00 78384637                   /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0
7f8b164b0000-7f8b164d6000 r-xp 00000000 fc:00 102498646                  /lib/x86_64-linux-gnu/ld-2.23.so
7f8b16538000-7f8b166b3000 rw-p 00000000 00:00 0
7f8b166d2000-7f8b166d5000 rw-p 00000000 00:00 0
7f8b166d5000-7f8b166d6000 r--p 00025000 fc:00 102498646                  /lib/x86_64-linux-gnu/ld-2.23.so
7f8b166d6000-7f8b166d7000 rw-p 00026000 fc:00 102498646                  /lib/x86_64-linux-gnu/ld-2.23.so
7f8b166d7000-7f8b166d8000 rw-p 00000000 00:00 0
7ffebc457000-7ffebc478000 rw-p 00000000 00:00 0                          [stack]
7ffebc4fe000-7ffebc500000 r--p 00000000 00:00 0                          [vvar]
7ffebc500000-7ffebc502000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
13/13 Test #13: 13-AutoInstantiation .............***Exception: Other  0.17 sec

85% tests passed, 2 tests failed out of 13

Total Test time (real) =   0.62 sec

The following tests FAILED:
	 10 - 10-Embedding (OTHER_FAULT)
	 13 - 13-AutoInstantiation (OTHER_FAULT)
Errors while running CTest

Error Building on Mac OS X Sierra 10.13.3

grokmachine@spock  ~/dev/boost-python-examples   master  ./build.sh
++ basename ./build.sh
+ cd ./
+ mkdir build
mkdir: build: File exists
+ cd build
+ [[ darwin17 == \l\i\n\u\x\-\g\n\u ]]
+ [[ darwin17 == \l\i\n\u\x ]]
+ [[ darwin17 == \d\a\r\w\i\n* ]]
++ python -c 'import sys;t='\''{v[0]}.{v[1]}'\''.format(v=list(sys.version_info[:2]));sys.stdout.write(t)'
+ PYTHON_VERSION=2.7
+ PYTHON_LIBRARY=/usr/local/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib
+ PYTHON_INCLUDE_DIR=/usr/local/Frameworks/Python.framework/Versions/2.7/Headers/
+ cmake -DPYTHON_LIBRARY=/usr/local/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib -DPYTHON_INCLUDE_DIR=/usr/local/Frameworks/Python.framework/Versions/2.7/Headers/ -DCMAKE_BUILD_TYPE=DEBUG ..
-- Could NOT find Boost
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/grokmachine/dev/boost-python-examples/build
+ make
Scanning dependencies of target hello
[  3%] Building CXX object 01-HelloWorld/CMakeFiles/hello.dir/hello.cpp.o
[  6%] Linking CXX shared module hello.so
Undefined symbols for architecture x86_64:
  "boost::python::detail::init_module(char const*, void (*)())", referenced from:
      _inithello in hello.cpp.o
  "boost::python::detail::gcc_demangle(char const*)", referenced from:
      boost::python::type_info::name() const in hello.cpp.o
  "boost::python::detail::scope_setattr_doc(char const*, boost::python::api::object const&, char const*)", referenced from:
      void boost::python::def<char const* (*)()>(char const*, char const* (*)()) in hello.cpp.o
  "boost::python::objects::function_object(boost::python::objects::py_function const&)", referenced from:
      boost::python::api::object boost::python::detail::make_function_aux<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> >(char const* (*)(), boost::python::default_call_policies const&, boost::mpl::vector1<char const*> const&) in hello.cpp.o
  "boost::python::objects::py_function_impl_base::~py_function_impl_base()", referenced from:
      boost::python::objects::caller_py_function_impl<boost::python::detail::caller<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> > >::~caller_py_function_impl() in hello.cpp.o
  "boost::python::converter::do_return_to_python(char const*)", referenced from:
      boost::python::to_python_value<char const* const&>::operator()(char const* const&) const in hello.cpp.o
  "boost::python::converter::registry::query(boost::python::type_info)", referenced from:
      boost::python::converter::expected_pytype_for_arg<char const*>::get_pytype() in hello.cpp.o
  "boost::python::objects::py_function_impl_base::max_arity() const", referenced from:
      vtable for boost::python::objects::caller_py_function_impl<boost::python::detail::caller<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> > > in hello.cpp.o
  "boost::python::converter::registration::expected_from_python_type() const", referenced from:
      boost::python::converter::expected_pytype_for_arg<char const*>::get_pytype() in hello.cpp.o
  "typeinfo for boost::python::objects::py_function_impl_base", referenced from:
      typeinfo for boost::python::objects::caller_py_function_impl<boost::python::detail::caller<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> > > in hello.cpp.o
  "vtable for boost::python::objects::py_function_impl_base", referenced from:
      boost::python::objects::py_function_impl_base::py_function_impl_base() in hello.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [01-HelloWorld/hello.so] Error 1
make[1]: *** [01-HelloWorld/CMakeFiles/hello.dir/all] Error 2
make: *** [all] Error 2

04-ClassMembers met UnicodeEncodeError

20151203003258

MAC:10.11.1
IDE: Sublime text3
Python: Python 3.5.0 (v3.5.0:374f501f4567, Sep 12 2015, 11:00:19)
GCC:GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

Code: in member.py caused this issue:
m1.name = "Günther"

Python Error code:
name = Pavel
name = Traceback (most recent call last):
File "/Users/kevin/Desktop/pythonc++/build/04-ClassMembers/member.py", line 8, in
print ("name =",m1.name)
UnicodeEncodeError: 'ascii' codec can't encode character '\xfc' in position 1: ordinal not in range(128)

Also, I'm looking for the way to fix this error.

05-inheritance linking error in VS2015

Thanks for the project first.

I can compile and run all other example except for 05-inheritance on VS 2015 with Boost.Python 2.7 x64, which gave me the following linking error:

1>inheritance.obj : error LNK2019: unresolved external symbol "class Base const volatile * __cdecl boost::get_pointer<class Base const volatile >(class Base const volatile *)" (??$get_pointer@$$CDVBase@@@boost@@YAPEDVBase@@PEDV1@@Z) referenced in function "public: static struct _object * __cdecl boost::python::objects::make_instance_impl<class Base,struct boost::python::objects::pointer_holder<class std::auto_ptr<class Base>,class Base>,struct boost::python::objects::make_ptr_instance<class Base,struct boost::python::objects::pointer_holder<class std::auto_ptr<class Base>,class Base> > >::execute<class std::auto_ptr<class Base> >(class std::auto_ptr<class Base> &)" (??$execute@V?$auto_ptr@VBase@@@std@@@?$make_instance_impl@VBase@@U?$pointer_holder@V?$auto_ptr@VBase@@@std@@VBase@@@objects@python@boost@@U?$make_ptr_instance@VBase@@U?$pointer_holder@V?$auto_ptr@VBase@@@std@@VBase@@@objects@python@boost@@@345@@objects@python@boost@@SAPEAU_object@@AEAV?$auto_ptr@VBase@@@std@@@Z)

Based on this discussion, I was able to fix the problem by adding the following code to inheritance.cpp. Not sure whether this should be counted as a bug of this project, but I guess it might help others if they also found this issue.

namespace boost
{
	template <>
	Base const volatile * get_pointer<class Base const volatile >(
		class Base const volatile *c)
	{
		return c;
	}
}

`Could NOT find Boost: missing: python37`

I'm having trouble getting these to build with homebrew python3 on mojave. I have installed boost and boost-python3 and made the following changes to build.sh to tell it to use python3:

 if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]]; then
     cmake -DPYTHON_VERSION_SUFFIX=-py3 -DCMAKE_BUILD_TYPE=DEBUG .. && make && make test
 elif [[ "$OSTYPE" == "darwin"* ]]; then
-    PYTHON_VERSION=`python -c "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)";`
+    PYTHON_VERSION=`python3 -c "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)";`
     PYTHON_LIBRARY=/usr/local/Frameworks/Python.framework/Versions/$PYTHON_VERSION/lib/libpython$PYTHON_VERSION.dylib
     PYTHON_INCLUDE_DIR=/usr/local/Frameworks/Python.framework/Versions/$PYTHON_VERSION/Headers/
-    cmake -DPYTHON_LIBRARY=$PYTHON_LIBRARY -DPYTHON_INCLUDE_DIR=$PYTHON_INCLUDE_DIR -DCMAKE_BUILD_TYPE=DEBUG .. && make && make test
+    cmake -DPYTHON_EXECUTABLE=/usr/local/bin/python3 -DPYTHON_LIBRARY=$PYTHON_LIBRARY -DPYTHON_INCLUDE_DIR=$PYTHON_INCLUDE_DIR -DCMAKE_BUILD_TYPE=DEBUG .. && make && make test
 elif [[ "$OSTYPE" == "cygwin" ]]; then
     : # POSIX compatibility layer and Linux environment emulation for Windows
 elif [[ "$OSTYPE" == "msys" ]]; then

When I execute it I get the following:

++ basename ./build.sh
+ cd ./
+ mkdir build
mkdir: build: File exists
+ cd build
+ [[ darwin18 == \l\i\n\u\x\-\g\n\u ]]
+ [[ darwin18 == \l\i\n\u\x ]]
+ [[ darwin18 == \d\a\r\w\i\n* ]]
++ python3 -c 'import sys;t='\''{v[0]}.{v[1]}'\''.format(v=list(sys.version_info[:2]));sys.stdout.write(t)'
+ PYTHON_VERSION=3.7
+ PYTHON_LIBRARY=/usr/local/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib
+ PYTHON_INCLUDE_DIR=/usr/local/Frameworks/Python.framework/Versions/3.7/Headers/
+ cmake -DPYTHON_EXECUTABLE=/usr/local/bin/python3 -DPYTHON_LIBRARY=/usr/local/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib -DPYTHON_INCLUDE_DIR=/usr/local/Frameworks/Python.framework/Versions/3.7/Headers/ -DCMAKE_BUILD_TYPE=DEBUG ..
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /usr/local/bin/python3 (found version "3.7.4")
-- Could NOT find Boost: missing: python37 (found /usr/local/lib/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0"))
-- Found PythonInterp: /usr/local/bin/python3 (found suitable version "3.7.4", minimum required is "3")
-- Found PythonLibs: /usr/local/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib (found suitable version "3.7.4", minimum required is "3")
-- PYTHON_LIBRARIES = /usr/local/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib
-- PYTHON_EXECUTABLE = /usr/local/bin/python3
-- PYTHON_INCLUDE_DIRS = /usr/local/Frameworks/Python.framework/Versions/3.7/Headers
-- Boost_LIBRARIES =
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/keldavis/projects/boost-python-examples/build
+ make
[  3%] Linking CXX shared module hello.so
Undefined symbols for architecture x86_64:
  "boost::python::detail::init_module(PyModuleDef&, void (*)())", referenced from:
      _PyInit_hello in hello.cpp.o
  "boost::python::detail::gcc_demangle(char const*)", referenced from:
      boost::python::type_info::name() const in hello.cpp.o
  "boost::python::detail::scope_setattr_doc(char const*, boost::python::api::object const&, char const*)", referenced from:
      void boost::python::def<char const* (*)()>(char const*, char const* (*)()) in hello.cpp.o
  "boost::python::objects::function_object(boost::python::objects::py_function const&)", referenced from:
      boost::python::api::object boost::python::detail::make_function_aux<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> >(char const* (*)(), boost::python::default_call_policies const&, boost::mpl::vector1<char const*> const&) in hello.cpp.o
  "boost::python::objects::py_function_impl_base::~py_function_impl_base()", referenced from:
      boost::python::objects::caller_py_function_impl<boost::python::detail::caller<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> > >::~caller_py_function_impl() in hello.cpp.o
  "boost::python::converter::do_return_to_python(char const*)", referenced from:
      boost::python::to_python_value<char const* const&>::operator()(char const* const&) const in hello.cpp.o
  "boost::python::converter::registry::query(boost::python::type_info)", referenced from:
      boost::python::converter::expected_pytype_for_arg<char const*>::get_pytype() in hello.cpp.o
  "boost::python::objects::py_function_impl_base::max_arity() const", referenced from:
      vtable for boost::python::objects::caller_py_function_impl<boost::python::detail::caller<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> > > in hello.cpp.o
  "boost::python::converter::registration::expected_from_python_type() const", referenced from:
      boost::python::converter::expected_pytype_for_arg<char const*>::get_pytype() in hello.cpp.o
  "typeinfo for boost::python::objects::py_function_impl_base", referenced from:
      typeinfo for boost::python::objects::caller_py_function_impl<boost::python::detail::caller<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> > > in hello.cpp.o
  "vtable for boost::python::objects::py_function_impl_base", referenced from:
      boost::python::objects::py_function_impl_base::py_function_impl_base() in hello.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [01-HelloWorld/hello.so] Error 1
make[1]: *** [01-HelloWorld/CMakeFiles/hello.dir/all] Error 2
make: *** [all] Error 2

Trying to understand how to resolve: Could NOT find Boost: missing: python37 (found /usr/local/lib/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0"))

Python argument did not much C++ signature

RH6 + gcc (versions 6 - 8.2 tried)

-- The C compiler identification is GNU 6.1.0                   
-- The CXX compiler identification is GNU 6.1.0                 
-- Check for working C compiler: /dls_sw/apps/gcc/6.1.0/bin/gcc 
-- Check for working C compiler: /dls_sw/apps/gcc/6.1.0/bin/gcc -- works
-- Detecting C compiler ABI info                                        
-- Detecting C compiler ABI info - done                                 
-- Detecting C compile features                                         
-- Detecting C compile features - done                                  
-- Check for working CXX compiler: /dls_sw/apps/gcc/6.1.0/bin/g++       
-- Check for working CXX compiler: /dls_sw/apps/gcc/6.1.0/bin/g++ -- works
-- Detecting CXX compiler ABI info                                        
-- Detecting CXX compiler ABI info - done                                 
-- Detecting CXX compile features                                         
-- Detecting CXX compile features - done                                  
-- Found PythonInterp: /scratch/anaconda2/bin/python (found version "2.7.15") 
-- Boost version: 1.41.0

The project builds, some tests fail:

Test project /home/kjy41806/Documents/SOFT/OTHER/boost-python-examples/build                        
      Start  1: 01-HelloWorld                                                                       
 1/13 Test  #1: 01-HelloWorld ....................   Passed    0.04 sec                             
      Start  2: 02-ExposingClasses                                                                  
 2/13 Test  #2: 02-ExposingClasses ...............***Failed    0.07 sec                             
      Start  3: 03-Constructors                                                                     
 3/13 Test  #3: 03-Constructors ..................***Failed    0.04 sec                             
      Start  4: 04-ClassMembers                                                                     
 4/13 Test  #4: 04-ClassMembers ..................***Failed    0.06 sec                             
      Start  5: 05-Inheritance                                                                      
 5/13 Test  #5: 05-Inheritance ...................   Passed    0.03 sec                             
      Start  6: 06-VirtualFunctionsInPython                                                         
 6/13 Test  #6: 06-VirtualFunctionsInPython ......***Failed    0.03 sec                             
      Start  7: 07-Operators                                                                        
 7/13 Test  #7: 07-Operators .....................   Passed    0.03 sec                             
      Start  8: 08-CallPolicies                                                                     
 8/13 Test  #8: 08-CallPolicies ..................   Passed    0.08 sec                             
      Start  9: 09-Overloading                                                                      
 9/13 Test  #9: 09-Overloading ...................***Failed    0.04 sec                             
      Start 10: 10-Embedding                                                                        
10/13 Test #10: 10-Embedding .....................   Passed    0.07 sec                             
      Start 11: 11-Iterators                                                                        
11/13 Test #11: 11-Iterators .....................***Failed    0.03 sec                             
      Start 12: 12-Exceptions                                                                       
12/13 Test #12: 12-Exceptions ....................   Passed    0.03 sec                             
      Start 13: 13-AutoInstantiation                                                                
13/13 Test #13: 13-AutoInstantiation .............***Failed    0.02 se

Then when running python the error itself:

Traceback (most recent call last):
  File "classes.py", line 6, in <module>
    t.set("bom dia!")
Boost.Python.ArgumentError: Python argument types in
    World.set(World, str)
did not match C++ signature:
    set(World {lvalue}, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)

What could be the problem? The interesting is that the build pass 100% with gcc 4.4, but I need to use older versions and it fails for 6,7,8 (which I tried).

The necessity of exporting base virtual function in 06-VirtualFunctionsInPython

In

.def("name", &Base::name, &BaseWrap::default_name)

I knew the boost python doc said

Take note that we expose both &Base::f and &BaseWrap::default_f. Boost.Python needs to keep track of 1) the dispatch function f and 2) the forwarding function to its default implementation default_f. There's a special def function for this purpose.

But is it truely necessary to export &Base::name? And I can't see the differences blow in running results:

.def("name", &Base::name, &BaseWrap::default_name)
.def("name", &BaseWrap::default_name)

Can get it to run on ubuntu 21.10

Describe the bug

cd build/01-HelloWorld
./hello.py

produces:

ImportError: /home/malte/Projects/boost-python-examples/build/01-HelloWorld/hello.so: undefined symbol: _ZNK5boost6python7objects21py_function_impl_base9max_arityEv

ldd on hello.so gives:

	linux-vdso.so.1 (0x00007ffe9d1a3000)
	libpython3.9.so.1.0 => /lib/x86_64-linux-gnu/libpython3.9.so.1.0 (0x00007f63e23f0000)
	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f63e21d7000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f63e21bd000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f63e1f95000)
	libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f63e1f64000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f63e1f48000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f63e1e62000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f63e29ac000)

So i guess something is missing but what and where to search for.

Error message(s)

Environment:

  • Ubuntu 22.10

  • Installed boost python with sudo apt install libboost-all-dev

  • Python Version 3.9 (the default from OS)

  • Boost Version (installed via libboost-all-dev, 1.74)

  • Compiler Version (gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0 default)

Log of compilation

malte@utop ~/P/boost-python-examples (main)> ./build.sh
++ basename ./build.sh
+ cd ./
+ mkdir build
mkdir: cannot create directory ‘build’: File exists
+ cd build
+ [[ linux-gnu == \l\i\n\u\x\-\g\n\u ]]
+ cmake -DPYTHON_VERSION_SUFFIX=-py3 -DCMAKE_BUILD_TYPE=DEBUG ..
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PythonInterp: /usr/bin/python (found version "3.9.7") 
-- Could NOT find Boost: missing: python-py3 (found /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found version "1.74.0"))
-- Found PythonInterp: /usr/bin/python (found suitable version "3.9.7", minimum required is "3") 
-- PYTHON_LIBRARIES = /usr/lib/x86_64-linux-gnu/libpython3.9.so
-- PYTHON_EXECUTABLE = /usr/bin/python
-- PYTHON_INCLUDE_DIRS = /usr/include/python3.9
-- Boost_LIBRARIES = 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/malte/Projects/boost-python-examples/build
+ make
Scanning dependencies of target hello
[  3%] Building CXX object 01-HelloWorld/CMakeFiles/hello.dir/hello.cpp.o
In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/boost/python/converter/shared_ptr_to_python.hpp:12,
                 from /usr/include/boost/python/converter/arg_to_python.hpp:15,
                 from /usr/include/boost/python/call.hpp:15,
                 from /usr/include/boost/python/object_core.hpp:14,
                 from /usr/include/boost/python/args.hpp:22,
                 from /usr/include/boost/python.hpp:11,
                 from /home/malte/Projects/boost-python-examples/01-HelloWorld/hello.cpp:6:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
/usr/include/boost/detail/iterator.hpp:13:1: note: ‘#pragma message: This header is deprecated. Use <iterator> instead.’
   13 | BOOST_HEADER_DEPRECATED("<iterator>")
      | ^~~~~~~~~~~~~~~~~~~~~~~
[  6%] Linking CXX shared module hello.so
[  6%] Built target hello
Scanning dependencies of target classes
[ 10%] Building CXX object 02-ExposingClasses/CMakeFiles/classes.dir/classes.cpp.o
In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/boost/python/converter/shared_ptr_to_python.hpp:12,
                 from /usr/include/boost/python/converter/arg_to_python.hpp:15,
                 from /usr/include/boost/python/call.hpp:15,
                 from /usr/include/boost/python/object_core.hpp:14,
                 from /usr/include/boost/python/args.hpp:22,
                 from /usr/include/boost/python.hpp:11,
                 from /home/malte/Projects/boost-python-examples/02-ExposingClasses/classes.cpp:2:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
/usr/include/boost/detail/iterator.hpp:13:1: note: ‘#pragma message: This header is deprecated. Use <iterator> instead.’
   13 | BOOST_HEADER_DEPRECATED("<iterator>")
      | ^~~~~~~~~~~~~~~~~~~~~~~
[ 13%] Linking CXX shared module classes.so
[ 13%] Built target classes
Scanning dependencies of target ctor
[ 16%] Building CXX object 03-Constructors/CMakeFiles/ctor.dir/ctor.cpp.o
In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/boost/python/converter/shared_ptr_to_python.hpp:12,
                 from /usr/include/boost/python/converter/arg_to_python.hpp:15,
                 from /usr/include/boost/python/call.hpp:15,
                 from /usr/include/boost/python/object_core.hpp:14,
                 from /usr/include/boost/python/args.hpp:22,
                 from /usr/include/boost/python.hpp:11,
                 from /home/malte/Projects/boost-python-examples/03-Constructors/ctor.cpp:18:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
/usr/include/boost/detail/iterator.hpp:13:1: note: ‘#pragma message: This header is deprecated. Use <iterator> instead.’
   13 | BOOST_HEADER_DEPRECATED("<iterator>")
      | ^~~~~~~~~~~~~~~~~~~~~~~
[ 20%] Linking CXX shared module ctor.so
[ 20%] Built target ctor
Scanning dependencies of target member
[ 23%] Building CXX object 04-ClassMembers/CMakeFiles/member.dir/member.cpp.o
In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/boost/python/converter/shared_ptr_to_python.hpp:12,
                 from /usr/include/boost/python/converter/arg_to_python.hpp:15,
                 from /usr/include/boost/python/call.hpp:15,
                 from /usr/include/boost/python/object_core.hpp:14,
                 from /usr/include/boost/python/args.hpp:22,
                 from /usr/include/boost/python.hpp:11,
                 from /home/malte/Projects/boost-python-examples/04-ClassMembers/member.cpp:24:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
/usr/include/boost/detail/iterator.hpp:13:1: note: ‘#pragma message: This header is deprecated. Use <iterator> instead.’
   13 | BOOST_HEADER_DEPRECATED("<iterator>")
      | ^~~~~~~~~~~~~~~~~~~~~~~
[ 26%] Linking CXX shared module member.so
[ 26%] Built target member
Scanning dependencies of target inheritance
[ 30%] Building CXX object 05-Inheritance/CMakeFiles/inheritance.dir/inheritance.cpp.o
In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/boost/python/converter/shared_ptr_to_python.hpp:12,
                 from /usr/include/boost/python/converter/arg_to_python.hpp:15,
                 from /usr/include/boost/python/call.hpp:15,
                 from /usr/include/boost/python/object_core.hpp:14,
                 from /usr/include/boost/python/args.hpp:22,
                 from /usr/include/boost/python.hpp:11,
                 from /home/malte/Projects/boost-python-examples/05-Inheritance/inheritance.cpp:32:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
/usr/include/boost/detail/iterator.hpp:13:1: note: ‘#pragma message: This header is deprecated. Use <iterator> instead.’
   13 | BOOST_HEADER_DEPRECATED("<iterator>")
      | ^~~~~~~~~~~~~~~~~~~~~~~
[ 33%] Linking CXX shared module inheritance.so
[ 33%] Built target inheritance
Scanning dependencies of target virtual
[ 36%] Building CXX object 06-VirtualFunctionsInPython/CMakeFiles/virtual.dir/virtual.cpp.o
In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/boost/python/converter/shared_ptr_to_python.hpp:12,
                 from /usr/include/boost/python/converter/arg_to_python.hpp:15,
                 from /usr/include/boost/python/call.hpp:15,
                 from /usr/include/boost/python/object_core.hpp:14,
                 from /usr/include/boost/python/args.hpp:22,
                 from /usr/include/boost/python.hpp:11,
                 from /home/malte/Projects/boost-python-examples/06-VirtualFunctionsInPython/virtual.cpp:16:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
/usr/include/boost/detail/iterator.hpp:13:1: note: ‘#pragma message: This header is deprecated. Use <iterator> instead.’
   13 | BOOST_HEADER_DEPRECATED("<iterator>")
      | ^~~~~~~~~~~~~~~~~~~~~~~
[ 40%] Linking CXX shared module virtual.so
[ 40%] Built target virtual
Scanning dependencies of target operators
[ 43%] Building CXX object 07-Operators/CMakeFiles/operators.dir/operators.cpp.o
In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/boost/python/converter/shared_ptr_to_python.hpp:12,
                 from /usr/include/boost/python/converter/arg_to_python.hpp:15,
                 from /usr/include/boost/python/call.hpp:15,
                 from /usr/include/boost/python/object_core.hpp:14,
                 from /usr/include/boost/python/args.hpp:22,
                 from /usr/include/boost/python.hpp:11,
                 from /home/malte/Projects/boost-python-examples/07-Operators/operators.cpp:35:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
/usr/include/boost/detail/iterator.hpp:13:1: note: ‘#pragma message: This header is deprecated. Use <iterator> instead.’
   13 | BOOST_HEADER_DEPRECATED("<iterator>")
      | ^~~~~~~~~~~~~~~~~~~~~~~
[ 46%] Linking CXX shared module operators.so
[ 46%] Built target operators
Scanning dependencies of target policies
[ 50%] Building CXX object 08-CallPolicies/CMakeFiles/policies.dir/policies.cpp.o
In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/boost/python/converter/shared_ptr_to_python.hpp:12,
                 from /usr/include/boost/python/converter/arg_to_python.hpp:15,
                 from /usr/include/boost/python/call.hpp:15,
                 from /usr/include/boost/python/object_core.hpp:14,
                 from /usr/include/boost/python/args.hpp:22,
                 from /usr/include/boost/python.hpp:11,
                 from /home/malte/Projects/boost-python-examples/08-CallPolicies/policies.cpp:20:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
/usr/include/boost/detail/iterator.hpp:13:1: note: ‘#pragma message: This header is deprecated. Use <iterator> instead.’
   13 | BOOST_HEADER_DEPRECATED("<iterator>")
      | ^~~~~~~~~~~~~~~~~~~~~~~
[ 53%] Linking CXX shared module policies.so
[ 53%] Built target policies
Scanning dependencies of target overload
[ 56%] Building CXX object 09-Overloading/CMakeFiles/overload.dir/overload.cpp.o
In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/boost/python/converter/shared_ptr_to_python.hpp:12,
                 from /usr/include/boost/python/converter/arg_to_python.hpp:15,
                 from /usr/include/boost/python/call.hpp:15,
                 from /usr/include/boost/python/object_core.hpp:14,
                 from /usr/include/boost/python/args.hpp:22,
                 from /usr/include/boost/python.hpp:11,
                 from /home/malte/Projects/boost-python-examples/09-Overloading/overload.cpp:33:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
/usr/include/boost/detail/iterator.hpp:13:1: note: ‘#pragma message: This header is deprecated. Use <iterator> instead.’
   13 | BOOST_HEADER_DEPRECATED("<iterator>")
      | ^~~~~~~~~~~~~~~~~~~~~~~
[ 60%] Linking CXX shared module overload.so
[ 60%] Built target overload
Scanning dependencies of target embedding
[ 63%] Building CXX object 10-Embedding/CMakeFiles/embedding.dir/mymodule.cpp.o
In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/boost/python/converter/shared_ptr_to_python.hpp:12,
                 from /usr/include/boost/python/converter/arg_to_python.hpp:15,
                 from /usr/include/boost/python/call.hpp:15,
                 from /usr/include/boost/python/object_core.hpp:14,
                 from /usr/include/boost/python/args.hpp:22,
                 from /usr/include/boost/python.hpp:11,
                 from /home/malte/Projects/boost-python-examples/10-Embedding/mymodule.cpp:1:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
/usr/include/boost/detail/iterator.hpp:13:1: note: ‘#pragma message: This header is deprecated. Use <iterator> instead.’
   13 | BOOST_HEADER_DEPRECATED("<iterator>")
      | ^~~~~~~~~~~~~~~~~~~~~~~
[ 66%] Building CXX object 10-Embedding/CMakeFiles/embedding.dir/embedding.cpp.o
In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/boost/python/converter/shared_ptr_to_python.hpp:12,
                 from /usr/include/boost/python/converter/arg_to_python.hpp:15,
                 from /usr/include/boost/python/call.hpp:15,
                 from /usr/include/boost/python/object_core.hpp:14,
                 from /usr/include/boost/python/args.hpp:22,
                 from /usr/include/boost/python.hpp:11,
                 from /home/malte/Projects/boost-python-examples/10-Embedding/embedding.cpp:1:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
/usr/include/boost/detail/iterator.hpp:13:1: note: ‘#pragma message: This header is deprecated. Use <iterator> instead.’
   13 | BOOST_HEADER_DEPRECATED("<iterator>")
      | ^~~~~~~~~~~~~~~~~~~~~~~
[ 70%] Linking CXX executable embedding
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: warning: relocation against `_ZTVN5boost6python7objects21py_function_impl_baseE' in read-only section `.text._ZN5boost6python7objects21py_function_impl_baseC2Ev[_ZN5boost6python7objects21py_function_impl_baseC5Ev]'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `PyInit_mymodule':
/home/malte/Projects/boost-python-examples/10-Embedding/mymodule.cpp:7: undefined reference to `boost::python::detail::init_module(PyModuleDef&, void (*)())'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::type_info::name() const':
/usr/include/boost/python/type_id.hpp:160: undefined reference to `boost::python::detail::gcc_demangle(char const*)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `_object* boost::python::expect_non_null<_object>(_object*)':
/usr/include/boost/python/errors.hpp:45: undefined reference to `boost::python::throw_error_already_set()'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::class_<Base, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::class_(char const*, char const*)':
/usr/include/boost/python/class.hpp:581: undefined reference to `boost::python::objects::class_base::class_base(char const*, unsigned long, boost::python::type_info const*, char const*)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `void boost::python::class_<Base, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::initialize<boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_> >(boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_> const&)':
/usr/include/boost/python/class.hpp:453: undefined reference to `boost::python::objects::class_base::set_instance_size(unsigned long)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `void boost::python::class_<Base, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::def_impl<Base, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (Base::*)() const, boost::python::detail::def_helper<char const*, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> >(Base*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (Base::*)() const, boost::python::detail::def_helper<char const*, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> const&, ...)':
/usr/include/boost/python/class.hpp:490: undefined reference to `boost::python::objects::add_to_namespace(boost::python::api::object const&, char const*, boost::python::api::object const&, char const*)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::api::object boost::python::detail::make_function_aux<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (Base::*)() const, boost::python::default_call_policies, boost::mpl::vector2<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Base&>, mpl_::int_<0> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (Base::*)() const, boost::python::default_call_policies const&, boost::mpl::vector2<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Base&> const&, std::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&, mpl_::int_<0>)':
/usr/include/boost/python/make_function.hpp:62: undefined reference to `boost::python::objects::function_object(boost::python::objects::py_function const&, std::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `void boost::python::objects::class_metadata<Base, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::maybe_register_class_to_python<Base>(Base*, mpl_::bool_<false>)':
/usr/include/boost/python/object/class_metadata.hpp:273: undefined reference to `boost::python::objects::copy_class_object(boost::python::type_info const&, boost::python::type_info const&)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::objects::py_function_impl_base::py_function_impl_base()':
/usr/include/boost/python/object/py_function.hpp:20: undefined reference to `vtable for boost::python::objects::py_function_impl_base'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::converter::shared_ptr_from_python<Base, boost::shared_ptr>::shared_ptr_from_python()':
/usr/include/boost/python/converter/shared_ptr_from_python.hpp:28: undefined reference to `boost::python::converter::registry::insert(void* (*)(_object*), void (*)(_object*, boost::python::converter::rvalue_from_python_stage1_data*), boost::python::type_info, _typeobject const* (*)())'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::converter::shared_ptr_from_python<Base, std::shared_ptr>::shared_ptr_from_python()':
/usr/include/boost/python/converter/shared_ptr_from_python.hpp:28: undefined reference to `boost::python::converter::registry::insert(void* (*)(_object*), void (*)(_object*, boost::python::converter::rvalue_from_python_stage1_data*), boost::python::type_info, _typeobject const* (*)())'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `void boost::python::objects::register_dynamic_id<Base>(Base*)':
/usr/include/boost/python/object/inheritance.hpp:72: undefined reference to `boost::python::objects::register_dynamic_id_aux(boost::python::type_info, std::pair<void*, boost::python::type_info> (*)(void*))'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::to_python_converter<Base, boost::python::objects::class_cref_wrapper<Base, boost::python::objects::make_instance<Base, boost::python::objects::value_holder<Base> > >, true>::to_python_converter()':
/usr/include/boost/python/to_python_converter.hpp:82: undefined reference to `boost::python::converter::registry::insert(_object* (*)(void const*), boost::python::type_info, _typeobject const* (*)())'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::converter::shared_ptr_from_python<Base, boost::shared_ptr>::convertible(_object*)':
/usr/include/boost/python/converter/shared_ptr_from_python.hpp:41: undefined reference to `boost::python::converter::get_lvalue_from_python(_object*, boost::python::converter::registration const&)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::converter::shared_ptr_from_python<Base, boost::shared_ptr>::construct(_object*, boost::python::converter::rvalue_from_python_stage1_data*)':
/usr/include/boost/python/converter/shared_ptr_from_python.hpp:53: undefined reference to `boost::python::converter::shared_ptr_deleter::shared_ptr_deleter(boost::python::handle<_object>)'
/usr/bin/ld: /usr/include/boost/python/converter/shared_ptr_from_python.hpp:52: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/bin/ld: /usr/include/boost/python/converter/shared_ptr_from_python.hpp:60: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::converter::expected_from_python_type_direct<Base>::get_pytype()':
/usr/include/boost/python/converter/pytype_function.hpp:106: undefined reference to `boost::python::converter::registration::expected_from_python_type() const'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::converter::shared_ptr_from_python<Base, std::shared_ptr>::convertible(_object*)':
/usr/include/boost/python/converter/shared_ptr_from_python.hpp:41: undefined reference to `boost::python::converter::get_lvalue_from_python(_object*, boost::python::converter::registration const&)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::converter::shared_ptr_from_python<Base, std::shared_ptr>::construct(_object*, boost::python::converter::rvalue_from_python_stage1_data*)':
/usr/include/boost/python/converter/shared_ptr_from_python.hpp:53: undefined reference to `boost::python::converter::shared_ptr_deleter::shared_ptr_deleter(boost::python::handle<_object>)'
/usr/bin/ld: /usr/include/boost/python/converter/shared_ptr_from_python.hpp:52: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/bin/ld: /usr/include/boost/python/converter/shared_ptr_from_python.hpp:60: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::shared_ptr<void>::shared_ptr<void, boost::python::converter::shared_ptr_deleter>(void*, boost::python::converter::shared_ptr_deleter)':
/usr/include/boost/smart_ptr/shared_ptr.hpp:382: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/bin/ld: /usr/include/boost/smart_ptr/shared_ptr.hpp:382: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `std::shared_ptr<void>::shared_ptr<void, boost::python::converter::shared_ptr_deleter, void>(void*, boost::python::converter::shared_ptr_deleter)':
/usr/include/c++/11/bits/shared_ptr.h:178: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o:/usr/include/c++/11/bits/shared_ptr.h:178: more undefined references to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()' follow
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::converter::registration const& boost::python::converter::detail::registry_lookup2<Base const volatile>(Base const volatile& (*)())':
/usr/include/boost/python/converter/registered.hpp:100: undefined reference to `boost::python::converter::registry::lookup(boost::python::type_info)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::detail::shared_count::shared_count<void*, boost::python::converter::shared_ptr_deleter>(void*, boost::python::converter::shared_ptr_deleter)':
/usr/include/boost/smart_ptr/detail/shared_count.hpp:191: undefined reference to `boost::python::converter::shared_ptr_deleter::operator()(void const*)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `std::__shared_ptr<void, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<void, boost::python::converter::shared_ptr_deleter, void>(void*, boost::python::converter::shared_ptr_deleter)':
/usr/include/c++/11/bits/shared_ptr_base.h:1108: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/bin/ld: /usr/include/c++/11/bits/shared_ptr_base.h:1108: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `_object* boost::python::objects::make_instance_impl<Base, boost::python::objects::value_holder<Base>, boost::python::objects::make_instance<Base, boost::python::objects::value_holder<Base> > >::execute<boost::reference_wrapper<Base const> const>(boost::reference_wrapper<Base const> const&)':
/usr/include/boost/python/object/make_instance.hpp:46: undefined reference to `boost::python::instance_holder::install(_object*)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::objects::make_holder<0>::apply<boost::python::objects::value_holder<Base>, boost::mpl::vector0<mpl_::na> >::execute(_object*)':
/usr/include/boost/python/object/make_holder.hpp:92: undefined reference to `boost::python::instance_holder::allocate(_object*, unsigned long, unsigned long)'
/usr/bin/ld: /usr/include/boost/python/object/make_holder.hpp:95: undefined reference to `boost::python::instance_holder::install(_object*)'
/usr/bin/ld: /usr/include/boost/python/object/make_holder.hpp:98: undefined reference to `boost::python::instance_holder::deallocate(_object*, void*)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<void*, boost::python::converter::shared_ptr_deleter, void>(void*, boost::python::converter::shared_ptr_deleter)':
/usr/include/c++/11/bits/shared_ptr_base.h:618: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/bin/ld: /usr/include/c++/11/bits/shared_ptr_base.h:618: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `_typeobject* boost::python::objects::make_instance<Base, boost::python::objects::value_holder<Base> >::get_class_object<boost::reference_wrapper<Base const> const>(boost::reference_wrapper<Base const> const&)':
/usr/include/boost/python/object/make_instance.hpp:67: undefined reference to `boost::python::converter::registration::get_class_object() const'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::objects::value_holder<Base>::value_holder(_object*)':
/usr/include/boost/python/object/value_holder.hpp:133: undefined reference to `boost::python::instance_holder::instance_holder()'
/usr/bin/ld: /usr/include/boost/python/object/value_holder.hpp:136: undefined reference to `boost::python::instance_holder::~instance_holder()'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::api::object boost::python::detail::make_function_aux<void (*)(_object*), boost::python::default_call_policies, boost::mpl::vector2<void, _object*>, mpl_::int_<0> >(void (*)(_object*), boost::python::default_call_policies const&, boost::mpl::vector2<void, _object*> const&, std::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&, mpl_::int_<0>)':
/usr/include/boost/python/make_function.hpp:62: undefined reference to `boost::python::objects::function_object(boost::python::objects::py_function const&, std::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<void*, boost::python::converter::shared_ptr_deleter, std::allocator<void>, void>(void*, boost::python::converter::shared_ptr_deleter, std::allocator<void>)':
/usr/include/c++/11/bits/shared_ptr_base.h:631: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/bin/ld: /usr/include/c++/11/bits/shared_ptr_base.h:637: undefined reference to `boost::python::converter::shared_ptr_deleter::operator()(void const*)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::objects::value_holder<Base>::value_holder<boost::reference_wrapper<Base const> >(_object*, boost::reference_wrapper<Base const>)':
/usr/include/boost/python/object/value_holder.hpp:133: undefined reference to `boost::python::instance_holder::instance_holder()'
/usr/bin/ld: /usr/include/boost/python/object/value_holder.hpp:136: undefined reference to `boost::python::instance_holder::~instance_holder()'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `std::_Sp_ebo_helper<0, boost::python::converter::shared_ptr_deleter, false>::~_Sp_ebo_helper()':
/usr/include/c++/11/bits/shared_ptr_base.h:394: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `std::_Sp_counted_deleter<void*, boost::python::converter::shared_ptr_deleter, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_deleter(void*, boost::python::converter::shared_ptr_deleter, std::allocator<void> const&)':
/usr/include/c++/11/bits/shared_ptr_base.h:436: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `void boost::python::api::object_operators<boost::python::api::object>::visit<boost::python::class_<Base, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>, char const*>(boost::python::class_<Base, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>&, char const*, boost::python::detail::def_helper<char const*, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> const&) const':
/usr/include/boost/python/object_core.hpp:168: undefined reference to `boost::python::objects::add_to_namespace(boost::python::api::object const&, char const*, boost::python::api::object const&, char const*)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o:(.data.rel.ro._ZTVN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFvP7_objectENS0_21default_call_policiesENS_3mpl7vector2IvS6_EEEEEE[_ZTVN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFvP7_objectENS0_21default_call_policiesENS_3mpl7vector2IvS6_EEEEEE]+0x30): undefined reference to `boost::python::objects::py_function_impl_base::max_arity() const'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::objects::caller_py_function_impl<boost::python::detail::caller<void (*)(_object*), boost::python::default_call_policies, boost::mpl::vector2<void, _object*> > >::~caller_py_function_impl()':
/usr/include/boost/python/object/py_function.hpp:30: undefined reference to `boost::python::objects::py_function_impl_base::~py_function_impl_base()'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::detail::sp_counted_impl_pd<void*, boost::python::converter::shared_ptr_deleter>::~sp_counted_impl_pd()':
/usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp:143: undefined reference to `boost::python::converter::shared_ptr_deleter::~shared_ptr_deleter()'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o:(.data.rel.ro._ZTVN5boost6python7objects23caller_py_function_implINS0_6detail6callerIM4BaseKFNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEvENS0_21default_call_policiesENS_3mpl7vector2ISB_RS5_EEEEEE[_ZTVN5boost6python7objects23caller_py_function_implINS0_6detail6callerIM4BaseKFNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEvENS0_21default_call_policiesENS_3mpl7vector2ISB_RS5_EEEEEE]+0x30): undefined reference to `boost::python::objects::py_function_impl_base::max_arity() const'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::objects::caller_py_function_impl<boost::python::detail::caller<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (Base::*)() const, boost::python::default_call_policies, boost::mpl::vector2<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Base&> > >::~caller_py_function_impl()':
/usr/include/boost/python/object/py_function.hpp:30: undefined reference to `boost::python::objects::py_function_impl_base::~py_function_impl_base()'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::objects::value_holder<Base>::~value_holder()':
/usr/include/boost/python/object/value_holder.hpp:39: undefined reference to `boost::python::instance_holder::~instance_holder()'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o:(.data.rel.ro._ZTIN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFvP7_objectENS0_21default_call_policiesENS_3mpl7vector2IvS6_EEEEEE[_ZTIN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFvP7_objectENS0_21default_call_policiesENS_3mpl7vector2IvS6_EEEEEE]+0x10): undefined reference to `typeinfo for boost::python::objects::py_function_impl_base'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o:(.data.rel.ro._ZTIN5boost6python7objects23caller_py_function_implINS0_6detail6callerIM4BaseKFNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEvENS0_21default_call_policiesENS_3mpl7vector2ISB_RS5_EEEEEE[_ZTIN5boost6python7objects23caller_py_function_implINS0_6detail6callerIM4BaseKFNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEvENS0_21default_call_policiesENS_3mpl7vector2ISB_RS5_EEEEEE]+0x10): undefined reference to `typeinfo for boost::python::objects::py_function_impl_base'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o:(.data.rel.ro._ZTIN5boost6python7objects12value_holderI4BaseEE[_ZTIN5boost6python7objects12value_holderI4BaseEE]+0x10): undefined reference to `typeinfo for boost::python::instance_holder'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `std::_Sp_counted_deleter<void*, boost::python::converter::shared_ptr_deleter, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose()':
/usr/include/c++/11/bits/shared_ptr_base.h:442: undefined reference to `boost::python::converter::shared_ptr_deleter::operator()(void const*)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::detail::sp_counted_impl_pd<void*, boost::python::converter::shared_ptr_deleter>::dispose()':
/usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp:169: undefined reference to `boost::python::converter::shared_ptr_deleter::operator()(void const*)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::objects::value_holder<Base>::holds(boost::python::type_info, bool)':
/usr/include/boost/python/object/value_holder.hpp:92: undefined reference to `boost::python::objects::find_static_type(void*, boost::python::type_info, boost::python::type_info)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::converter::expected_pytype_for_arg<void>::get_pytype()':
/usr/include/boost/python/converter/pytype_function.hpp:68: undefined reference to `boost::python::converter::registry::query(boost::python::type_info)'
/usr/bin/ld: /usr/include/boost/python/converter/pytype_function.hpp:71: undefined reference to `boost::python::converter::registration::expected_from_python_type() const'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::converter::expected_pytype_for_arg<_object*>::get_pytype()':
/usr/include/boost/python/converter/pytype_function.hpp:68: undefined reference to `boost::python::converter::registry::query(boost::python::type_info)'
/usr/bin/ld: /usr/include/boost/python/converter/pytype_function.hpp:71: undefined reference to `boost::python::converter::registration::expected_from_python_type() const'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::converter::reference_arg_from_python<Base&>::reference_arg_from_python(_object*)':
/usr/include/boost/python/converter/arg_from_python.hpp:282: undefined reference to `boost::python::converter::get_lvalue_from_python(_object*, boost::python::converter::registration const&)'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::converter::expected_pytype_for_arg<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::get_pytype()':
/usr/include/boost/python/converter/pytype_function.hpp:68: undefined reference to `boost::python::converter::registry::query(boost::python::type_info)'
/usr/bin/ld: /usr/include/boost/python/converter/pytype_function.hpp:71: undefined reference to `boost::python::converter::registration::expected_from_python_type() const'
/usr/bin/ld: CMakeFiles/embedding.dir/mymodule.cpp.o: in function `boost::python::converter::expected_pytype_for_arg<Base&>::get_pytype()':
/usr/include/boost/python/converter/pytype_function.hpp:68: undefined reference to `boost::python::converter::registry::query(boost::python::type_info)'
/usr/bin/ld: /usr/include/boost/python/converter/pytype_function.hpp:71: undefined reference to `boost::python::converter::registration::expected_from_python_type() const'
/usr/bin/ld: CMakeFiles/embedding.dir/embedding.cpp.o: in function `main':
/home/malte/Projects/boost-python-examples/10-Embedding/embedding.cpp:22: undefined reference to `boost::python::import(boost::python::str)'
/usr/bin/ld: /home/malte/Projects/boost-python-examples/10-Embedding/embedding.cpp:24: undefined reference to `boost::python::import(boost::python::str)'
/usr/bin/ld: /home/malte/Projects/boost-python-examples/10-Embedding/embedding.cpp:27: undefined reference to `boost::python::exec_file(char const*, boost::python::api::object, boost::python::api::object)'
/usr/bin/ld: CMakeFiles/embedding.dir/embedding.cpp.o: in function `boost::python::converter::arg_to_python<char const*>::arg_to_python(char const* const&)':
/usr/include/boost/python/converter/builtin_converters.hpp:157: undefined reference to `boost::python::converter::do_return_to_python(char const*)'
/usr/bin/ld: CMakeFiles/embedding.dir/embedding.cpp.o: in function `boost::python::api::const_attribute_policies::get(boost::python::api::object const&, char const*)':
/usr/include/boost/python/object_attributes.hpp:74: undefined reference to `boost::python::api::getattr(boost::python::api::object const&, char const*)'
/usr/bin/ld: CMakeFiles/embedding.dir/embedding.cpp.o: in function `boost::python::api::item_policies::set(boost::python::api::object const&, boost::python::api::object const&, boost::python::api::object const&)':
/usr/include/boost/python/object_items.hpp:73: undefined reference to `boost::python::api::setitem(boost::python::api::object const&, boost::python::api::object const&, boost::python::api::object const&)'
/usr/bin/ld: CMakeFiles/embedding.dir/embedding.cpp.o: in function `boost::python::str::str(char const*)':
/usr/include/boost/python/str.hpp:150: undefined reference to `boost::python::detail::str_base::str_base(char const*)'
/usr/bin/ld: CMakeFiles/embedding.dir/embedding.cpp.o: in function `boost::python::converter::pytype_object_manager_traits<&PyDict_Type, boost::python::dict>::adopt(_object*)':
/usr/include/boost/python/converter/pytype_object_mgr_traits.hpp:37: undefined reference to `boost::python::pytype_check(_typeobject*, _object*)'
/usr/bin/ld: CMakeFiles/embedding.dir/embedding.cpp.o: in function `boost::python::converter::detail::value_arg_to_python<Base>::value_arg_to_python(Base const&)':
/usr/include/boost/python/converter/arg_to_python.hpp:205: undefined reference to `boost::python::converter::detail::arg_to_python_base::arg_to_python_base(void const volatile*, boost::python::converter::registration const&)'
/usr/bin/ld: CMakeFiles/embedding.dir/embedding.cpp.o:(.data.rel.local.DW.ref._ZTIN5boost6python17error_already_setE[DW.ref._ZTIN5boost6python17error_already_setE]+0x0): undefined reference to `typeinfo for boost::python::error_already_set'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
make[2]: *** [10-Embedding/CMakeFiles/embedding.dir/build.make:120: 10-Embedding/embedding] Error 1
make[1]: *** [CMakeFiles/Makefile2:610: 10-Embedding/CMakeFiles/embedding.dir/all] Error 2
make: *** [Makefile:114: all] Error 2

Additional context
Add any other context about the problem here.

Cant import hello

Hey

Losing my banans here... all I get is >

import hello
ImportError: DLL load failed while importing hello: The specified module could not be found.

I can see the dll file and all. But ???? I'm lost :- (
win10x64/msvc/clion/ amd64 compile

Everything compiled fine as far as I can tell. Any help ?

python bytes can not match c++ char *

Boost.Python.ArgumentError: Python argument types in
pbcvt.YV12ToBGR24_FFmpeg(bytes, int, int)
did not match C++ signature:
YV12ToBGR24_FFmpeg(char*, int, int)

Can't build boost with python 3 on ubuntu 18.04

I am able to build and run boost with python 2 on ubuntu 18.04. I am not able to build and run boost with python 3.
My steps are as follows;

  1. Download boost
    I tried both boost 1.71 and 1.67 both in the end fail. Example here is given for 1.71.
cd /home/user/
wget https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2
tar --bzip2 -xf boost_1_71_0.tar.bz2
  1. Build boost against python 3
    The prefix folder is where the python library gets written
cd /home/user/boost_1_71_0
./bootstrap.sh -with-libraries=python -with-python-version=3.6 --prefix=/home/user/temp/
./b2 &./b2 install
  1. Download this library
cd /home/user/
git clone https://github.com/TNG/boost-python-examples
  1. Create a virtual environment so python points to python 3
cd boost-python-examples
python3 -m venv environment
source /environment/bin/activate
  1. Run cmake with flags
    I read this stack over flow post
    As a result I run the following commands;
set -x
rm -rf build
mkdir build
cd build
cmake -DPYTHON_VERSION_SUFFIX=-py3 -DCMAKE_BUILD_TYPE=DEBUG -DBOOST_ROOT=/home/user/temp/ -DBoost_NO_SYSTEM_PATHS=TRUE ..

Result -- Could NOT find Boost
Also tried -DBOOST_ROOT=/home/user/temp/boost_1_71_0 and several other options to no avail.

I have also tried to modify the cmakecache.txt from the python 2 configuration into variables suited for python 3.
This eventually leads to the error;

relocation R_X86_64_PC32 against symbol `PyLong_Type' can not be used when making a shared object; recompile with -fPIC

I also obtain this error when i tried to run examples using bjam.

Could you add a little bit of detail in the section about compiling python3 for OS X?

I'm trying to compile on OS X and tried to follow the instructions but I'm running into problems.

  1. I built boost-python (v 1.60.0) from homebrew with python3 support. So /usr/local/Cellar/boost-python/1.60.0/lib/ contains static and dynamic libraries for python 2 and 3, with and without multithreading. Eight total.

  2. Python is resolving to python3 using a virtualenv when I run the bash script.

  3. I run cmake with the added parameters you've specified, as follows:
    -DPYTHON_LIBRARY=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5.dylib
    -DBOOST_ROOT=/usr/local/Cellar/boost/1.60.0_2/
    -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/Headers/

  4. Lastly, in the bash script, I've added the line before running cmake: DYLD_LIBRARY_PATH=/usr/local/Cellar/boost-python/1.60.0/lib/


I believe this is the directory where the boost::python shared library resides, so it should be as instructed. If we can figure this out, I'd like to submit a patch to get it fixed or fork.

failed builds with homebrew-installed boost & python

I've installed boost, boost-build, cmake and python 2.7.8 on mac OS X using homebrew. cmake runs fine but when I attempt to make I get the error below. Any thoughts?

t89dc:build mike$ make
Scanning dependencies of target hello
[  6%] Building CXX object 01-HelloWorld/CMakeFiles/hello.dir/hello.cpp.o
Linking CXX shared module hello.so
Undefined symbols for architecture x86_64:
  "_PyString_Type", referenced from:
      boost::python::to_python_value<char const* const&>::get_pytype() const in hello.cpp.o
  "__Py_NoneStruct", referenced from:
      boost::python::api::object::object() in hello.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [01-HelloWorld/hello.so] Error 1
make[1]: *** [01-HelloWorld/CMakeFiles/hello.dir/all] Error 2
make: *** [all] Error 2

All examples throw a Segmentatio Fault

I've been trying to use Boost Python to wrap around an existing C++ library.
Unfortunatelly all I get is segmentation faults. I've tried the examples here (which compile fine btw) but whenever I try to import a module, it segfaults.
For example:

gdb --args python hello.py

Gets me:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff3bab2a9 in GlobalError::PushToStack() () from /usr/lib/x86_64-linux-gnu/libapt-pkg.so.5.0

I'm on:

  • gcc 7.4.0
  • g++ 7.4.0
  • python 3.6.8
  • ibboost-python-dev 1.65.1

Execution error in 02-ExposingClasses example

Hello,

Thank you for making public this repository

I have an issue with the following example "02-ExposingClasses". After a successful compilation when I executing the classes.py I have the following error:

Traceback (most recent call last):
  File "classes.py", line 5, in <module>
    t = classes.World()
TypeError: __init__() should return None, not 'NoneType'

I am using:

  • osx 10.13
  • python 3.6 anaconda
  • boost 1.65.1

in the build.sh I configured the following variables

  • PYTHON_VERSION="3.6m"
  • PYTHON_LIBRARY=/usr/local/anaconda/lib/libpython$PYTHON_VERSION.dylib
  • PYTHON_INCLUDE_DIR=/usr/local/anaconda/include/python$PYTHON_VERSION
  • BOOST_ROOT=/usr/local/anaconda

I checked that the classes.so was linked correctly

> otool -L classes.so
classes.so:
	@rpath/libboost_python3.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libpython3.6m.dylib (compatibility version 3.6.0, current version 3.6.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)

Thank

Best regards,
Vincent

boost-python has been disabled because it does not build!

Describe the bug
brew cannot find the boost-python lib

Error message(s)
boost-python has been disabled because it does not build!

Environment:

  • OS: [MAC OSX]
  • Version [Big Sur 11.4]
  • Python Version: 2.7.16
  • Boost Version: 1.76.0
  • Compiler Version

Can't run examples

I've built this project via the newest boost and cmake, using build.sh. I've tried to run them but even the first failed with error:

$python hello.py 
Traceback (most recent call last):
  File "hello.py", line 3, in <module>
    import hello
  File "<path>/hello.py", line 4, in <module>
    print (hello.greet())

Why doesn't it work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.