Skip to content

Commit

Permalink
mavros: also compile with arm, mips & ppc (resolves #525)
Browse files Browse the repository at this point in the history
  • Loading branch information
bulwahn committed Sep 5, 2017
1 parent 5d71cc0 commit 25d97e4
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
From 658347978fc97675dbdff480f4557eb772e915dc Mon Sep 17 00:00:00 2001
From: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Date: Mon, 4 Sep 2017 16:17:12 +0100
Subject: [PATCH] CMake: explicitly link the atomic library (#797)

For arm & mips architecture, the linker must explicitly be asked to
link the atomic library (with `-latomic`).

Otherwise, the linking fails with:

```
| devel/lib/libmavros.so: undefined reference to `__atomic_load_8'
| devel/lib/libmavros.so: undefined reference to `__atomic_store_8'
| collect2: error: ld returned 1 exit status
```

Linking `atomic` unconditionally as library is strictly needed only
for arm & mips, but it seems not to imply any further differences
with other architectures. Hence, this commit simply adds `atomic`
unconditionally for a uniform handling of all machine architectures.

This is an alternative solution to the proposed solution in #790.

The issue was discovered cross-compiling mavros in meta-ros, the
OpenEmbedded layer for ROS. Some further pointers are available at:

https://github.com/bmwcarit/meta-ros/issues/525

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>

Upstream-Status: Accepted [https://github.com/mavlink/mavros/commit/658347978fc97675dbdff480f4557eb772e915dc]

This patch has been generated with:
`git format-patch -1 658347978fc97675dbdff480f4557eb772e915dc`
in the mavros repository.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
mavros/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/mavros/CMakeLists.txt b/mavros/CMakeLists.txt
index a4ac3cb..5233e96 100644
--- a/mavros/CMakeLists.txt
+++ b/mavros/CMakeLists.txt
@@ -102,6 +102,7 @@ add_library(mavros
src/lib/rosconsole_bridge.cpp
)
target_link_libraries(mavros
+ atomic
${catkin_LIBRARIES}
${Boost_LIBRARIES}
${GeographicLib_LIBRARIES}
--
1.9.1

3 changes: 2 additions & 1 deletion recipes-ros/mavros/mavros_0.18.7.bb
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ require mavros.inc

ROS_PKG_SUBDIR = "mavros"

SRC_URI += "file://0001-always-find-Eigen-with-cmake_modules-mechanism.patch;striplevel=2"
SRC_URI += "file://0001-always-find-Eigen-with-cmake_modules-mechanism.patch;striplevel=2 \
file://0001-CMake-explicitly-link-the-atomic-library-797.patch;striplevel=2"

0 comments on commit 25d97e4

Please sign in to comment.