make编译报错:
undefined reference to PyExc_ImportError'
解决办法,把so文件加入进来:
在CmakeLists.txt中的target_link_libraries中加入应用的库
target_link_libraries (videoserver X11 pthread libavcodec.so.58 libavdevice.so.58 libavfilter.so.7 libavformat.so.58 libavutil.so.56 libswresample.so.3 libswscale.so.5 ${OpenCV_LIBS} ${Boost_LIBRARIES} libpython3.5.so libpython3.5m.so)
cmake_minimum_required(VERSION 3.0)
project(videoserver)
set(CMAKE_BUILD_TYPE, Debug)
#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++11")
find_package(OpenCV REQUIRED)
find_package(Boost 1.58.0 REQUIRED COMPONENTS system filesystem)
include_directories(/home/nvidia/data/projects/VideoServer/WebsocketEnv /usr/include/python3.5 /usr/lib/python3/dist-packages/numpy/core/include)
link_directories(/home/nvidia/ffmpeg_build/lib /home/nvidia/data/projects/VideoServer/opencv-4.1.0/build/lib /usr/lib/python3.5/config-3.5m-aarch64-linux-gnu /usr/lib/python3)
add_executable(server main.cpp)
install(TARGETS videoserver RUNTIME DESTINATION bin)
target_link_libraries (videoserver X11 pthread libavcodec.so.58 libavdevice.so.58 libavfilter.so.7 libavformat.so.58 libavutil.so.56 libswresample.so.3 libswscale.so.5 ${OpenCV_LIBS} ${Boost_LIBRARIES} libpython3.5.so libpython3.5m.so)