1

I am trying to compile the examples of libhand, but I get the following output:

/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

The same thing happens when I try to compile my own example using the direction from libhand example. I believe it has something to do with the configuration file of libhand (LibHandConfig.cmake).

The same example compiles fine when I build it as a part of libhand, the problem occurs when I try to use libhand as a package (using cmake's FIND_PACKAGE() )

Theodosis
  • 31
  • 6

1 Answers1

2

Not a complete answer, but just a step toward:

try to issue the following command after you got the make error:

/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

If it succeeds than you have to manually add -ldl to the end of your libraries list ( target_link_libraries(example ${SOME_LIBS} ${OTHER_LIBS} -ldl) ). It seems that the configuration part of LibOGRE is slightly incorrect (it doesn't include a library libdl necessary to carelessly link application with it.

user3159253
  • 16,836
  • 3
  • 30
  • 56
  • 1
    I had to add -lXt in the end too, but that was the solution. Thanks a lot! – Theodosis Apr 10 '14 at 09:29
  • 1
    Which lead me to append ";-ldl -lXt" to the end of the line LibHand-export-noconfig.cmake:44 so that it works with make too – Theodosis Apr 10 '14 at 09:37
  • i am not able to build hand_cpp. I get error : [100%] [100%] Building CXX object source/CMakeFiles/pose_designer.dir/pose_designer_main.cc.o Building CXX object source/CMakeFiles/pose_designer.dir/pose_designer.cc.o Linking CXX executable pose_designer /usr/bin/ld: cannot find -lNOTFOUND /usr/bin/ld: cannot find -lNOTFOUND libhand_utils.a(file_dialog.cc.o): In function `libhand::FileDialog::TkExec(std::string const&)': /home/krr/shome/libhand/libhand-public-master/hand_cpp/source/file_dialog.cc:91: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'. did u face this? – user27665 Feb 04 '16 at 07:46