Ich habe ein Beispiel mit der folgenden Struktur.Segfault bei Verwendung von pybind11 Wrappern in C++
├── CMakeLists.txt
├── ext
│ └── pybind11
└── main.cpp
CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
project(notworking)
add_subdirectory(ext/pybind11)
add_executable(notworking
main.cpp)
target_link_libraries(notworking PRIVATE python3.6m)
target_link_libraries(notworking PRIVATE pybind11)
main.cpp
#include <pybind11/pybind11.h>
namespace py = pybind11;
int main() { py::object decimal = py::module::import("decimal"); }
Und jetzt beim Fahren
╰─ ./notworking
[1] 14879 segmentation fault (core dumped) ./notworking
Was fehlt mir, damit dieses Modul hier richtig geladen wird? Ich habe die documentation, insbesondere die Build Systems Sektion, abgesucht, bin aber leer ausgegangen.
Es scheint auch der Fall zu sein, wenn Sie andere Wrapper in pybind11 von C++ verwenden.