0

I am trying to use the cross-compiler toolchain in Buildroot to do the cross-compilation of a C++ application for one of my ARM board. The toolchain I am using is gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.gz. The toolchain dir structure is

$ ls -go /opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf
total 36
drwxr-xr-x 6  4096 Dec  4  2019 arm-linux-gnueabihf
drwxr-xr-x 2  4096 Dec  4  2019 bin
-rw-r--r-- 1 11337 Dec  4  2019 gcc-linaro-7.5.0-2019.12-linux-manifest.txt
drwxr-xr-x 3  4096 Dec  4  2019 include
drwxr-xr-x 3  4096 Dec  4  2019 lib
drwxr-xr-x 3  4096 Dec  4  2019 libexec
drwxr-xr-x 8  4096 Dec  4  2019 share
$

Now I have set the CROSS_COMPILE, CC, CPP variables in .bashrc as:

export PATH=/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin:$PATH
export CROSS_COMPILE=arm-linux-gnueabihf-
export CC=${CROSS_COMPILE}gcc
export CPP=${CROSS_COMPILE}g++

Now I have a question before I get started. For example in Yocto we need to source an environment script before cross-compilation which will set required environment variables. But I don't see any such script in Buildroot. So how will cmake gets to know about proper directories to look for binaries and header files? How will the cmake variables CMAKE_FIND_ROOT_PATH and CMAKE_SYSROOT set in this case?

Can someone please let me know how it's done in Buildroot?

Your help will be much appreciated.

Thanks in advance

P.S: I am new to cross-compilation in Buildroot and I am using Buildroot 2020.02.12 and Ubuntu 20.04 as build system. Please let me know if any info is missing here.

Preeti
  • 535
  • 1
  • 6
  • 30
  • 1
    *"Can someone please let me know how it's done in Buildroot?"* -- An application program would need a *package* defined for it. Refer to chapter 18 of the [Buildroot manual](https://buildroot.org/downloads/manual/manual.html#adding-packages), but also study chap 15. Find an existing Buildroot package that is similar to what you want to do (e.g. use 'find package -type f | xargs grep BR2_INSTALL_LIBSTDCPP' from the Buildroot directory), and then use it (i.e. its Buildroot package subdirectory as well as the project files) as a template/example. – sawdust Feb 02 '22 at 23:55

0 Answers0