[GCC][Toolchain] Eva GCC | Calling all kernel devs!

Search This thread

namhoang235

Senior Member
Feb 10, 2018
193
47
hatay - Viet Nam
Thanks for the feedback! Appreciate it!
Sir, i (newbie) try to build anrdoid rom with kernel but it show your gcc is too old, then i try to config:
my build.config.common:
CROSS_COMPILE=aarch64-elf-
CROSS_COMPILE_ARM32=arm-eabi-
LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=prebuilts/eval-gcc/aarch64/bin
LINUX_GCC_CROSS_COMPILE_ARM32_PREBUILTS_BIN=prebuilts/eval-gcc/arm/bin

my path:

export PATH="$HOME/super/prebuilts/eval-gcc/aarch64/bin:$HOME/super/prebuilts/eval-gcc/arm/bin$PATH"

This is error:
In file included from /root/super/kernel/xiaomi/ginkgo/include/linux/compiler_types.h:58:0,
from /root/super/kernel/xiaomi/ginkgo/include/linux/kconfig.h:74,
from <command-line>:0:
/root/super/kernel/xiaomi/ginkgo/include/linux/compiler-gcc.h:159:3: error: #error Sorry, your version of GCC is too old - please use 5.1 or newer.
# error Sorry, your version of GCC is too old - please use 5.1 or newer.


my gcc -v is 9.3.0 it mean >5.1 but still too old error:
[email protected]:~/super# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 10.3.0-1ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-gcn/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04)
 

m_vaisakh

Recognized Developer
Sir, i (newbie) try to build anrdoid rom with kernel but it show your gcc is too old, then i try to config:




This is error:



my gcc -v is 9.3.0 it mean >5.1 but still too old error:
AOSP does not support building kernels whilst compiling, so basically editing build.config.comm is useless.

You need to use a fork (custom rom) of AOSP that supports using custom toolchains.

Use of PATH is also restricted in AOSP, so you can't use tools exported in PATH, you need to modify or override vendor kernel makefile flags to get it work.

About the old GCC, custom rom build system falls back to gcc 4.9 by default.

The GCC version that you have installed on system has nothing to do with kernel complaining about gcc. Because version check shows for x86_64 whilst you're cross compiling for aarch64.
 
  • Wow
Reactions: namhoang235

namhoang235

Senior Member
Feb 10, 2018
193
47
hatay - Viet Nam
AOSP does not support building kernels whilst compiling, so basically editing build.config.comm is useless.

You need to use a fork (custom rom) of AOSP that supports using custom toolchains.

Use of PATH is also restricted in AOSP, so you can't use tools exported in PATH, you need to modify or override vendor kernel makefile flags to get it work.

About the old GCC, custom rom build system falls back to gcc 4.9 by default.

The GCC version that you have installed on system has nothing to do with kernel complaining about gcc. Because version check shows for x86_64 whilst you're cross compiling for aarch64.
holyshit, thank you very much, i think my config has problems but dont think it is related to source restricted path
 

Jairus980

Senior Member
Jan 18, 2016
465
1,982
23
Somewhere
Hi, Im using your latest gcc-arm
I got this error

VDSOL32 arch/arm64/kernel/vdso32/vdso.so.raw
MUNGE arch/arm64/kernel/vdso32/vdso.so.dbg
arch/arm64/kernel/vdso32/../../../arm/vdso/vdsomunge: Not a shared object
make[1]: *** [arch/arm64/kernel/vdso32/Makefile:134: arch/arm64/kernel/vdso32/vdso.so.dbg] Error 1
make: *** [arch/arm64/Makefile:213: vdso_prepare] Error 2
 

m_vaisakh

Recognized Developer
Hi, Im using your latest gcc-arm
I got this error

