Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilling error with clang++ #101

Closed
gsfish opened this issue Dec 6, 2016 · 10 comments
Closed

Compilling error with clang++ #101

gsfish opened this issue Dec 6, 2016 · 10 comments

Comments

@gsfish
Copy link

gsfish commented Dec 6, 2016

My OS is Ubuntu 16.04. I followed the installation guide and changed -stdlib=libc++, which had caused error while building, into -stdlib=libstdc++. Here is my command.

cmake -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_CXX_FLAGS="-std=c++11 -stdlib=libstdc++ -I/usr/include/libcxxabi" -D CMAKE_EXE_LINKER_FLAGS="-std=c++11 -stdlib=libstdc++ -lc++abi" -D CMAKE_BUILD_TYPE=RELEASE .. && cmake -j3

But I got the following error message in the final step and I don't know how to fix it:

[ 94%] Linking CXX executable ../../bin/FaceLandmarkVid
../../lib/local/LandmarkDetector/libLandmarkDetector.a(LandmarkDetectorUtils.cpp.o):在函数‘LandmarkDetector::DetectFaces(std::vector<cv::Rect_<double>, std::allocator<cv::Rect_<double> > >&, cv::Mat_<unsigned char> const&, cv::CascadeClassifier&)’中:
/home/gsfish/OpenFace/lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp:(.text+0x11c6e):对‘cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)’未定义的引用
clang: error: linker command failed with exit code 1 (use -v to see invocation)
exe/FaceLandmarkVid/CMakeFiles/FaceLandmarkVid.dir/build.make:126: recipe for target 'bin/FaceLandmarkVid' failed
make[2]: *** [bin/FaceLandmarkVid] Error 1
CMakeFiles/Makefile2:309: recipe for target 'exe/FaceLandmarkVid/CMakeFiles/FaceLandmarkVid.dir/all' failed
make[1]: *** [exe/FaceLandmarkVid/CMakeFiles/FaceLandmarkVid.dir/all] Error 2
make[1]: *** 正在等待未完成的任务....
[ 96%] Linking CXX executable ../../bin/FaceLandmarkVidMulti
../../lib/local/LandmarkDetector/libLandmarkDetector.a(LandmarkDetectorUtils.cpp.o):在函数‘LandmarkDetector::DetectFaces(std::vector<cv::Rect_<double>, std::allocator<cv::Rect_<double> > >&, cv::Mat_<unsigned char> const&, cv::CascadeClassifier&)’中:
/home/gsfish/OpenFace/lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp:(.text+0x11c6e):对‘cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)’未定义的引用
clang: error: linker command failed with exit code 1 (use -v to see invocation)
exe/FaceLandmarkVidMulti/CMakeFiles/FaceLandmarkVidMulti.dir/build.make:125: recipe for target 'bin/FaceLandmarkVidMulti' failed
make[2]: *** [bin/FaceLandmarkVidMulti] Error 1
CMakeFiles/Makefile2:365: recipe for target 'exe/FaceLandmarkVidMulti/CMakeFiles/FaceLandmarkVidMulti.dir/all' failed
make[1]: *** [exe/FaceLandmarkVidMulti/CMakeFiles/FaceLandmarkVidMulti.dir/all] Error 2
[ 97%] Linking CXX executable ../../bin/FaceLandmarkImg
CMakeFiles/FaceLandmarkImg.dir/FaceLandmarkImg.cpp.o:在函数‘main’中:
/home/gsfish/OpenFace/exe/FaceLandmarkImg/FaceLandmarkImg.cpp:(.text+0x8a0c):对‘cv::imwrite(cv::String const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)’未定义的引用
/home/gsfish/OpenFace/exe/FaceLandmarkImg/FaceLandmarkImg.cpp:(.text+0x9a2a):对‘cv::imwrite(cv::String const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)’未定义的引用
../../lib/local/LandmarkDetector/libLandmarkDetector.a(LandmarkDetectorUtils.cpp.o):在函数‘LandmarkDetector::DetectFaces(std::vector<cv::Rect_<double>, std::allocator<cv::Rect_<double> > >&, cv::Mat_<unsigned char> const&, cv::CascadeClassifier&)’中:
/home/gsfish/OpenFace/lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp:(.text+0x11c6e):对‘cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)’未定义的引用
clang: error: linker command failed with exit code 1 (use -v to see invocation)
exe/FaceLandmarkImg/CMakeFiles/FaceLandmarkImg.dir/build.make:126: recipe for target 'bin/FaceLandmarkImg' failed
make[2]: *** [bin/FaceLandmarkImg] Error 1
CMakeFiles/Makefile2:252: recipe for target 'exe/FaceLandmarkImg/CMakeFiles/FaceLandmarkImg.dir/all' failed
make[1]: *** [exe/FaceLandmarkImg/CMakeFiles/FaceLandmarkImg.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
@TadasBaltrusaitis
Copy link
Owner

The issue seems to be the linker, maybe not all the libraries that the code depends on were installed? It's hard to tell without knowing what the code can't link to (as the error indicates you can use -v to find out more.

@gsfish
Copy link
Author

gsfish commented Dec 6, 2016

I have installed all the depends in Wiki, but it still doesn't work.
Here is the output by using -v in CMAKE_EXE_LINKER_FLAGS. How to find out what libraries I need to install?

[ 97%] Linking CXX executable ../../bin/FaceLandmarkImg
clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/5.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/6.0.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/usr/bin/ld" -export-dynamic -z relro --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o ../../bin/FaceLandmarkImg /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crt1.o /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/crtbegin.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../.. -L/usr/lib/llvm-3.8/bin/../lib -L/lib -L/usr/lib -lc++abi CMakeFiles/FaceLandmarkImg.dir/FaceLandmarkImg.cpp.o ../../lib/local/LandmarkDetector/libLandmarkDetector.a ../../lib/local/FaceAnalyser/libFaceAnalyser.a ../../lib/3rdParty/dlib/libdlib.a /usr/local/lib/libopencv_videostab.so.3.1.0 /usr/local/lib/libopencv_superres.so.3.1.0 /usr/local/lib/libopencv_stitching.so.3.1.0 /usr/local/lib/libopencv_shape.so.3.1.0 /usr/local/lib/libopencv_photo.so.3.1.0 /usr/local/lib/libopencv_objdetect.so.3.1.0 /usr/local/lib/libopencv_calib3d.so.3.1.0 -lboost_filesystem -lboost_system -ltbb -lpthread -lnsl -lSM -lICE -lX11 -lXext -lpng -ljpeg -lblas -llapack /usr/local/lib/libopencv_features2d.so.3.1.0 /usr/local/lib/libopencv_ml.so.3.1.0 /usr/local/lib/libopencv_highgui.so.3.1.0 /usr/local/lib/libopencv_videoio.so.3.1.0 /usr/local/lib/libopencv_imgcodecs.so.3.1.0 /usr/local/lib/libopencv_flann.so.3.1.0 /usr/local/lib/libopencv_video.so.3.1.0 /usr/local/lib/libopencv_imgproc.so.3.1.0 /usr/local/lib/libopencv_core.so.3.1.0 -rpath /usr/local/lib: -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/crtend.o /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crtn.o
../../lib/local/LandmarkDetector/libLandmarkDetector.a(LandmarkDetectorUtils.cpp.o):在函数‘LandmarkDetector::DetectFaces(std::vector<cv::Rect_<double>, std::allocator<cv::Rect_<double> > >&, cv::Mat_<unsigned char> const&, cv::CascadeClassifier&)’中:
/home/gsfish/OpenFace/lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp:(.text+0x11c6e):对‘cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)’未定义的引用
clang: error: linker command failed with exit code 1 (use -v to see invocation)
exe/FaceLandmarkVid/CMakeFiles/FaceLandmarkVid.dir/build.make:126: recipe for target 'bin/FaceLandmarkVid' failed
make[2]: *** [bin/FaceLandmarkVid] Error 1
CMakeFiles/Makefile2:309: recipe for target 'exe/FaceLandmarkVid/CMakeFiles/FaceLandmarkVid.dir/all' failed
make[1]: *** [exe/FaceLandmarkVid/CMakeFiles/FaceLandmarkVid.dir/all] Error 2
make[1]: *** 正在等待未完成的任务....
../../lib/local/LandmarkDetector/libLandmarkDetector.a(LandmarkDetectorUtils.cpp.o):在函数‘LandmarkDetector::DetectFaces(std::vector<cv::Rect_<double>, std::allocator<cv::Rect_<double> > >&, cv::Mat_<unsigned char> const&, cv::CascadeClassifier&)’中:
/home/gsfish/OpenFace/lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp:(.text+0x11c6e):对‘cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)’未定义的引用
clang: error: linker command failed with exit code 1 (use -v to see invocation)
exe/FaceLandmarkVidMulti/CMakeFiles/FaceLandmarkVidMulti.dir/build.make:125: recipe for target 'bin/FaceLandmarkVidMulti' failed
make[2]: *** [bin/FaceLandmarkVidMulti] Error 1
CMakeFiles/Makefile2:365: recipe for target 'exe/FaceLandmarkVidMulti/CMakeFiles/FaceLandmarkVidMulti.dir/all' failed
make[1]: *** [exe/FaceLandmarkVidMulti/CMakeFiles/FaceLandmarkVidMulti.dir/all] Error 2
CMakeFiles/FaceLandmarkImg.dir/FaceLandmarkImg.cpp.o:在函数‘main’中:
/home/gsfish/OpenFace/exe/FaceLandmarkImg/FaceLandmarkImg.cpp:(.text+0x8a0c):对‘cv::imwrite(cv::String const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)’未定义的引用
/home/gsfish/OpenFace/exe/FaceLandmarkImg/FaceLandmarkImg.cpp:(.text+0x9a2a):对‘cv::imwrite(cv::String const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)’未定义的引用
../../lib/local/LandmarkDetector/libLandmarkDetector.a(LandmarkDetectorUtils.cpp.o):在函数‘LandmarkDetector::DetectFaces(std::vector<cv::Rect_<double>, std::allocator<cv::Rect_<double> > >&, cv::Mat_<unsigned char> const&, cv::CascadeClassifier&)’中:
/home/gsfish/OpenFace/lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp:(.text+0x11c6e):对‘cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)’未定义的引用
clang: error: linker command failed with exit code 1 (use -v to see invocation)
exe/FaceLandmarkImg/CMakeFiles/FaceLandmarkImg.dir/build.make:126: recipe for target 'bin/FaceLandmarkImg' failed
make[2]: *** [bin/FaceLandmarkImg] Error 1
CMakeFiles/Makefile2:252: recipe for target 'exe/FaceLandmarkImg/CMakeFiles/FaceLandmarkImg.dir/all' failed
make[1]: *** [exe/FaceLandmarkImg/CMakeFiles/FaceLandmarkImg.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

@TadasBaltrusaitis
Copy link
Owner

It seems like the cv::CascadeClassifier::detectMultiScale is causing issues, this might be due to failure to link to OpenCV, make sure that OpenCV is correctly installed and can be found by the compiler.

Thanks,
Tadas

@gsfish
Copy link
Author

gsfish commented Dec 7, 2016

Got it, thanks for your help.
I found that there are warnings when I build OpenCV, it need to add -Wno-deprecated-register in cmake flags to disable the warning.
The install process seems has little difference between Ubuntu 16.04 and 15.04 in building OpenCV and OpenFace. Maybe it should be added to Wiki.

@pgnaleen
Copy link

pgnaleen commented Aug 4, 2017

[ 97%] Linking CXX executable ../../bin/soci_oracle_test_static
Undefined first referenced
symbol in file
_1cG__CrunKpure_error6F_v /root/nalin/instantclient_10_2/libocci.so
1cDstdbC__RTTI__1nDstdMlength_error /root/nalin/instantclient_10_2/libocci.so
.................

i got this error when compiling soci with oracle on solaris 11.7
please help me.

@TadasBaltrusaitis
Copy link
Owner

This does not seem to be an OpenFace issue, as it does not use a libocci library, it might be related to something else you are linking to.

@filosofisto
Copy link

This issue evolved?
I have same issue in Solaris 11.

@voletiv
Copy link

voletiv commented Feb 18, 2018

Same issue in Ubuntu 16.04 with OpenCV 3.4.0 installed without any errors. Please help.

@TadasBaltrusaitis
Copy link
Owner

Can you provide more details about the issue?

@filosofisto
Copy link

In my case I am linking that form:

/usr/gcc/4.8/bin/g++ -o dist/Debug/GNU-Solaris-Sparc/occitest build/Debug/GNU-Solaris-Sparc/main.o -L/home/f780333/paineldaemon/lib -L/home/f780333/paineldaemon/lib/instantclient_11_2 -R'/home/f780333/paineldaemon/lib' -R'/home/f780333/paineldaemon/lib/instantclient_11_2' -locci -lclntsh -m64 -lrt -liostream -lCrun

The -liostream and -lCrun was inserted to resolve similar problems, and I had have to create a symbolic link with bellow commands:

ln -s /usr/lib/sparcv9/libiostream.so.1 libiostream.so
ln -s /usr/lib/sparcv9/libCrun.so.1 libCrun.so

But now I have this other symbols problem:

ld: warning: symbol 'clog' has differing types:
(file /home/f780333/paineldaemon/lib/libiostream.so type=OBJT; file /lib/sparcv9/libm.so type=FUNC);
/home/f780333/paineldaemon/lib/libiostream.so definition taken
Undefined first referenced
symbol in file
1cDstdbC__RTTI__1nDstdMlength_error /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdMout_of_range2T6M_v /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2G6Mpkc_r1 /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdLlogic_error2t6Mrkn0AMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc_____v /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2G6Mrk1_r1 /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2t6MpkcLrkn0C__v /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cH__rwstdRexcept_msg_string2t6MIE_v /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2t6Mpkcrkn0C__v /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2T6M_v /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MLLpkcLLL_pc /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cH__rwstdbC__rwse_StringIndexOutOfRange /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cH__rwstdX__rwse_InvalidSizeParam /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Efind6kMpkcLL_L /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___J__nullref /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cH__rwstdUInterlockedDecrement6Fpl_l /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cH__rwstdUInterlockedIncrement6Fpl_l /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
1cDstdbC__RTTI__1nDstdMout_of_range /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Gassign6Mrk1LL_r1 /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
1cDstdLlogic_error2T6M_v /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
1cH__rwstdTInterlockedExchange6Fpll_l /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___I__getRep6MLL_pnH__rwstdM__string_ref4Ccn0B_n0C
/home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdJallocator4Cc_2t6M_v /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdMlength_error2t6Mrkn0AMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc_____v /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cH__rwstdY__rwse_UnexpectedNullPtr /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2t6Mrk1LLrkn0C__v /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdMlength_error2T6M_v /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdMout_of_range2t6Mrkn0AMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc_____v /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cH__rwstdX__rwse_ResultLenInvalid /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
_1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___I__unLink6M_v /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
1cDstdbB__RTTI__1nDstdLlogic_error /home/f780333/paineldaemon/lib/instantclient_11_2/libocci.so
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
gmake[2]: *** [dist/Debug/GNU-Solaris-Sparc/occitest] Error 1
gmake[2]: Leaving directory /home/f780333/.netbeans/remote/172.16.160.172/sylvia-Linux-x86_64/home/eduardo/Indra/Cartoes/repo/misc/OCCITest' gmake[1]: *** [.build-conf] Error 2 gmake[1]: Leaving directory /home/f780333/.netbeans/remote/172.16.160.172/sylvia-Linux-x86_64/home/eduardo/Indra/Cartoes/repo/misc/OCCITest'
gmake: *** [.build-impl] Error 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants