Build boost_system cross-compiled for the iMX6

Hello,

I have a Linux virtual machine (Ubuntu 18.04) running on an x86 machine.
I’m running Eclipse (2018-12, 4.10.0).
My target is the Toradex Colibri iMX6DL 512MB IT V1.0B.

As described here on the Toradex website:

I’ve successfully followed all of the steps to create, build and run a debug session of a C++ Hello-World project within Eclipse on the iMX6 target.

The next step I have is to use some Boost libraries (namely, asio and bind).
I installed boost using:
sudo apt-get install libboost-all-dev

After the install, I can see the boost header files and include them into my source code.
However, these boost libraries use the boost_system library, which appears to require compilation of the library.
(Refer to section #3 of Boost Getting Started on Unix Variants - 1.69.0)
Thus, it appears I need to compile boost_system using the toradex ARM toolchain (arm-angstrom-linux-gnueabi-g++) so that it can be incorporated into the application build to run on the iMX6.

Does anyone know how to do this?

I’ve tried following suggestions on these websites:

https://theboostcpplibraries.com/introduction-installation

but they don’t seem to address the issue directly.

  1. I’m not able to build a new linux image (I have to work with the image I have).
  2. The bjam (b2) Boost.Build utility doesn’t appear to be capable of using the Toradex arm-angstrom-linux-gnueabi-gcc toolchain.

Thus, ultimately, what I need is to build boost_system cross-compiled for ARM so that I can include it in my Eclipse project.

Thanks much in advance for the help!
~

Hi @belskyc

Welcome to the Toradex Community!

Could you provide the version of the Software of your module?

  1. I’m not able to build a new linux image (I have to work with the image I have).

Why cannot you create an new image with corresponding SDK? What exactly is the issue?

  1. The bjam (b2) Boost.Build utility doesn’t appear to be capable of using the Toradex arm-angstrom-linux-gnueabi-gcc toolchain.

Why? Did you get any errors doing that?

Best regards,
Jaski

Hello,
Thanks for the reply.

  1. Here’s some version information about our build of Angstrom that we’re using:

    root@tsi-3756180103:~# cat /etc/os-release
    VERSION_ID=“v2016.12”
    NAME=“Angstrom”
    ID=“angstrom”
    PRETTY_NAME=“The Ångström Distribution v2016.12”
    ANSI_COLOR=“1;35”
    HOME_URL=“http://www.angstrom-distribution.org

    root@tsi-3756180103:~# lsb_release -a
    Distributor ID: Angstrom
    Description: Angstrom GNU/Linux v2016.12 (Core edition)
    Release: v2016.12
    Codename: Core edition

    root@tsi-3756180103:~# hostnamectl

    Operating System: The Ångström Distribution v2016.12
    Kernel: Linux 4.1.41-2.7.3+g82f0f4f
    Architecture: arm

  2. The reason that I cannot create a new linux image is that my company as a whole has “released” a certain image that my product line must use. I’m not allowed to use a different image.

  3. bjam has a pre-defined set of toolchains that it supports. The arm-angstrom-linux-gnueabi-g++ is not one of them.

I discovered that I could modify the project-config.jam file by replacing “using gcc” with “using gcc : arm : arm-angstrom-linux-gnueabi-g++ ;”
and then executing ./bjam install -a --toolset=gcc-arm --prefix=/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/include/boost_1_67_0/boost --build-dir=DIR

It copies over the boost files OK, and does actually call the arm-angstrom-linux-gnueabi-g++; however, the compilation fails. Looks like it can’t find any of the include files. I can’t find any means of including the C++ includes. Please see the attached file for all of the bjam output.
link to bjamOutput

Here’s the series of steps that I take:

  1. Export Variables for Cross-Compilation

    . /usr/local/oecore-x86_64/environment-setup-armv7at2hf-neon-angstrom-linux-gnueabi

  2. Run the bootstrap

    sudo ./bootstrap.sh --prefix=/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/include/boost_1_67_0/boost --with-libraries=system

  3. Next, modify the configuration file (project-config.jam) which was generated by the bootstrap.sh. To use the ARM toolchain, replace the line with “using gcc” with “using gcc : arm : arm-angstrom-linux-gnueabi-g++ ;”

  4. Finally, execute:

./bjam install -a --toolset=gcc-arm --prefix=/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/include/boost_1_67_0/boost --build-dir=DIR

Thanks again for the help,
~

hi @belskyc

Thanks for the Information.

  1. I’m not allowed to use a different image.

Actually the Image will be just to compile your application and especially getting the SDK with Boost libraries for Cross compilation.

  1. Looks like it can’t find any of the include files. I can’t find any means of including the C++ includes. Please see the attached file for all of the bjam output

There is only one file missing:

./boost/config/compiler/gcc.hpp:165:10: fatal error: cstddef: No such file or directory

Hello jaski.tx,

Yes, there are missing files because they are not included. Normally, a command-line execution of gcc will have -I include options to include project dependency files (in this case, the C++ library files, such as cstddef). How can I do this within Bjam?

I’ve actually got Bjam calling arm-angstrom-linux-gnueabi-g++ instead of the regular g++, per this posting:

But I still get the following error, when it attempts to compile the first file:

gcc.compile.c++ DIR/boost/bin.v2/libs/system/build/gcc-arm/release/link-static/threading-multi/error_code.o

"arm-angstrom-linux-gnueabi-g++"   -pthread -O3 -finline-functions -Wno-inline -Wall  -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_STATIC_LINK=1 -DNDEBUG  -I"." -c -o "DIR/boost/bin.v2/libs/system/build/gcc-arm/release/link-static/threading-multi/error_code.o" "libs/system/src/error_code.cpp"

In file included from ./boost/config.hpp:39:0,
                 from ./boost/system/config.hpp:13,
                 from ./boost/system/error_code.hpp:15,
                 from libs/system/src/error_code.cpp:16:
./boost/config/compiler/gcc.hpp:165:10: fatal error: cstddef: No such file or directory
 #include <cstddef>
                ^~~~~~~~~
compilation terminated.
...skipped libboost_system.a(clean) for lack of error_code.o... 
...skipped libboost_system.a for lack of error_code.o... 
...skipped <p>libboost_system.a for lack of libboost_system.a...
...failed updating 2 targets...

Note how the call has the -I"." option. I think I just need to be able to include all project dependencies and then boost will compile. How can I do this in bjam?

Thanks again,
~

How can I do this within Bjam?

I don’t know how you can do this with Bjam? As I already explained, you need to compile an Image and SDK with Boost Included and then compile your application. This is the only proper way to do this.

Best regards,
Jaski