Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross compilation fails on cyclonedds #26

Open
sgvandijk opened this issue Mar 18, 2021 · 6 comments
Open

Cross compilation fails on cyclonedds #26

sgvandijk opened this issue Mar 18, 2021 · 6 comments

Comments

@sgvandijk
Copy link
Contributor

sgvandijk commented Mar 18, 2021

I use your cross-compilation setup to build ROS 2 for my RPi Zero (on its own without an E-Puck) after seeing ros-tooling/cross_compile#69 (comment). Thanks for this, it is a better solution than the current state of ros_cross_compile!

However, when following the cross-compilation instructions here, the cross-colcon-build command fails when trying to build the cyclonedds package with the following:

--- stderr: cyclonedds                                                                         
Starting >>> cyclonedds
--- stderr: cyclonedds
You have called ADD_LIBRARY for library ddsc without any source files. This typically indicates a problem with your CMakeLists.txt file
/opt/cross-pi-gcc/lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: warning: libssl.so.1.1, needed by ../../../lib/libddsc.so.0.7.0, not found (try using -rpath or -rpath-link)
/opt/cross-pi-gcc/lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: warning: libcrypto.so.1.1, needed by ../../../lib/libddsc.so.0.7.0, not found (try using -rpath or -rpath-link)
/opt/cross-pi-gcc/lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../../lib/libddsc.so.0.7.0: undefined reference to `X509_STORE_CTX_get_current_cert@OPENSSL_1_1_0'
...

followed by a further list of undefined references.

I used sshfs to mount the rootfs, both libssl.so.1.1 and libcrypto.so.1.1 are there under /home/develop/rootfs/lib/arm-linux-gnueabihf, so I'm not sure why they can't be found. Probably the ADD_LIBRARY warning has something to do with it, but I couldn't immediately figure out where that comes from.

As a workaround, for now I have just disabled building this package with:

touch src/eclipse-cyclonedds/COLCON_IGNORE

with which cross-colcon-build finishes successfully.

@lukicdarkoo
Copy link
Member

lukicdarkoo commented Mar 19, 2021

Thanks for this, it is a better solution than the current state of ros_cross_compile!

I wanted to merge this solution to the ros_cross_compile, but I didn't find time to adapt everything. It would be nice merging this to the ros_cross_compile.

I used sshfs to mount the rootfs, both libssl.so.1.1 and libcrypto.so.1.1 are there under /home/develop/rootfs/lib/arm-linux-gnueabihf

The sshfs may fail to deliver resources sometimes. In that case, simply running it again should solve the problem.

Have you tried installing those libraries on the Raspberry Pi (maybe sudo apt install libssl-dev libcrypto++-dev )?

Another possibility is linking those libraries directly in:
https://github.com/cyberbotics/epuck_ros2/blob/master/installation/cross_compile/toolchain.cmake

Or try with -rpath as suggested in the error, but that will probably break other stuff.

Galactic is around the corner with CycloneDDS as a default middleware, so we should be prepared :)

As a workaround, for now I have just disabled building this package with:

touch src/eclipse-cyclonedds/COLCON_IGNORE

Thank you for pointing on the workaround! I am sure it will be useful to other users.

@kaorusha
Copy link

kaorusha commented Jul 8, 2021

Thank you for the instruction, however, some package also build fail(one of them is libcurl_vendor), and I can't figure out what is path_to_pi_puck_image.img in this repo. So currently stuck here.
Target OS: Raspbian GNU/Linux 10 (buster)
my command

cross-colcon-build --skip-packages "console_bridge fastcdr fastrtps rti-connext-dds-5.3.1"

@asherikov
Copy link

This is a transitive library dependency -> libssl.so.1.1, needed by ../../../lib/libddsc.so.0.7.0, -L has no effect in this case, see man ld on -rpath-link, fixable with proper -rpath-link parameters.

@lukicdarkoo
Copy link
Member

@asherikov Could you please make a PR about this?

@asherikov
Copy link

Sorry, no, just passing by.

@SanderVanDijk-StreetDrone

I have come back to this recently. I haven't been able to find the right incantation to add -rpath-link in the correct place yet, but the following change is another workaround with which the cyclone-dds package does build, but without SSL support:

--- a/installation/cross_compile/bashrc.sh
+++ b/installation/cross_compile/bashrc.sh  
@@ -20,7 +20,8 @@ cross-colcon-build() {
         -DCMAKE_TOOLCHAIN_FILE=/home/develop/toolchain.cmake \
         -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
         -DTHIRDPARTY=ON \
-        -DBUILD_TESTING:BOOL=OFF
+        -DBUILD_TESTING:BOOL=OFF \
+        -DENABLE_SSL=OFF
 }

It now fails on foonathan_memory_vendor requiring a version of CMake that is too new, but that's separate from this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants