Compilation problem with CMake
Hi there! I am just trying to compile some sources using CMake, but I get error:
make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libGL.so', needed by '/home/neboron/robo_ws/devel/lib/ami_1/gl_1'. Stop.
CMakeFiles/Makefile2:509: recipe for target 'ami_1/CMakeFiles/gl_1.dir/all' failed
make[1]: *** [ami_1/CMakeFiles/gl_1.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 0%] Built target std_msgs_generate_messages_cpp
[ 0%] Built target std_msgs_generate_messages_py
[ 0%] Built target std_msgs_generate_messages_nodejs
[ 0%] Built target std_msgs_generate_messages_eus
[ 0%] Built target std_msgs_generate_messages_lisp
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed
As I understand its a problem with errors in CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.3)
project(ami_1)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
message_generation
gazebo_ros
)
#GLFW#
#=============================================================#
if(NOT NO_GLFW_X11)
set(GLFW_X11_INCLUDE_DIRS
"/usr/X11R6/include"
"/usr/include/X11"
)
set(GLFW_X11_LIB_DIRS
"/usr/X11R6/lib"
)
else()
set(GLFW_X11_INCLUDE_DIRS "")
set(GLFW_X11_LIB_DIRS "")
endif()
find_path( GLFW_INCLUDE_DIR
NAMES
GLFW/glfw3.h
HINTS
"${GLFW_LOCATION}/include"
"$ENV{GLFW_LOCATION}/include"
PATHS
"$ENV{PROGRAMFILES}/GLFW/include"
"${OPENGL_INCLUDE_DIR}"
/usr/openwin/share/include
/usr/openwin/include
"${GLFW_X11_INCLUDE_DIRS}"
/opt/graphics/OpenGL/include
/opt/graphics/OpenGL/contrib/libglfw
/usr/local/include
/usr/include/GL
/usr/include
DOC
"The directory where GLFW/glfw3.h resides"
)
#
# XXX: Do we still need to search for GL/glfw.h?
#
find_path( GLFW_INCLUDE_DIR
NAMES
GL/glfw.h
HINTS
"${GLFW_LOCATION}/include"
"$ENV{GLFW_LOCATION}/include"
PATHS
"$ENV{PROGRAMFILES}/GLFW/include"
"${OPENGL_INCLUDE_DIR}"
/usr/openwin/share/include
/usr/openwin/include
"${GLFW_X11_INCLUDE_DIRS}"
/opt/graphics/OpenGL/include
/opt/graphics/OpenGL/contrib/libglfw
/usr/local/include
/usr/include/GL
/usr/include
DOC
"The directory where GL/glfw.h resides"
)
if (WIN32)
if(CYGWIN)
find_library( GLFW_glfw_LIBRARY
NAMES
glfw32
HINTS
"${GLFW_LOCATION}/lib"
"${GLFW_LOCATION}/lib/x64"
"$ENV{GLFW_LOCATION}/lib"
PATHS
"${OPENGL_LIBRARY_DIR}"
/usr/lib
/usr/lib/w32api
/usr/local/lib
"${GLFW_X11_LIB_DIRS}"
DOC
"The GLFW library"
)
else()
find_library( GLFW_glfw_LIBRARY
NAMES
glfw32
glfw32s
glfw
glfw3
HINTS
"${GLFW_LOCATION}/lib"
"${GLFW_LOCATION}/lib/x64"
"${GLFW_LOCATION}/lib-msvc110"
"${GLFW_LOCATION}/lib-vc2012"
"$ENV{GLFW_LOCATION}/lib"
"$ENV{GLFW_LOCATION}/lib/x64"
"$ENV{GLFW_LOCATION}/lib-msvc110"
"$ENV{GLFW_LOCATION}/lib-vc2012"
PATHS
"$ENV{PROGRAMFILES}/GLFW/lib"
"${OPENGL_LIBRARY_DIR}"
DOC
"The GLFW library"
)
endif()
else ()
if (APPLE)
find_library( GLFW_glfw_LIBRARY glfw
NAMES
glfw
glfw3
HINTS
"${GLFW_LOCATION}/lib"
"${GLFW_LOCATION}/lib/cocoa"
"$ENV{GLFW_LOCATION}/lib"
"$ENV{GLFW_LOCATION}/lib/cocoa"
PATHS
/usr/local/lib
)
set(GLFW_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
set(GLFW_corevideo_LIBRARY "-framework CoreVideo" CACHE STRING "CoreVideo framework for OSX")
set(GLFW_iokit_LIBRARY "-framework IOKit" CACHE STRING "IOKit framework for OSX")
else ()
# (*)NIX
find_package(Threads REQUIRED)
if(NOT NO_GLFW_X11)
find_package(X11 REQUIRED)
if(NOT X11_Xrandr_FOUND)
message(FATAL_ERROR "Xrandr library not found - required for GLFW")
endif()
if(NOT X11_xf86vmode_FOUND)
message(FATAL_ERROR "xf86vmode library not found - required for GLFW")
endif()
if(NOT X11_Xcursor_FOUND)
message(FATAL_ERROR "Xcursor library not found - required for GLFW")
endif()
if(NOT X11_Xinerama_FOUND)
message(FATAL_ERROR "Xinerama library not found - required for GLFW")
endif()
if(NOT X11_Xi_FOUND)
message(FATAL_ERROR "Xi library not found - required for GLFW")
endif()
list(APPEND GLFW_x11_LIBRARY "${X11_Xrandr_LIB}" "${X11_Xxf86vm_LIB}" "${X11_Xcursor_LIB}" "${X11_Xinerama_LIB}" "${X11_Xi_LIB}" "${X11_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}" -lrt -ldl)
endif (NOT NO_GLFW_X11)
find_library( GLFW_glfw_LIBRARY
NAMES
glfw
glfw3
HINTS
"${GLFW_LOCATION}/lib"
"$ENV{GLFW_LOCATION}/lib"
"${GLFW_LOCATION}/lib/x11"
"$ENV ...
That's a relatively complex
CMakeLists.txt
and you don't show us the actual error (what you show is just the end which tells us that something went wrong).I would suggest to post the error message itself and to cleanup your
CMakeLists.txt
-- there are a lot of boilerplate comments in it.I removed some unnecassary comments, but the error log is really not informative.
It is actually. This:
tells us that either that file doesn't exist, or CMake cannot figure out how to link against it. I would guess the former is true.
My guess would be that there is a problem / something not quite right in the enormous amount of lines dealing with X11/OpenGL detection.
As-is, that would not seem to be a Catkin problem, but a CMake one.
If you remove everything ROS / Catkin, I would expect you to have the same problem. If so, you'd have to fix that first, and only then start adding Catkin statements.