VDSOL32 arch/arm64/kernel/vdso32/vdso.so.raw
MUNGE arch/arm64/kernel/vdso32/vdso.so.dbg
arch/arm64/kernel/vdso32/../../../arm/vdso/vdsomunge: Not a shared object
make[1]: *** [arch/arm64/kernel/vdso32/Makefile:134: arch/arm64/kernel/vdso32/vdso.so.dbg] Error 1
make: *** [arch/arm64/Makefile:213: vdso_prepare] Error 2
Are your VDSO32 patches proper? It's highly unlikely that this is a gcc specific issue.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 29
    Introducing Eva GCC Toolchain

    What is GCC?
    The GNU Compiler Collection (GCC) is an optimizing compiler produced by the GNU Project supporting various programming languages, hardware architectures and operating systems. The Free Software Foundation (FSF) distributes GCC as free software under the GNU General Public License (GNU GPL). Major corporate contributors to GCC include Red Hat, IBM, SUSE, ARM, Google and Intel. GCC is a key component of the GNU toolchain and the standard compiler for most projects related to GNU and the Linux kernel. With ~15 million lines of code in 2019, GCC is one of the biggest open source programs in existence. It has played an important role in the growth of free software, as both a tool and an example.
    Source: Wikipedia

    What is LLVM Clang?
    Clang is a compiler front end for the C, C++, Objective-C and Objective-C++ programming languages, as well as the OpenMP, OpenCL, RenderScript, CUDA and HIP frameworks. It uses the LLVM compiler infrastructure as its back end and has been part of the LLVM release cycle since LLVM 2.6.
    It is designed to act as a drop-in replacement for the GNU Compiler Collection (GCC), supporting most of its compilation flags and unofficial language extensions. Its contributors include Apple, Microsoft, Google, ARM, Sony, Intel and Advanced Micro Devices (AMD). It is open-source software, with source code released under the University of Illinois/NCSA License, a permissive free software licence. Since v9.0.0, it was relicensed to the Apache License 2.0 with LLVM Exceptions.
    Source: Wikipedia

    Introduction
    Android as a whole has now fully switched to LLVM Clang for both their Platform (AOSP) and Kernels. In fact Pixel Phones have been shipping with Clang built and optimised kernels since 2018! But are there any improvements with using clang over GCC. I'd say yes, because the GCC that AOSP used was ancient (GCC 4.9). Also LLVM Clang has proven to be faster in compilation than GCC. But is this speed worth the improvement in Kernels? Let's answer that question with EvaGCC Toolchain.


    How is my toolchain different from Android GCC?
    As I've mentioned earlier, AOSP GCC is ancient (version 4.9) in terms of the present stable GCC release (10.2.x). EvaGCC is compiled straight from the Master branch, making it a Bleeding Edge C Compiler. It is built with LTO and disabled a lot of feature bloat that are unneccesary for kernel building to yield a very small binary size. To list the features:
    • Bare Metal GCC (This does not depend on the standard libc)
    • Built straight from the GNU GCC Master branch
    • Built with LTO and O3 optimisations
    • Disabled documentation (Smaller size of the toolchain)
    • Disabled decimal float, libffi, libmudflap, libquadmath, libstdcxx-pch, native language support
    • Statically linked GCC
    • Integrated LLVM LLD (For faster linking, optional)
    • Built twice weekly (Thanks to Github Actions!)

    Where can I find these toolchains?
    Well you have two options, you can compile them yourself (by using my script) or you can download precompiled binaries!
    To compile this toolchain by yourself (although I recommend that you use precompiled binaries, to avoid the hassle and time to compile the toolchain itself), to use my script to compile your toolchain, it has everything preconfigured for GCC setup and cloning. Although you'll have to setup your system for building GCC, you can refer to my README for system setup.

    Note:
    To obtain precompiled binaries (Highly recommended), head over to these links (according to your architechture and liking):
    Note: If you're doing a git clone, use --depth=1 to avoid heavy transfers, because the repositories are bound get bigger with subsequent updates.

    How do I use these toolchains for compiling my kernel
    You can either append the toolchain dir into your PATH variable, or you can just pass it along with make with setting your CROSS_COMPILE argument. I usually use the latter one.
    Since this is a bare metal compiler, the prefix differs from the normal AOSP or Linux GNU GCC. the prefix is:
    Bash:
    # Pass this to your CROSS_COMPILE argument if you have appended toolchain to your PATH
    ## for AARCH64 or ARM64
    $ make CROSS_COMPILE=aarch64-elf- ... # "..." indicates rest of your args
    
    ## for ARM
    $ make CROSS_COMPILE=arm-eabi- ...
    
    # Passing to make when you haven't appended to PATH
    ## for AARCH64 or ARM64
    $ make CROSS_COMPILE=<path to toolchain>/bin/aarch64-elf- ...
    
    ## for ARM
    $ make CROSS_COMPILE=path to toolchain>/bin/arm-eabi- ...

    Sources:
    Everything here is OSS, including the script, my ci automation script.
    GCC: https://gcc.gnu.org/git/?p=gcc.git or https://git.linaro.org/toolchain/gcc.git
    Binutils: https://sourceware.org/git/binutils-gdb.git
    GCC Build script: https://github.com/mvaisakh/gcc-build
    LLVM (Used for LLD): https://github.com/llvm/llvm-project

    GCC Version: 12.x
    Binutils Version: 2.36.x
    LLD Version: 14.x
    Telegram Channel:
    4
    NOTE: According to SultanXDA, and I quote

    GCC 10 updated its interprocedural optimizer's logic to have it make
    more conservative inlining decisions, resulting in worse syscall and
    hackbench performance compared to GCC 9.

    This can be fixed with a patch that he himself provided:

    and if that did not work for you, try applying this patch
    4
    Update 30-Jan-2021

    GCC+LLD has been merged into the main branch of the build script. Now GCC+LLD would be updated twice every week (on Sundays and Thurdays). This wasn't done before as it was under testing, and so far it only fails under LTO kernel compilation (Due to lack of GCC Plugin for LLD and vice versa).

    Update 07-April-2021

    lld-integration trunk has been merged into gcc-master branch. For those who use LLD, should switch to gcc-master as the lld-integration branch is now deprecated and will be removed soon.
    The size difference between the two isn't much (~86mb vs 125mb), so it makes sense to have a single branch for everything.
    I recommend to use zipped archive toolchains or if you use git operations to clone toolchain binaries, I recommend using --depth=1 while cloning the toolchain to avoid huge binary size cloning.

    Update 27-April-2021

    GCC Version has been bumped to 12.x
    Eva GCC
    now ships with
    GCC: 12.x
    LLD: 13.x
    BinUtils: 2.36.x

    Update 26-June-2021

    Toolchain binaries have been stripped off of debugging and hence are much smaller than before, ~90MB shaved off!
    Shallow clones shall be much faster than before!

    Update 24-Nov-2021

    LLD has been bumped to version 14.x
    GCC is still on 12.x

    Update 1-May-2022

    GCC has been bumped to version 13.x
    LLD is at 15.x
    3
    If anyone faces any issues with the toolchain, please do let me know. I will try to investigate the issue and check accordingly if it's a toolchain issue or a kernel side issue.
    Because being a cron built toolchain, it's necessary for people to report bugs as soon as possible.

    I still monitor on my end, but it's always good to have a helping hand
    2
    Update!

    GCC Version has been bumped to 12.x
    Eva GCC now ships with

    GCC: 12.x
    LLD: 13.x
    BinUtils: 2.36.x