Compiler to use for cross-compilation in DevKit container

DRIVE OS Version: 7.0.3

Issue Description: Are there any recommendations on compilers to use in toolchain for cross-compilation?

I can see at least two different options:

  • Samples toolchain reference compilers in /drive/toolchains/aarch64–glibc–bleeding-edge-*
  • aarch64 compiler which VsCode automatically detects in the container in /usr/bin/aarch64-linux-gnu-*

We have some issues using ‘/drive/toolchains/aarch64–glibc–bleeding-edge-*’ compiler when linking against 3d-party packages like GLFW3.

Also are there any policies/recommendations on installing 3d patry packages in the DriveOS DevKit container using ‘apt install’ to link against them?

Dear @semen.nazarenko ,
For CUDA,DW,TensorRT,NvMedia the cross compilation tool chain is setup already on docker. You can follow the respective instructions to build samples. May I know which sample you want to cross compile?

I do not want to cross-compile samples. I want to cross compile our own code. So I’m looking for any recomendations or guideline on which compiler to use. I did not find any toolchain CMake files except one in the samples, so wanted to clarify if I should create my own and which compiler should I use in this file.
Also I wanted to clarify is it recommended or not to use ‘apt install’ specifically inside dev-container to get 3d-party packages,

You can install any packages on devcontainer with apt.
Is it like you want to cross compile a simple c++ program?

May I know the encountered issue?

The issue with GLFW3 is that we get compiler error:
No such file or directory include <GLFW/glfw3.h>
Even though we use find_package(glfw3 REQUIRED) and include “glfw” in target_link_libraries() for our CMake target. Corresponding GLFW3 package file contains proper include directory:
includedir=/usr/include

Using compiler /usr/bin/aarch64-linux-gnu-g++ fixes the issue. So our theory at the moment is that compiler from /drive/drive-linux/… forbids include paths from /usr/.. space.

So can you please confirm that using compiler from /usr/bin/ folder in the SDK DevContainer is allowed to produce binaries for DriveOS devices? We’re facing more issues with the one from /drive/toolchain/ folder as it does not work with libavutil-dev too, it gives us errors like this:
fatal error: libavutil/channel_layout.h: No such file or directory
14 | include <libavutil/channel_layout.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

And again, just like with GLFW3 - we istall the package in dev container with “sudo apt install libavutil-dev:arm64”, we include it in the CMake with “find_library(AVUTIL_LIB avutil REQUIRED)” and we include it into the CMake target with target_link_libraries(). And just like for GLFW3 - switching to the compiler from /usr/bin/ folder solves the issue.

It should be ok to /usr/bin/aarch64-linux-gnu-g++ for cross compilation of your application. Did the cross compiled binaries working on target?

Hi, thanks for the confirmation. Yes, binaries work without any observable issues on target.

Hi @SivaRamaKrishnaNV I am working with @semen.nazarenko as well. Can you please explain the case where the /drive/toolchain/… compilers should be used vs the ones in /usr/bin ?

Since there are two compilers, we need to decide which is best to use for which application. I.e. when to use for 3rd party libs vs applications developed specifically to run with the DriveOS foundation tools.

Thanks!