다음 구조의 예제가 있습니다.Segfault는 C++에서 pybind11 래퍼를 사용할 때
├── 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"); }
그리고 지금에 따라
╰─ ./notworking
[1] 14879 segmentation fault (core dumped) ./notworking
이 모듈을 올바르게로드하려면 무엇이 손실됩니까? 나는 , 특히 빌드 시스템 섹션을 샅샅이 조사했지만 비어 있습니다.
C++의 pybind11에 다른 래퍼를 사용하는 경우에도 나에게 맞는 것 같습니다.