Home › Forum › SOFA › Building SOFA › [SOLVED] Error with CImg: plugin with dependency to skeleton.h does not compile
Tagged: 64_bits, GCC, Linux_mint, SOFA_1608
- This topic has 3 replies, 2 voices, and was last updated 7 years, 11 months ago by jnbrunet.
-
AuthorPosts
-
13 January 2017 at 23:36 #8391RosalieBlocked
Hi !
I tried to compile a private plugin which requires the Image plugin of Sofa and I get the following error :
p0086679@chum44232 ~/bezierskelet/build $ make -j7 Scanning dependencies of target SofaBezierSkeletonization [ 28%] Building CXX object CMakeFiles/SofaBezierSkeletonization.dir/src/BezierHelper.cpp.o [ 28%] Building CXX object CMakeFiles/SofaBezierSkeletonization.dir/src/BezierCubic.cpp.o [ 42%] Building CXX object CMakeFiles/SofaBezierSkeletonization.dir/src/BezierSegment.cpp.o [ 57%] Building CXX object CMakeFiles/SofaBezierSkeletonization.dir/src/initBezierSkelet.cpp.o [ 71%] Building CXX object CMakeFiles/SofaBezierSkeletonization.dir/src/VesselMapToSkeleton.cpp.o [ 85%] Building CXX object CMakeFiles/SofaBezierSkeletonization.dir/src/BezierSegmentTree.cpp.o In file included from /home/p0086679/sofa/v16.08/build/install/include/CImg/SOFACImg.h:33:0, from /home/p0086679/sofa/v16.08/build/install/include/image/ImageTypes.h:34, from /home/p0086679/bezierskelet/src/VesselMapToSkeleton.h:52, from /home/p0086679/bezierskelet/src/VesselMapToSkeleton.inl:8, from /home/p0086679/bezierskelet/src/VesselMapToSkeleton.cpp:27: /home/p0086679/sofa/v16.08/build/install/include/CImg/CImg.h:9341:21: fatal error: plugins/skeleton.h: No such file or directory compilation terminated. CMakeFiles/SofaBezierSkeletonization.dir/build.make:182: recipe for target 'CMakeFiles/SofaBezierSkeletonization.dir/src/VesselMapToSkeleton.cpp.o' failed make[2]: *** [CMakeFiles/SofaBezierSkeletonization.dir/src/VesselMapToSkeleton.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/SofaBezierSkeletonization.dir/all' failed make[1]: *** [CMakeFiles/SofaBezierSkeletonization.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2
My compiler is GCC (gcc (Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0 20160609)
I looked at the directory
/home/p0086679/sofa/v16.08/build/install/include/CImg
and I found that the file skeleton.h was not inside/home/p0086679/sofa/v16.08/build/install/include/CImg/plugin
but directly in/home/p0086679/sofa/v16.08/build/install/include/CImg
So I tried to fix the problem by modifying the file
/home/p0086679/sofa/v16.08/build/install/include/CImg/SOFACImg.h
:I remplaced
#define cimg_plugin "plugin/skeleton.h"
by
#define cimg_plugin "skeleton.h"
This solved the compilation problem of the SofaBezierSkeletonization plugin.
However, changing a file in the install directory seemed weird to me and so I tried to change the file
/home/p0086679/sofa/v16.08/src/extlibs/CImg/SOFACImg.h
in the same way.But then, of course, the Image plugin does not compile:
[ 90%] Building CXX object applications/plugins/image/CMakeFiles/image.dir/CollisionToCarvingEngine.cpp.o In file included from /home/p0086679/sofa/v16.08/src/extlibs/CImg/../CImg/SOFACImg.h:33:0, from /home/p0086679/sofa/v16.08/src/applications/plugins/image/ImageTypes.h:34, from /home/p0086679/sofa/v16.08/src/applications/plugins/image/CollisionToCarvingEngine.h:26, from /home/p0086679/sofa/v16.08/src/applications/plugins/image/CollisionToCarvingEngine.cpp:24: /home/p0086679/sofa/v16.08/src/extlibs/CImg/../CImg/CImg.h:9341:21: fatal error: skeleton.h: No such file or directory compilation terminated. applications/plugins/image/CMakeFiles/image.dir/build.make:62: recipe for target 'applications/plugins/image/CMakeFiles/image.dir/CollisionToCarvingEngine.cpp.o' failed make[2]: *** [applications/plugins/image/CMakeFiles/image.dir/CollisionToCarvingEngine.cpp.o] Error 1 CMakeFiles/Makefile2:9550: recipe for target 'applications/plugins/image/CMakeFiles/image.dir/all' failed make[1]: *** [applications/plugins/image/CMakeFiles/image.dir/all] Error 2 Makefile:160: recipe for target 'all' failed make: *** [all] Error 2
I know that the plugin owner does not have this problem (neither on ubuntu nor on mac OS), so I guess I am missing something here.
P.S.: I also had a problem with this plugin dependencies (and again the plugin owner does not have this problem). I had to add SofaPhyton as a required dependency because if I did not do so I get the following error:
CMake Error at CMakeLists.txt:11 (find_package): Found package configuration file: /home/p0086679/sofa/master/newbuild/install/lib/cmake/image/imageConfig.cmake but it set image_FOUND to FALSE so package "image" is considered to be NOT FOUND. Reason given by package: The following imported targets are referenced, but are missing: SofaPython
and I know that the image plugin does not require sofaPython (find_package(SofaPython QUIET))
Here is the CMakeList.txt of the plugin without my modification:
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) project(SofaBezierSkeletonization) set(BEZIERSKELET_MAJOR_VERSION 0) set(BEZIERSKELET_MINOR_VERSION 1) set(BEZIERSKELET_VERSION ${BEZIERSKELET_MAJOR_VERSION}.${BEZIERSKELET_MINOR_VERSION}) find_package(SofaFramework REQUIRED) find_package(SofaBase REQUIRED) find_package(SofaGeneral REQUIRED) find_package(image REQUIRED) set(GENERAL_DEPENDENCIES SofaComponentBase SofaComponentGeneral SofaCore SofaLoader ) set(GENERAL_COMP_FLAGS "-DSOFA_BUILD_BEZIERSKELET" ) set(HEADER_FILES src/initBezierSkelet.h src/BezierHelper.h src/BezierCubic.h src/BezierSegment.h src/BezierSegmentTree.h src/BezierSegmentTree.inl src/BezierSkeletonization.h ) set(SOURCE_FILES src/initBezierSkelet.cpp src/BezierHelper.cpp src/BezierCubic.cpp src/BezierSegment.cpp src/BezierSegmentTree.cpp ) set(README_FILE readme.txt ) set (DIJKSTRA_CENTERLINES "0" CACHE BOOL "Set to activate compilation of the centerlines extraction using the minimum spanning Dijkstra tree") if (DIJKSTRA_CENTERLINES) message(STATUS "Activating Dijkstra centerline extraction, requires image plugin") find_package(image REQUIRED) set(CENTERLINE_DEPENDENCIES image) list(APPEND HEADER_FILES src/VesselMapToSkeleton.h src/VesselMapToSkeleton.inl ) list(APPEND SOURCE_FILES src/VesselMapToSkeleton.cpp ) endif() add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${README_FILES} ) set_target_properties(${PROJECT_NAME} PROPERTIES VERSION "${BEZIERSKELET_VERSION}") set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${GENERAL_COMP_FLAGS}") set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${HEADER_FILES}") target_link_libraries(${PROJECT_NAME} ${GENERAL_DEPENDENCIES} ${CENTERLINE_DEPENDENCIES}) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src") target_compile_features(${PROJECT_NAME} PRIVATE cxx_range_for) target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>") target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>") install(TARGETS SofaBezierSkeletonization EXPORT SofaBezierSkeletonization RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib PUBLIC_HEADER DESTINATION include/SVSTK)
16 January 2017 at 14:24 #8394jnbrunetModeratorHi Rosalie!
My guess would be at the difference between your CMake version and the plugin’s owner.
It seems that in your case, the install command of the image/extlibs/CImg/CMakeLists.txt does not preserve the file’s directory hierarchy.
Can you try changing image/extlibs/CImg/CMakeLists.txt :
install(FILES CImg.h SOFACImg.h plugins/add_fileformat.h plugins/chlpca.h plugins/draw_gradient.h plugins/ipl_alt.h plugins/jpeg_buffer.h plugins/matlab.h plugins/patchmatch.h plugins/tiff_stream.h plugins/vrml.h plugins/bayer.h plugins/cvMat.h plugins/inpaint.h plugins/ipl.h plugins/loop_macros.h plugins/nlmeans.h plugins/skeleton.h plugins/tinymatwriter.h plugins/vtk.h DESTINATION include/CImg COMPONENT CImg_headers)
To:
install(FILES CImg.h SOFACImg.h DESTINATION include/CImg COMPONENT CImg_headers) install(DIRECTORY plugins DESTINATION include/CImg COMPONENT CImg_headers)
And try again the compilation and the install?
Edit: Actually, you could only run the install command in your sofa’s build directory after the modification, no need to relauch the compilation.
16 January 2017 at 18:56 #8397RosalieBlockedHi Jean Nicolas !
Thanks for your help ! It works perfectly fine now.
Do you think the difference in the CMake version could also be responsible for the second problem (set image_FOUND to FALSE because SofaPython is not found)?
Rosalie
17 January 2017 at 20:48 #8398jnbrunetModeratorHi Rosalie!
For the Python problem:
Issue: https://github.com/sofa-framework/sofa/issues/135
PR : https://github.com/sofa-framework/sofa/pull/137For the image’s headers installation path
Issue: https://github.com/sofa-framework/sofa/issues/136
PR : https://github.com/sofa-framework/sofa/pull/138Jean-Nico
-
AuthorPosts
- You must be logged in to reply to this topic.