Search code examples
c++boost-pythonundefined-symbol

boost.python undefined symbol issue


I am trying to compile a project with boost.python, but run into the following problem

undefined symbol:    _ZN5boost6python7objects23register_dynamic_id_auxENS0_9type_infoEPFNSt3__14pairIPvS2_EE

I am building it using cmake

...
# Find necessary packages
find_package( PythonLibs 2.7 REQUIRED )
include_directories( ${PYTHON_INCLUDE_DIRS} )

find_package( Boost COMPONENTS python REQUIRED )
include_directories( ${Boost_INCLUDE_DIR} )

add_library(test_py SHARED ${SOURCE_FILES})

list(APPEND CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
target_link_libraries(test_py lib1)
target_link_libraries(test_py boost_python)
target_link_libraries(test_py python2.7)
set_target_properties(test_py PROPERTIES PREFIX "")

afterwards I have setup script that copies all the files to a directory test_py, with an init.py file

with

from test_py import *

Any ideas what I am missing?

Cheers, Mike


Solution

  • setting LD_LIBRARY_PATH fixed this.