m2-farzan / ros2-foxy-PKGBUILD

AUR Package for ROS 2 Foxy
1 stars 1 forks source link

Residue of build directory in installed files #5

Open m2-farzan opened 3 years ago

m2-farzan commented 3 years ago

Reproduction steps:

$ cd /opt/ros2/foxy
$ grep -R "/home/"
setup.sh:_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX=/home/mostafa/dev/ros2-pkgbuild/src/install
share/diagnostic_msgs/package.sh:_colcon_package_sh_COLCON_CURRENT_PREFIX="/home/mostafa/dev/ros2-pkgbuild/src/install"
share/diagnostic_msgs/local_setup.sh:: ${AMENT_CURRENT_PREFIX:="/home/mostafa/dev/ros2-pkgbuild/src/install"}
share/unique_identifier_msgs/package.sh:_colcon_package_sh_COLCON_CURRENT_PREFIX="/home/mostafa/dev/ros2-pkgbuild/src/install"
share/unique_identifier_msgs/local_setup.sh:: ${AMENT_CURRENT_PREFIX:="/home/mostafa/dev/ros2-pkgbuild/src/install"}
.......

Where /home/mostafa/dev/ros2-pkgbuild is the directory in which I ran makepkg. These should be replaced with the new installation path. This becomes serious when user cleans build cache or moves it, where this causes the ROS installation to break.

The solution would either be using colcon arguments to correct this, or less ideally, use sed to match/replace.

I'll work on it. For now, avoid deleting or moving install cache to avoid breaking your ROS 2 installation.

The same problem exists for ros2-git package.

m2-farzan commented 2 years ago

Install location can be changed with --install-base flag in colcon but it's not practical to use the actual /opt/ros2/foxy path in build time.

This is more complicated than I thought. I could really use some help.

There are some references to build directory that can be worked around:

  1. cpp debug info: the source paths that will be shown in errors. They don't cause any problems, and I think it's better not to change them. Anyway, they can be changed at compile time using gcc flag -fdebug-prefix-map.
  2. pycache files store some paths. We can just delete them all.
  3. The setup.bash scripts and other files generated by colcon reference build path which can be easily fixed using sed.

But there are some other hardcoded paths that are harder to fix. Some of them refer to build path (not install path), which we aren't even packing. It seems that only rviz_ packages have this problem.

I'm pushing some ideas to fix-path branch of the galactic repo for now.

m2-farzan commented 2 years ago

Might be related: https://github.com/ament/ament_cmake/issues/173