catkin_make builds executable in the wrong directory?
Hello! I have a package I have been able to successfully build using catkin_make after setting up my package.xml and CMakeLists.txt. However, I have one problem. When I run catkin_make, it successfully makes the executable, but places the executable in catkin_ws/build/package_name. For example, I have made a small example below (tbrandom and tbsub are my executables):
may@MooMoo:~/Desktop/Tree/Programming/ros/TurtleBotRandom$ ls
build devel src
may@MooMoo:~/Desktop/Tree/Programming/ros/TurtleBotRandom$ cd build
may@MooMoo:~/Desktop/Tree/Programming/ros/TurtleBotRandom/build$ ls
catkin catkin_make.cache cmake_install.cmake Makefile
catkin_generated CMakeCache.txt CTestTestfile.cmake test_results
CATKIN_IGNORE CMakeFiles gtest turtle_bot_random
may@MooMoo:~/Desktop/Tree/Programming/ros/TurtleBotRandom/build$ cd turtle_bot_random
may@MooMoo:~/Desktop/Tree/Programming/ros/TurtleBotRandom/build/turtle_bot_random$ ls
catkin_generated cmake_install.cmake Makefile tbsub
CMakeFiles CTestTestfile.cmake tbrandom
When I source the devel/setup.bash, and try to run the executable through the package, ROS cannot find the executable unless I copy the executable(s) made (in this example, tbrandom and tbsub) and copy them into Desktop/Tree/Programming/ros/TurtleBotRandom/src/turtle_bot_random
. This is really annoying for bigger projects which require more compile time, and then require me to copy paste files in between to actually start testing to see if my code even works.
What could be the reason or a potential fix? Am I doing something wrong? I've only started toying with catkin last night.
MY CMAKELISTS.TXT FILE: http://www.pastebin.ca/3086592
If you post your CMakeLists.txt file I might be able to tell you what you need to do differently.
+1 to what Dirk said: without your actual
CMakeLists.txt
we can only guess what is going on.I'll take a guess though: was this package migrated from
rosbuild
? I've seen pkgs that forced rosbuild to place binaries in non-standard places. Catkin is different, and those pkgs then break.Hello guys, I have posted a link to a pastebin of my CMakeLists.txt file (it was too long to copy paste into the post). I hope this helps!
Your Cmake ist worng
Declare a cpp executable
you can not bild a Comment
duck-development, if you look at lines 8-12, you will see that I have lines for my builds uncommented. I think you are looking at a line I commented out previously. I think I tried that thinking if I put in the path it would build the executable there, but commented it out when it didn't work.