Closed hyuce closed 8 years ago
Hi @hyuce,
I have done recently an update of CMake files. So, just a quick check, have you called make install after successful compilation? However, I would expect, that CMake would complain that it could not find CLandmark package and no makefiles should be therefore generated.
PS: I think now it is also needed to add FIND_PACKAGE(flandmark REQUIRED)
to the CMakeLists.txt file.
I added flandmark (I get confused at this point) also added ${FLANDMARK_LIBRARIES}
in TARGET_LINK_LIBRARIES
I see it.
/usr/bin/ld: cannot find -lflandmark_shared collect2: error: ld returned 1 exit status CMakeFiles/FaceFuture.dir/build.make:149: recipe for target '/FaceFeature/Debug/FaceFuture' failed make[2]: * [/FaceFeature/Debug/FaceFuture] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/FaceFuture.dir/all' failed make[1]: * [CMakeFiles/FaceFuture.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *\ [all] Error 2
Should I install the flandmark (on http://cmp.felk.cvut.cz/~uricamic/flandmark/) library.
Hi @hyuce,
no, the problem is, that CLandmark was not located by CMake, can you please show me a screenshot of your CMake configuration?
The snippet for CMakeLists.txt of an external application should look like this:
cmake_minimum_required(VERSION 2.8.9)
project(clandmark_external)
find_package(OpenCV REQUIRED core imgproc objdetect video highgui)
find_package(clandmark REQUIRED)
find_package(flandmark REQUIRED)
include_directories(
${OpenCV_INCLUDE_DIR}
${CLANDMARK_INCLUDE_DIRS}
${FLANDMARK_INCLUDE_DIRS}
)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RELEASE CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE
)
endif(NOT CMAKE_BUILD_TYPE)
set(EXAMPLES main)
foreach(var ${EXAMPLES})
add_executable(${var} ${var}.cpp)
target_link_libraries(${var} ${FLANDMARK_LIBRARIES} ${CLANDMARK_LIBRARIES} ${OpenCV_LIBS})
endforeach()
Please note, that ${FLANDMARK_LIBRARIES}
has to come before ${CLANDMARK_LIBRARIES}.
I am still puzzled, how come CMake lets you generate the makefile, when CLandmark is not found and explicitly stated as REQUIRED
.
it's my CMakeList.txt
PROJECT( FaceFuture )
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -std=c++11")
ADD_DEFINITIONS(-D_GLIBCXX_USE_CXX11_ABI=0)
SET(CMAKE_C_FLAGS_DEBUG "-g")
ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET(CMAKE_CXX_COMPILER "/usr/local/bin/g++-6")
SET(CMAKE_C_COMPILER "/usr/local/bin/gcc-6")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -std=c++11")
ADD_DEFINITIONS(-D_GLIBCXX_USE_CXX11_ABI=0)
INCLUDE_DIRECTORIES(/usr/local/Cellar/gcc/6.1.0_1/lib/gcc/6/gcc/x86_64-apple-darwin15.6.0/6.1.0/include/)
# ADD_SUBDIRECTORY(external)
ENDIF()
FIND_PACKAGE(OpenCV REQUIRED)
FIND_PACKAGE(CLandmark REQUIRED)
FIND_PACKAGE(flandmark REQUIRED)
SET (CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,'$ORIGIN/' " )
MESSAGE(${OpenCV_DIR})
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS} ${CLANDMARK_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/3rd_party/rapidxml-1.13)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/3rd_party/CImg-1.5.6)
ADD_EXECUTABLE( FaceFuture main.cpp)
TARGET_LINK_LIBRARIES( FaceFuture ${FLANDMARK_LIBRARIES} ${CLANDMARK_LIBRARIES} ${OpenCV_LIBS} )
option(DOUBLE_PRECISION "Set the default precision used in CLandmark" ON)
# propagate precision definition
if(DOUBLE_PRECISION)
add_definitions( -DDOUBLE_PRECISION=1 )
else(DOUBLE_PRECISION)
add_definitions( -DDOUBLE_PRECISION=0 )
endif(DOUBLE_PRECISION)
after that compiled
I see it this in my console
-- Found Threads: TRUE
-- Found CUDA: /usr (found suitable exact version "7.5")
CMake Error at CMakeLists.txt:19 (FIND_PACKAGE): By not providing "Findflandmark.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "flandmark", but CMake did not find one. Could not find a package configuration file provided by "flandmark" with any of the following names:
flandmarkConfig.cmake
flandmark-config.cmake
Add the installation prefix of "flandmark" to CMAKE_PREFIX_PATH or set "flandmark_DIR" to a directory containing one of the above files. If "flandmark" provides a separate development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!
According to this situation, it seems to have not been installed clandmark/cmake/Modules/Findflandmark.cmake
Why it may not be installed during the installation?
Ok, that's what I was speaking about. This line
-- Configuring incomplete, errors occurred!
is saying that CMake configuration was not successful, therefore ${FLANDMARK_LIBRARIES}
, ${CLANDMARK_LIBRARIES}
, ${CLANDMARK_INCLUDE_DIRS}
, and ${FLANDMARK_INCLUDE_DIRS}
are empty, and it makes no sense to try the compilation. I suggest you to use cmake-curses-gui, which would prevent you from proceeding further after such error.
Nevermind, by installation, I meant the procedure of the library installation. I guess, you had done the CMake configuration of the CLandmark
library, then compiled it by calling make
, and I was asking whether you have also called make install
after that. Because without this step, the CLandmark
library won't be found by CMake in an external project. It can be of course specified manually, but it is much easier to install it (you can select where to install it by changing the CMAKE_INSTALL_PREFIX
CMake variable).
Should I install the flandmark (on http://cmp.felk.cvut.cz/~uricamic/flandmark/) library. is clandmark library depends on flandmark library.
No, that's completely independent project. Sorry, for the possible confusion by using the same name. CLandmark
is basically a replacement of http://cmp.felk.cvut.cz/~uricamic/flandmark/
You have to install CLandmark
library first, to use it in external project.
I did before. I saw this
$ sudo make install
[ 40%] Built target clandmark
[ 81%] Built target flandmark
[ 90%] Built target static_input
[100%] Built target video_input
Install the project...
-- Install configuration: "RELEASE"
-- Installing: /usr/local/lib/cmake/clandmark/CLandmarkTargets.cmake
-- Installing: /usr/local/lib/cmake/clandmark/CLandmarkTargets-release.cmake
-- Installing: /usr/local/lib/cmake/clandmark/CLandmarkConfig.cmake
-- Installing: /usr/local/lib/cmake/clandmark/CLandmarkConfigVersion.cmake
-- Installing: /usr/local/lib/libclandmark.so.1.5
-- Installing: /usr/local/lib/libclandmark.so.1
-- Installing: /usr/local/lib/libclandmark.so
-- Installing: /usr/local/lib/libflandmark.so.1.5
-- Installing: /usr/local/lib/libflandmark.so.1
-- Installing: /usr/local/lib/libflandmark.so
-- Set runtime path of "/usr/local/lib/libflandmark.so.1.5" to ""
-- Up-to-date: /usr/local/include/msvc-compat.h
-- Up-to-date: /usr/local/include/base64.h
-- Up-to-date: /usr/local/include/CLandmark.h
-- Up-to-date: /usr/local/include/CFeaturePool.h
-- Up-to-date: /usr/local/include/CFeatures.h
-- Up-to-date: /usr/local/include/CAppearanceModel.h
-- Up-to-date: /usr/local/include/CDeformationCost.h
-- Up-to-date: /usr/local/include/CLoss.h
-- Up-to-date: /usr/local/include/CMaxSumSolver.h
-- Up-to-date: /usr/local/include/CXMLInOut.h
-- Up-to-date: /usr/local/include/CTimer.h
-- Up-to-date: /usr/local/include/CTypes.h
-- Installing: /usr/local/include/CLandmarkConfig.h
-- Up-to-date: /usr/local/include/Flandmark.h
-- Up-to-date: /usr/local/include/CSparseLBPFeatures.h
-- Up-to-date: /usr/local/include/CSparseLBPAppearanceModel.h
-- Up-to-date: /usr/local/include/CDisplacementDeformationCost.h
-- Up-to-date: /usr/local/include/CNormalizedEuclideanLoss.h
-- Up-to-date: /usr/local/include/CTableLoss.h
-- Up-to-date: /usr/local/include/CZeroLoss.h
-- Up-to-date: /usr/local/include/CTreeMaxSumSolver.h
-- Installing: /usr/local/share/clandmark/models/flandmark_model.xml
-- Installing: /usr/local/share/clandmark/models/haarcascade_frontalface_alt.xml
-- Installing: /usr/local/share/clandmark/examples/static_input
-- Set runtime path of "/usr/local/share/clandmark/examples/static_input" to ""
-- Installing: /usr/local/share/clandmark/examples/video_input
-- Set runtime path of "/usr/local/share/clandmark/examples/video_input" to ""
$
And when did you forked CLandmark from Github? I made those changes on this Monday.
Btw, I am not sure if CMake is case sensitive in package names, you have
FIND_PACKAGE(CLandmark REQUIRED)
in your CMakeLists.txt file, try to change it to
FIND_PACKAGE(clandmark REQUIRED)
please.
I think independent project too but when I add FIND_PACKAGE(flandmark REQUIRED)
cmake finds flandmarkConfig.cmake
and flandmark-config.cmake
I changed this time I see
CMake Error at CMakeLists.txt:18 (FIND_PACKAGE):
By not providing "Findclandmark.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"clandmark", but CMake did not find one.
Could not find a package configuration file provided by "clandmark" with
any of the following names:
clandmarkConfig.cmake
clandmark-config.cmake
Add the installation prefix of "clandmark" to CMAKE_PREFIX_PATH or set
"clandmark_DIR" to a directory containing one of the above files. If
"clandmark" provides a separate development package or SDK, be sure it has
been installed.
I think, "CL" must be uppercase.
Add also this to the beginning of your CMakeLists.txt
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
And create cmake
in your project folder and copy there files from clandmark/cmake
folder.
I think it should be in lowercase, since the cmake scripts for locating the packages are Findclandmark.cmake
and Findflandmark.cmake
I copied clandmark/cmake
and added.
CMakeList.txt
PROJECT( FaceFuture )
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -std=c++11")
ADD_DEFINITIONS(-D_GLIBCXX_USE_CXX11_ABI=0)
SET(CMAKE_C_FLAGS_DEBUG "-g")
ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET(CMAKE_CXX_COMPILER "/usr/local/bin/g++-6")
SET(CMAKE_C_COMPILER "/usr/local/bin/gcc-6")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -std=c++11")
ADD_DEFINITIONS(-D_GLIBCXX_USE_CXX11_ABI=0)
INCLUDE_DIRECTORIES(/usr/local/Cellar/gcc/6.1.0_1/lib/gcc/6/gcc/x86_64-apple-darwin15.6.0/6.1.0/include/)
# ADD_SUBDIRECTORY(external)
ENDIF()
FIND_PACKAGE(OpenCV REQUIRED)
FIND_PACKAGE(CLandmark REQUIRED)
FIND_PACKAGE(flandmark REQUIRED)
SET (CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,'$ORIGIN/' " )
MESSAGE(using: ${OpenCV_DIR} \n using: ${CLandmark_DIR} \n)
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS} ${CLANDMARK_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/3rd_party/rapidxml-1.13)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/3rd_party/CImg-1.5.6)
ADD_EXECUTABLE( FaceFuture main.cpp)
TARGET_LINK_LIBRARIES( FaceFuture ${FLANDMARK_LIBRARIES} ${CLANDMARK_LIBRARIES} ${OpenCV_LIBS})
option(DOUBLE_PRECISION "Set the default precision used in CLandmark" ON)
# propagate precision definition
if(DOUBLE_PRECISION)
add_definitions( -DDOUBLE_PRECISION=1 )
else(DOUBLE_PRECISION)
add_definitions( -DDOUBLE_PRECISION=0 )
endif(DOUBLE_PRECISION)
Terminal output is
hyuce@LahanaM ~/Desktop/Development/OpenCv_Works/FaceFeature/build $ cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr (found suitable exact version "7.5")
-- Found FLANDMARK: /usr/local/lib/libflandmark.so
using/usr/local/share/OpenCV
using/usr/local/lib/cmake/clandmark
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build
hyuce@LahanaM ~/Desktop/Development/OpenCv_Works/FaceFeature/build $ make
using:/usr/local/share/OpenCV
using:/usr/local/lib/cmake/clandmark
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build
Scanning dependencies of target FaceFuture
[ 50%] Building CXX object CMakeFiles/FaceFuture.dir/main.cpp.o
[100%] Linking CXX executable FaceFuture
CMakeFiles/FaceFuture.dir/main.cpp.o: In function `detectAndDisplay(cv::Mat&, clandmark::Flandmark*, clandmark::CFeaturePool*)':
main.cpp:(.text+0x988): undefined reference to `clandmark::CLandmark::detect_optimized(cimg_library::CImg<unsigned char>*, int*, double*)'
collect2: error: ld returned 1 exit status
CMakeFiles/FaceFuture.dir/build.make:150: recipe for target 'FaceFuture' failed
make[2]: *** [FaceFuture] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/FaceFuture.dir/all' failed
make[1]: *** [CMakeFiles/FaceFuture.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
hyuce@LahanaM ~/Desktop/Development/OpenCv_Works/FaceFeature/build $
So, it is clear, you really need to use
FIND_PACKAGE(clandmark REQUIRED)
because your
FIND_PACKAGE(CLandmark REQUIRED)
was completely ignored by CMake
Absolutely right. All terminal output above.
So, is it working now?
cmake is ok but when I compile with make. does not compile. I see
$ make
using:/usr/local/share/OpenCV
using:/usr/local/lib/cmake/clandmark
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build
Scanning dependencies of target FaceFuture
[ 50%] Building CXX object CMakeFiles/FaceFuture.dir/main.cpp.o
[100%] Linking CXX executable FaceFuture
CMakeFiles/FaceFuture.dir/main.cpp.o: In function `detectAndDisplay(cv::Mat&, clandmark::Flandmark*, clandmark::CFeaturePool*)':
main.cpp:(.text+0x988): undefined reference to `clandmark::CLandmark::detect_optimized(cimg_library::CImg<unsigned char>*, int*, double*)'
collect2: error: ld returned 1 exit status
CMakeFiles/FaceFuture.dir/build.make:150: recipe for target 'FaceFuture' failed
make[2]: *** [FaceFuture] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/FaceFuture.dir/all' failed
make[1]: *** [CMakeFiles/FaceFuture.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
this error line on main.cpp
flandmark->detect_optimized(frm_gray, bbox);
but make says above.
Hmm, that looks suspicious. I don't have time now to continue with this, but I will return to the problem tomorrow.
Try to reconfigure with CMAKE_VERBOSE
set to ON
and post the output here, please.
hyuce@LahanaM ~/Desktop/Development/OpenCv_Works/FaceFeature/build $ make
/usr/bin/cmake -H/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature -B/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build/CMakeFiles /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build'
make -f CMakeFiles/FaceFuture.dir/build.make CMakeFiles/FaceFuture.dir/depend
make[2]: Entering directory '/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build'
cd /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build/CMakeFiles/FaceFuture.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build'
make -f CMakeFiles/FaceFuture.dir/build.make CMakeFiles/FaceFuture.dir/build
make[2]: Entering directory '/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build'
[ 50%] Linking CXX executable FaceFuture
/usr/bin/cmake -E cmake_link_script CMakeFiles/FaceFuture.dir/link.txt --verbose=1
/usr/bin/c++ -fopenmp -std=c++11 -Wl,-rpath,'$ORIGIN/' CMakeFiles/FaceFuture.dir/main.cpp.o -o FaceFuture -rdynamic /usr/local/lib/libflandmark.so /usr/local/lib/libopencv_cudabgsegm.so.3.1.0 /usr/local/lib/libopencv_cudaobjdetect.so.3.1.0 /usr/local/lib/libopencv_cudastereo.so.3.1.0 /usr/local/lib/libopencv_stitching.so.3.1.0 /usr/local/lib/libopencv_superres.so.3.1.0 /usr/local/lib/libopencv_videostab.so.3.1.0 /usr/local/lib/libopencv_aruco.so.3.1.0 /usr/local/lib/libopencv_bgsegm.so.3.1.0 /usr/local/lib/libopencv_bioinspired.so.3.1.0 /usr/local/lib/libopencv_ccalib.so.3.1.0 /usr/local/lib/libopencv_cvv.so.3.1.0 /usr/local/lib/libopencv_dnn.so.3.1.0 /usr/local/lib/libopencv_dpm.so.3.1.0 /usr/local/lib/libopencv_fuzzy.so.3.1.0 /usr/local/lib/libopencv_hdf.so.3.1.0 /usr/local/lib/libopencv_line_descriptor.so.3.1.0 /usr/local/lib/libopencv_optflow.so.3.1.0 /usr/local/lib/libopencv_plot.so.3.1.0 /usr/local/lib/libopencv_reg.so.3.1.0 /usr/local/lib/libopencv_saliency.so.3.1.0 /usr/local/lib/libopencv_stereo.so.3.1.0 /usr/local/lib/libopencv_structured_light.so.3.1.0 /usr/local/lib/libopencv_surface_matching.so.3.1.0 /usr/local/lib/libopencv_tracking.so.3.1.0 /usr/local/lib/libopencv_xfeatures2d.so.3.1.0 /usr/local/lib/libopencv_ximgproc.so.3.1.0 /usr/local/lib/libopencv_xobjdetect.so.3.1.0 /usr/local/lib/libopencv_xphoto.so.3.1.0 /usr/local/lib/libopencv_cudafeatures2d.so.3.1.0 /usr/local/lib/libopencv_shape.so.3.1.0 /usr/local/lib/libopencv_cudacodec.so.3.1.0 /usr/local/lib/libopencv_cudaoptflow.so.3.1.0 /usr/local/lib/libopencv_cudalegacy.so.3.1.0 /usr/local/lib/libopencv_cudawarping.so.3.1.0 /usr/local/lib/libopencv_viz.so.3.1.0 /usr/local/lib/libopencv_rgbd.so.3.1.0 /usr/local/lib/libopencv_calib3d.so.3.1.0 /usr/local/lib/libopencv_video.so.3.1.0 /usr/local/lib/libopencv_datasets.so.3.1.0 /usr/local/lib/libopencv_face.so.3.1.0 /usr/local/lib/libopencv_text.so.3.1.0 /usr/local/lib/libopencv_features2d.so.3.1.0 /usr/local/lib/libopencv_flann.so.3.1.0 /usr/local/lib/libopencv_objdetect.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_photo.so.3.1.0 /usr/local/lib/libopencv_cudaimgproc.so.3.1.0 /usr/local/lib/libopencv_cudafilters.so.3.1.0 /usr/local/lib/libopencv_cudaarithm.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_imgproc.so.3.1.0 /usr/local/lib/libopencv_core.so.3.1.0 /usr/local/lib/libopencv_cudev.so.3.1.0 -Wl,-rpath,/usr/local/lib
CMakeFiles/FaceFuture.dir/main.cpp.o: In function `detectAndDisplay(cv::Mat&, clandmark::Flandmark*, clandmark::CFeaturePool*)':
main.cpp:(.text+0x988): undefined reference to `clandmark::CLandmark::detect_optimized(cimg_library::CImg<unsigned char>*, int*, double*)'
collect2: error: ld returned 1 exit status
CMakeFiles/FaceFuture.dir/build.make:153: recipe for target 'FaceFuture' failed
make[2]: *** [FaceFuture] Error 1
make[2]: Leaving directory '/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build'
CMakeFiles/Makefile2:70: recipe for target 'CMakeFiles/FaceFuture.dir/all' failed
make[1]: *** [CMakeFiles/FaceFuture.dir/all] Error 2
make[1]: Leaving directory '/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build'
Makefile:86: recipe for target 'all' failed
make: *** [all] Error 2
thank you for concern. I am writing a paper. I will calculate face angle.
solved with CMakeList.txt
PROJECT( FaceFuture )
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
set( CMAKE_VERBOSE_MAKEFILE on )
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -std=c++11")
ADD_DEFINITIONS(-D_GLIBCXX_USE_CXX11_ABI=0)
SET(CMAKE_C_FLAGS_DEBUG "-g")
ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET(CMAKE_CXX_COMPILER "/usr/local/bin/g++-6")
SET(CMAKE_C_COMPILER "/usr/local/bin/gcc-6")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -std=c++11")
ADD_DEFINITIONS(-D_GLIBCXX_USE_CXX11_ABI=0)
INCLUDE_DIRECTORIES(/usr/local/Cellar/gcc/6.1.0_1/lib/gcc/6/gcc/x86_64-apple-darwin15.6.0/6.1.0/include/)
# ADD_SUBDIRECTORY(external)
ENDIF()
FIND_PACKAGE(OpenCV REQUIRED)
FIND_PACKAGE(clandmark REQUIRED)
FIND_PACKAGE(flandmark REQUIRED)
SET (CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,'$ORIGIN/' " )
MESSAGE("Modules Path is: ${CMAKE_MODULE_PATH}")
MESSAGE("using: ${OpenCV_DIR} \n using: ${clandmark_DIR} \n")
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS} ${CLANDMARK_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/3rd_party/rapidxml-1.13)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/3rd_party/CImg-1.5.6)
ADD_EXECUTABLE( FaceFuture main.cpp)
TARGET_LINK_LIBRARIES( FaceFuture ${FLANDMARK_LIBRARIES} ${CLANDMARK_LIBRARIES} ${OpenCV_LIBS})
option(DOUBLE_PRECISION "Set the default precision used in CLandmark" ON)
# propagate precision definition
if(DOUBLE_PRECISION)
add_definitions( -DDOUBLE_PRECISION=1 )
else(DOUBLE_PRECISION)
add_definitions( -DDOUBLE_PRECISION=0 )
endif(DOUBLE_PRECISION)
Hi @hyuce,
thanks for the verbose output. It seems there is some problem with libclandmark, since it is not linked. Could you please add the following lines to your CMakeLists.txt
file (just after all find_package lines):
message(STATUS "clandmark: ${CLANDMARK_INCLUDE_DIRS}; ${CLANDMARK_LIBRARIES}")
message(STATUS "flandmark: ${FLANDMARK_INCLUDE_DIRS}; ${FLANDMARK_LIBRARIES}")
and send me the output?
Hi @hyuce,
so, where was the problem in the end?
I replaced clandmark to lowercase and put again cmake folder. It's build. output is
hyuce@LahanaM ~/Desktop/Development/OpenCv_Works/FaceFeature/build $ cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr (found suitable exact version "7.5")
-- Found CLANDMARK: /usr/local/lib/libclandmark.so
-- Found FLANDMARK: /usr/local/lib/libflandmark.so
Modules Path is: /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/cmake/Modules
using: /usr/local/share/OpenCV
using:
-- clandmark: /usr/local/include; /usr/local/lib/libclandmark.so
-- flandmark: /usr/local/include; /usr/local/lib/libflandmark.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build
hyuce@LahanaM ~/Desktop/Development/OpenCv_Works/FaceFeature/build $ make
/usr/bin/cmake -H/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature -B/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build/CMakeFiles /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build'
make -f CMakeFiles/FaceFuture.dir/build.make CMakeFiles/FaceFuture.dir/depend
make[2]: Entering directory '/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build'
cd /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build/CMakeFiles/FaceFuture.dir/DependInfo.cmake --color=
Scanning dependencies of target FaceFuture
make[2]: Leaving directory '/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build'
make -f CMakeFiles/FaceFuture.dir/build.make CMakeFiles/FaceFuture.dir/build
make[2]: Entering directory '/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build'
[ 50%] Building CXX object CMakeFiles/FaceFuture.dir/main.cpp.o
/usr/bin/c++ -DDOUBLE_PRECISION=1 -D_GLIBCXX_USE_CXX11_ABI=0 -isystem /usr/local/include -isystem /usr/local/include/opencv -I/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/3rd_party/rapidxml-1.13 -I/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/3rd_party/CImg-1.5.6 -fopenmp -std=c++11 -o CMakeFiles/FaceFuture.dir/main.cpp.o -c /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/main.cpp
[100%] Linking CXX executable FaceFuture
/usr/bin/cmake -E cmake_link_script CMakeFiles/FaceFuture.dir/link.txt --verbose=1
/usr/bin/c++ -fopenmp -std=c++11 -Wl,-rpath,'$ORIGIN/' CMakeFiles/FaceFuture.dir/main.cpp.o -o FaceFuture -rdynamic /usr/local/lib/libflandmark.so /usr/local/lib/libclandmark.so /usr/local/lib/libopencv_cudabgsegm.so.3.1.0 /usr/local/lib/libopencv_cudaobjdetect.so.3.1.0 /usr/local/lib/libopencv_cudastereo.so.3.1.0 /usr/local/lib/libopencv_stitching.so.3.1.0 /usr/local/lib/libopencv_superres.so.3.1.0 /usr/local/lib/libopencv_videostab.so.3.1.0 /usr/local/lib/libopencv_aruco.so.3.1.0 /usr/local/lib/libopencv_bgsegm.so.3.1.0 /usr/local/lib/libopencv_bioinspired.so.3.1.0 /usr/local/lib/libopencv_ccalib.so.3.1.0 /usr/local/lib/libopencv_cvv.so.3.1.0 /usr/local/lib/libopencv_dnn.so.3.1.0 /usr/local/lib/libopencv_dpm.so.3.1.0 /usr/local/lib/libopencv_fuzzy.so.3.1.0 /usr/local/lib/libopencv_hdf.so.3.1.0 /usr/local/lib/libopencv_line_descriptor.so.3.1.0 /usr/local/lib/libopencv_optflow.so.3.1.0 /usr/local/lib/libopencv_plot.so.3.1.0 /usr/local/lib/libopencv_reg.so.3.1.0 /usr/local/lib/libopencv_saliency.so.3.1.0 /usr/local/lib/libopencv_stereo.so.3.1.0 /usr/local/lib/libopencv_structured_light.so.3.1.0 /usr/local/lib/libopencv_surface_matching.so.3.1.0 /usr/local/lib/libopencv_tracking.so.3.1.0 /usr/local/lib/libopencv_xfeatures2d.so.3.1.0 /usr/local/lib/libopencv_ximgproc.so.3.1.0 /usr/local/lib/libopencv_xobjdetect.so.3.1.0 /usr/local/lib/libopencv_xphoto.so.3.1.0 /usr/local/lib/libopencv_cudafeatures2d.so.3.1.0 /usr/local/lib/libopencv_shape.so.3.1.0 /usr/local/lib/libopencv_cudacodec.so.3.1.0 /usr/local/lib/libopencv_cudaoptflow.so.3.1.0 /usr/local/lib/libopencv_cudalegacy.so.3.1.0 /usr/local/lib/libopencv_cudawarping.so.3.1.0 /usr/local/lib/libopencv_viz.so.3.1.0 /usr/local/lib/libopencv_rgbd.so.3.1.0 /usr/local/lib/libopencv_calib3d.so.3.1.0 /usr/local/lib/libopencv_video.so.3.1.0 /usr/local/lib/libopencv_datasets.so.3.1.0 /usr/local/lib/libopencv_face.so.3.1.0 /usr/local/lib/libopencv_text.so.3.1.0 /usr/local/lib/libopencv_features2d.so.3.1.0 /usr/local/lib/libopencv_flann.so.3.1.0 /usr/local/lib/libopencv_objdetect.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_photo.so.3.1.0 /usr/local/lib/libopencv_cudaimgproc.so.3.1.0 /usr/local/lib/libopencv_cudafilters.so.3.1.0 /usr/local/lib/libopencv_cudaarithm.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_imgproc.so.3.1.0 /usr/local/lib/libopencv_core.so.3.1.0 /usr/local/lib/libopencv_cudev.so.3.1.0 -Wl,-rpath,/usr/local/lib
make[2]: Leaving directory '/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build'
[100%] Built target FaceFuture
make[1]: Leaving directory '/home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build'
/usr/bin/cmake -E cmake_progress_start /home/hyuce/Desktop/Development/OpenCv_Works/FaceFeature/build/CMakeFiles 0
but now I got a Signal: SIGSEGV (Segmentation fault)
Debug screen is
I tried for example that name is static_input.cpp and video_input.cpp
hyuce@LahanaM ~/Desktop/Development/clandmark/examples/build $ cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr (found suitable exact version "7.5")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hyuce/Desktop/Development/clandmark/examples/build
hyuce@LahanaM ~/Desktop/Development/clandmark/examples/build $
its ok but make is output
hyuce@LahanaM ~/Desktop/Development/clandmark/examples/build $ make
Scanning dependencies of target static_input
[ 25%] Building CXX object CMakeFiles/static_input.dir/static_input.cpp.o
[ 50%] Linking CXX executable static_input
/usr/bin/ld: CMakeFiles/static_input.dir/static_input.cpp.o: undefined reference to symbol '_ZN9clandmark12CFeaturePoolD1Ev'
/usr/local/lib/libclandmark.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/static_input.dir/build.make:102: recipe for target 'static_input' failed
make[2]: *** [static_input] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/static_input.dir/all' failed
make[1]: *** [CMakeFiles/static_input.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
Hi @hyuce,
when exactly the SIGSEGV appears?
debug screen-shot above.
if I choose flandmark->detect_optimized
, the SIGSEGV appears in this line.
if I choose flandmark->detect
, in the for loop on the bottom.
Well, the detect_optimized requires you to use the CFeaturePool
. There is no check on this, so it might result in unexpected behavior.
I am confused from the later message which was again about the compilation.
I am writing a C++ code from based example of static_input.cpp My CMakeList.txt like
when I compile I show this error.
This error line contain this code main.cpp