Search code examples
compilationembedded-linuxcross-compilingyoctotoolchain

How to know what version of cross compiler I am using on YOCTO?


I am using Yocto project to build Linux distribution for my embedded board. After the build, I needed to use a cross compiler to compile applications from my host machine to be executed on my board.I have just entered the command bitbake meta-toolchain. Now I can compile code of applications that are intendent to run on my board on my host machine. I just want to know what is the name and what version of compiler I am using when doing so? how can I know this ? Is there a way to know more information about the toolchain which was build ?

Thank you.


Solution

  • Actually, since meta/recipes-devtools/gcc contains the available cross-compiler versions but no information about the one that is being built, you can check the current cross-compiler version by executing the following commands:

    bitbake -e | grep "^GCCVERSION="
    

    In order to check out the build system's toolchain configuration, you can refer to the variable TCMODE (it should be set in the distro configuration file; e.g. poky.conf), you can retrieve its actual value by issuing the commands below:

    bitbake -e | grep "^TCMODE="
    

    Then, you will find the GCCVERSION, along with the rest of the toolchain configuration variables, in poky/meta/conf/distro/include/tcmode-${TCMODE}.conf. Note that the variables inside the aforementioned file can be overwritten or reassigned in other configuration files such as conf/local.conf (that's why bitbake -e should be used to retrieve its real value instead).

    In the case you are using the SDK

    If you're using the Yocto-generated SDK, you can just execute <cross-compiler> --version, e.g.:

    arm-poky-linux-gnueabi-gcc --version
    

    To check the name of the cross-compiler that is being used in your build system, you can:

    bitbake -e | grep "^export CC="
    

    For further information refer to https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#dev-debugging-viewing-variable-values