lucasw / ros_from_src

Build ros from source without using a PPA in a github action. Probably just copy what archlinux is doing. See also https://github.com/ros-o/ros-o
BSD 3-Clause "New" or "Revised" License
102 stars 16 forks source link

rospack can't find anything, causes roscore to not find roslaunch #4

Closed lucasw closed 2 years ago

lucasw commented 2 years ago
root@cb0edb3d2a87:/catkin_ws/src/ros_comm# roscore
WARNING: cannot load logging configuration file, logging is disabled
... logging to /root/.ros/log/76966422-91a6-11ec-b674-0242ac110002/roslaunch-cb0edb3d2a87-248.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

Resource not found: roslaunch
ROS path [0]=/catkin_ws/src/ros/core/rosbuild
The traceback for the exception was written to the log file
Traceback (most recent call last):
  File "<string>", line 348, in main
  File "/catkin_ws/src/ros_comm/tools/roslaunch/src/roslaunch/parent.py", line 305, in start
    self._start_infrastructure()
  File "/catkin_ws/src/ros_comm/tools/roslaunch/src/roslaunch/parent.py", line 254, in _start_infrastructure
    self._load_config()
  File "/catkin_ws/src/ros_comm/tools/roslaunch/src/roslaunch/parent.py", line 156, in _load_config
    self.config = roslaunch.config.load_config_default(self.roslaunch_files, self.port,
  File "/catkin_ws/src/ros_comm/tools/roslaunch/src/roslaunch/config.py", line 451, in load_config_default
    load_roscore(loader, config, verbose=verbose)
  File "/catkin_ws/src/ros_comm/tools/roslaunch/src/roslaunch/config.py", line 92, in load_roscore
    f_roscore = get_roscore_filename()
  File "/catkin_ws/src/ros_comm/tools/roslaunch/src/roslaunch/config.py", line 84, in get_roscore_filename
    return os.path.join(r.get_path('roslaunch'), 'resources', 'roscore.xml')
  File "/opt/ros/noetic/lib/python3.9/site-packages/rospkg/rospack.py", line 207, in get_path
    raise ResourceNotFound(name, ros_paths=self._ros_paths)

Same as https://github.com/lucasw/ros_from_src/issues/3#issuecomment-945204527 but duplicated in 22.04 docker container

rospack list is blank

rospack list

ROS_PACKAGE_PATH is also empty, even after running devel/setup.sh

lucasw commented 2 years ago

Need to install rosdep

lucasw commented 2 years ago

Building catkin isn't putting setup.bash in /opt/ros/noetic/setup.bash.

Try building it outside of docker, on 20.04

cd ~/own/build/catkin
cmake ../../src/ros_from_src/catkin_ws/src/catkin/ -DCATKIN_BUILD_BINARY_PACKAGE=ON -DCMAKE_INSTALL_PREFIX=../catkin_install -DPYTHON_EXECUTABLE=/usr/bin/python -DSETUPTOOLS_DEB_LAYOUT=OFF && make && make install

It didn't do anything with the setup.bash.in and related files either,

Try manually creating them, replace @SETUP_DIR@ with /opt/ros/noetic

diff /opt/ros/noetic/setup.sh /opt/ros/noetic/share/catkin/cmake/templates/setup.sh.in 
14c14
< : ${_CATKIN_SETUP_DIR:=/opt/ros/noetic}
---
> : ${_CATKIN_SETUP_DIR:=@SETUP_DIR@}

Also need _setup_util.py - that should easier to search for also to see what cmake command generates it

-> cmake/catkin_generate_environment.cmake?

All the files are being generated, it's just they are going to build/catkin/catkin_generated/installspace and not getting copied to /opt/ros/noetic

lucasw commented 2 years ago

CATKIN_INSTALL_INTO_PREFIX_ROOT is what I'm looking for:

  foreach(shell ${CATKIN_SETUP_SHELL})
    configure_file(${catkin_EXTRAS_DIR}/templates/setup.${shell}.in
      ${CMAKE_BINARY_DIR}/catkin_generated/installspace/setup.${shell}
      @ONLY)
    configure_file(${catkin_EXTRAS_DIR}/templates/local_setup.${shell}.in
      ${CMAKE_BINARY_DIR}/catkin_generated/installspace/local_setup.${shell}
      @ONLY)
    if(CATKIN_INSTALL_INTO_PREFIX_ROOT)
      install(FILES
        ${CMAKE_BINARY_DIR}/catkin_generated/installspace/setup.${shell}
        ${CMAKE_BINARY_DIR}/catkin_generated/installspace/local_setup.${shell}
        DESTINATION ${CMAKE_INSTALL_PREFIX})
    endif()
  endforeach(

Now the setup files are going in, but setup.bash doesn't result in anything in ROS_PACKAGE_PATH -> that is done later in ros environment, so don't source setup.bash until after that.

lucasw commented 2 years ago

Now rospack isn't getting install, or library locations aren't on the path:

rospack: error while loading shared libraries: librospack.so: cannot open shared object file: No such file or directory
The command '/bin/sh -c rospack list' returned a non-zero code: 127

Sourcing setup.bash fixes that, now make roscore work