1

我一直在移植此代码以与 opencv3 一起使用。 https://github.com/anhttran/extreme_3d_faces

到目前为止,我已经完成了大部分编译,但是当它几乎完成时,我不断收到这个错误。我已经查看了此问题的许多情况,但目前还没有一个解决方案对我有用。任何帮助将不胜感激。

到目前为止,我已经尝试过:

  • 手动创建指向 libdl.so 的符号链接(因为这解决了我之前在编译中遇到的一些类似错误)
  • 添加 -ldl 作为标志,并在 cmakelists
  • 重新排列包含的库的顺序,因为已知会产生影响

结果:

[ 92%] Linking CXX executable ../bin/TestBump /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libhdf5.a(H5PL.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libdl.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status config/CMakeFiles/TestBump.dir/build.make:149: recipe for target 'bin/TestBump'
failed make[2]: *** [bin/TestBump] Error 1 CMakeFiles/Makefile2:196: recipe for target 'config/CMakeFiles/TestBump.dir/all'
failed make[1]: *** [config/CMakeFiles/TestBump.dir/all] Error 2 
Makefile:129: recipe for target 'all' failed make: *** [all] Error 2

到目前为止,没有任何效果。有什么建议吗?

我的 cmakelists 文件中的代码如下。

# Local libraries
include_directories(../modules/CvGl)
include_directories(../modules/PoseExpr/include)
include_directories(${DLIB_INCLUDE_DIR})
include_directories(${HDF5_INCLUDE_DIR})
add_definitions(-std=c++11)
add_definitions(-DDLIB_JPEG_SUPPORT)
add_definitions(-DDLIB_PNG_SUPPORT)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} 
"${CMAKE_SOURCE_DIR}/cmake/")
set(CMAKE_BUILD_TYPE Release)
SET(SOURCE
    ../main.cpp
)

SET(CMAKE_CXX_FLAGS "-w -fopenmp")
add_executable(TestBump ${SOURCE})

if(WIN32)
    target_link_libraries(TestBump ${OpenCVLibraries})
endif(WIN32)
if(UNIX)
    target_link_libraries(TestBump -ldl ${OpenCV_LIBS} 
${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
endif(UNIX)
target_link_libraries(TestBump PoseExprLib 
${DLIB_LIB_DIR}/libdlib.so  ${CMAKE_DL_LIBS} -lGLU -lOSMesa -lm)
install (TARGETS TestBump DESTINATION .)
4

0 回答 0