Pybind11: Using pybind with existing CMake structure

Created on 18 Dec 2017  路  2Comments  路  Source: pybind/pybind11

Issue description

I'm trying to use pybind with an existinc cmake structure. I modified the existing CMakeLists.txt file adding
add_subdirectory(src/pybind11)
pybind11_add_module(mycode src/mycode.cpp)
target_link_libraries(mycode PRIVATE ${MYCODE_LIBRARIES})

This compiles succesfully and generates mycode.so, but when trying to import it via python I get following error:
import mycode

ImportError: ./mycode.so: undefined symbol: PyInstanceMethod_Type

Any ideas what the problem may be?

All 2 comments

This might come from a python version mismatch between the version used to compile and the version used to run.

Should be fixed by #2370 and related changes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tdp2110 picture tdp2110  路  3Comments

MisesEnForce picture MisesEnForce  路  3Comments

ppwwyyxx picture ppwwyyxx  路  3Comments

nyckmaia picture nyckmaia  路  3Comments

neutralid picture neutralid  路  3Comments