我正试图编译libhand的示例,但我得到了以下输出:
/usr/bin/ld: /usr/local/lib/libOgreMainStatic.a(OgreDynLib.cpp.o): undefined reference to symbol 'dlopen@@GLIBC_2.1'
/usr/bin/ld: note: 'dlopen@@GLIBC_2.1' is defined in DSO /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/libdl.so so try adding it to the linker command line
/usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/libdl.so: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: *** [bend_one_finger] Error 1
make[1]: *** [CMakeFiles/bend_one_finger.dir/all] Error 2
make: *** [all] Error 2
当我尝试使用libhand示例的方向编译自己的示例时,也会发生同样的事情。我相信这与libhand的配置文件(LibHandConfig.cmake)有关
当我将其作为libhand的一部分构建时,同样的例子编译得很好,当我尝试将libhand用作包时(使用cmake的FIND_package())
不是一个完整的答案,但只是迈向的一步
在收到make
错误后,尝试发出以下命令:
/usr/bin/c++ CMakeFiles/example.dir/example.cc.o -o example -rdynamic -ldl -lXt /path/libs/libHand/hand_cpp/dist/libhand_hog.a /path/libs/libHand/hand_cpp/dist/libhand_renderer.a /path/libs/libHand/hand_cpp/dist/libhand_utils.a -lopencv_core -lopencv_flann -lopencv_imgproc -lopencv_highgui -lopencv_features2d -lopencv_calib3d -lopencv_cudaarithm -lopencv_cudawarping -lopencv_ml -lopencv_objdetect -lopencv_cuda -lopencv_cudafilters -lopencv_cudaimgproc -lopencv_video -lopencv_legacy -lopencv_cudaoptflow -lopencv_photo -lopencv_videostab -lopencv_ts -lopencv_cudacodec -lopencv_ocl -lopencv_superres -lopencv_cudafeatures2d -lopencv_nonfree -lopencv_stitching -lopencv_softcascade -lopencv_shape -lopencv_optim -lopencv_cudastereo -lopencv_cudabgsegm -lopencv_contrib -lopencv_bioinspired /path/libs/libHand/hand_cpp/dist/libdot_sceneloader.a /path/libs/libHand/hand_cpp/dist/libtinyxml.a /usr/local/lib/libOgreMainStatic.a -lzzip -lz -lfreeimage -lfreetype -lSM -lICE -lX11 -lXext -lXaw -lXrandr -ltbb /usr/local/lib/OGRE/libRenderSystem_GLStatic.a -lGLU -lGL /usr/local/lib/libOgreMainStatic.a -lzzip -lz -lfreeimage -lfreetype -lSM -lICE -lX11 -lXext -lXaw -lXrandr -ltbb /usr/local/lib/OGRE/libRenderSystem_GLStatic.a -lGLU -lGL /usr/local/lib/OGRE/libPlugin_OctreeSceneManagerStatic.a -ldl
如果成功,则必须手动将-ldl添加到库列表(target_link_libraries(example ${SOME_LIBS} ${OTHER_LIBS} -ldl)
)的末尾。LibOGRE的配置部分似乎有点不正确(它不包括一个库libdl,这是不小心将应用程序与之链接所必需的)。