-
Notifications
You must be signed in to change notification settings - Fork 1
Build Cross Compile Toolchain
In order to make use of c++11 and c++14 features on the robot, we have built an out-of-source toolchain containing updated C and C++ libraries cross-compiled for the robot. This requires an extra 100mb of space in the persistent file system (out of 16GB) however, we believe that the space tradeoff is worth it for the flexibility added to the system. Thus, there are two copies of the standard C libraries, ABIs and GCC versions present on the robot. The old version (used by default, when linking executables) lives in /lib
, /usr/lib
and /bin
- whereas the updated version lives in /var/persistent/cross-atom/lib
, /var/persistent/cross-atom/i686-ntlp-linux-gnu/lib
and /var/persistent/cross-atom/bin
.
Usually, you will want to make use of the build system already present in the main system, however, the cross-compiler is built as a standalone toolchain, allowing programs not linked into our build system to be compiled for the robot. Each robot has to be provisioned using the provisioning script available in the tools repository, which installs the cross-compiled libraries into /var/persistent/cross-atom
. Assuming these libraries have been installed, in the vagrant environment, we can compile using the command:
/var/persistent/cross-atom/bin/i686-ntlp-linux-gnu-g++ \
main.cpp \
-O3 -std=c++14 -g \
-I/var/persistent/cross-atom/include \
-Wl,-rpath=/var/persistent/cross-atom/lib:/var/persistent/cross-atom/i686-ntlp-linux-gnu/lib \
-Wl,-dynamic-linker=/var/persistent/cross-atom/i686-ntlp-linux-gnu/lib/ld-linux.so.2 \
-Wl,-L/var/persistent/cross-atom/lib
As we can see - not exactly the easiest thing in the world to do, but the theory is relatively clear. You can also easily add a target inside the CMake build system for the main project (which may be easier than trying to compile it yourself). Just copying the generate a.out
binary to the robot should allow you to execute with all of the included features.
The libraries included in the cross-compilation (as of version 0.0.2) are:
- libc
- c++stdlib
- libboost
- liblua5.1
Linking boost is slightly different in the new version, as all of the boost libraries have the *-mt suffix. Thus, linking boost_system would be done with the command -lboost_system-mt instead of the more common -lboost_system.
Copyright (c) 2017 "University of Denver"
- Getting Started
- Architecture
- Build System
- The Vagrant Environment
- The Robot Environment
- Misc