0
$\begingroup$

Rosanswers logo

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.


Originally posted by sudhir on ROS Answers with karma: 1 on 2017-10-05

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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".


Originally posted by jarvisschultz with karma: 9031 on 2017-10-05

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by sudhir on 2017-10-06:
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.

Comment by sudhir on 2017-10-06:
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.

Comment by jarvisschultz on 2017-10-06:
Glad to hear it worked!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.