Ask Your Question
0

'no rule to make target' erorr while building catkin package (ROS)

asked 2017-10-05 03:55:25 -0600

sudhir gravatar image

Hello all, I am trying to use lua in a ros package named gazebo_test but not able to link lua library to package. While building package with catkin_make 'no rule to make target error' is occurring. I have searched for it, but nothing helped. As given in most answers I have checked for file in the path its there but still not able to build.

Follwing is my CMakeLists.txt file

cmake_minimum_required(VERSION 2.8.3)
project(gazebo_test)

add_compile_options(-std=c++11)

set(LUA_INCLUDE_DIR /usr/include/lua5.2)
set(LUA_LIBRARY /usr/lib/x86_64-linux-gnu/liblua5.2.so)

find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs gazebo_ros gazebo_msgs tf sensor_msgs image_transport cv_bridge)

find_package(gazebo REQUIRED)

catkin_package(DEPENDS roscpp gazebo_ros)

include_directories(${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIR} ${GAZEBO_INCLUDE_DIRS} ${LUA_INCLUDE_DIR})

link_directories(${GAZEBO_LIBRARY_DIRS}) add_executable(deepQ_test_script src/deepQ_test_script.cpp)

target_link_libraries (deepQ_test_script ${LUA_LIBRARY})

following ERROR is occuring

make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/liblua5.2.so', needed by '/home/sudhir/ros_ws/devel/lib/gazebo_test/deepQ_test_script'.

I have attempted following things already

  • Checked properly that path of liblua5.2.so is correct and file is present there.
  • I have tried to copy header files and .so files to package's include and libs directory and then updated paths in CMakeLists.txt using ${PROJECT_SOURCE_DIR} but still same error.
  • Added path of .so file to PKG_CONFIG_PATH variable

following were outputs of pkg-config commands

$ pkg-config --libs lua5.2
-llua5.2
$ pkg-config --cflags lua5.2
-I/usr/include/lua5.2

Still error is same. Please Help. Thanks in advance. Any help would be appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2017-10-05 09:54:45 -0600

Assuming your machine has a FindLua.cmake file, you are probably better off using find_package to find Lua, and then using the Lua variables created for you.

For some reason, if you need to manually set the library path, you are likely better off adding /usr/lib/x86_64-linux-gnu/ to your link_directories (it might already be there), and then target_link_libraries(deepQ_test_script lua). CMake (and the gcc linker under the hood) will automatically search for libraries by prepending "lib" and appending ".so".

edit flag offensive delete link more

Comments

Thanks for replying. I tried to search for file FindLua.cmake on my system but it wasn't present. Also I added line find_package(lua required) to my CMakeLists.txt and target_link_libraries(deepQ_test_script lua) but it gave error of not finding FindLua.cmake in CMAKE_MODULE_PATH. Please Help.

sudhir gravatar image sudhir  ( 2017-10-06 13:51:36 -0600 )edit

Very much thanks for your reply. I finally able to link lua. I used find_package(Lua required) and target_link_libraries(deepQ_test_script lua5.2) and it worked. Thank you so much.

sudhir gravatar image sudhir  ( 2017-10-06 14:00:08 -0600 )edit

Glad to hear it worked!

jarvisschultz gravatar image jarvisschultz  ( 2017-10-06 15:49:38 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-10-05 03:55:25 -0600

Seen: 1,778 times

Last updated: Oct 05 '17