zstd_vendor breaks CMake when cross-compiling for QNX #1172
Open
Description
Description
- When cross-compiling
rosbag2
for x86_64 QNX,zstd_vendor
will download and compilelibzstd.so
, then copy it to the install directory.libzstd.so
is a dependency of the CMake executable on the host, so on the nextcmake
invocation, the runtime linker finds the QNX version oflibzstd.so
, causingcmake
to fail - The root cause is that
colcon
invokesLD_LIBRARY_PATH=/path/to/workspace/install/lib:$LD_LIBRARY_PATH cmake ...
in order to make other packages' resources available to the current package; however, this has the side effect of also changing theLD_LIBRARY_PATH
for the host's CMake.
Expected Behavior
- Compiling
libzstd.so
for x86_64 QNX does not interfere with thelibzstd.so
needed by thecmake
on the host.
Actual Behavior
zstd
is not found for x86_64 QNXzstd_vendor
downloads, compiles, and installslibzstd.so
in the workspace's install directorycmake
is invoked for another package, finding the newlibzstd.so
- Since
libzstd.so
is compiled for QNX (and not Linux),cmake
fails to run
To Reproduce
- Follow the instructions in https://ros2-qnx-documentation.readthedocs.io/en/galactic/build_from_source.html to compile ROS2 for QNX, except:
- In "Building Steps - 5", use
CPU=x86_64
- Modify
build-ros2.sh
to invokecolcon
twice, the first time with--packages-up-to zstd_vendor
, the second time with--packages-select gmock_vendor
: i.e.
build () { ... colcon build ... ... --packages-up-to zstd_vendor \ --cmake-args \ .... colcon build ... ... --packages-up-to gmock_vendor \ --cmake-args \ .... ... }
- In "Building Steps - 5", use
- The second
colcon
command fails with something like:/usr/bin/cmake: error while loading shared libraries: libregex.so.1: cannot open shared object file: No such file or directory
(Side note: The instructions for compiling ROS2 for QNX are broken in other ways, but it was easier to point to those instructions than to explain here all the other changes that are not related to this bug report)
System
- Host OS/Arch: Linux x86_64
- Target OS/Arch: QNX 7.1 x86_64
- ROS 2 Distro: Galactic, Humble
- Version: See https://ros2-qnx-documentation.readthedocs.io/en/galactic/build_from_source.html
Additional context
- I imagine the fix is to follow a similar scheme to
yaml_cpp_vendor
where the libraries are installed elsewhere, and the_vendor
package makes them available