flandmark icon indicating copy to clipboard operation
flandmark copied to clipboard

ld: library not found for -lhighgui

Open ashgillman opened this issue 8 years ago • 2 comments

I had an error compiling on OSX Yosemite

Linking CXX executable flandmark_1 ld: library not found for -lhighgui clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [examples/flandmark_1] Error 1 make[2]: Target `examples/CMakeFiles/flandmark_1.dir/build' not remade because of errors. make[1]: *** [examples/CMakeFiles/flandmark_1.dir/all] Error 2

I was able to fix by modifying /examples/CMakeLists.txt and commenting out lines 10 and 11.

if (UNIX) #set(CV_LIBS_1 highgui) #set(CV_LIBS_2 cxcore cv cvaux) elseif (WIN32) set(CV_LIBS_1 highgui${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}) set(CV_LIBS_2 cxcore${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH} cv${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH} cvaux${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}) elseif (APPLE) endif (UNIX)

Although, this would probably break the installation on other systems. I believe there may be some issue preventing the installer from setting the UNIX variable false.

ashgillman avatar Aug 20 '15 02:08 ashgillman

Hi @ashgillman,

thank you for the info.

You are right, the CMakeLists.txt should be updated, because for OSX, UNIX is also set to true by CMake.

uricamic avatar Aug 20 '15 07:08 uricamic

Same error on my Ubuntu 16.06 machine. I fixed the issue by modifying if statement in line 8 of the file /examples/CMakeLists.txt:

if (${OpenCV_VERSION_MINOR} **LESS** 3) to if (${OpenCV_VERSION_MINOR} **GREATER** 3), and of course corresponding endif statement in line 26. Both if (line 8) and else (line 17) statements were written for less than 3 case mistakenly and therefore, it enters into the if statement although my minor version is greater than 3. Need to fix this @uricamic.

burak43 avatar Jul 26 '18 23:07 burak43