[Help] Options to cross compile gcc14

Basile Starynkevitch basile@starynkevitch.net
Wed Jun 11 17:57:13 GMT 2025


On Wed, 2025-06-11 at 19:38 +0200, Jose Gomez via Gcc-help wrote:
> Good evening,
> 
> I am trying to cross compile gcc 14 (c, c++) in an Intel platform for 
> armhf and arm64. I am trying with multiple option sets without success.


On which operating system are you compiling GCC? It probably should be easier on
some Linux variant, such as https://debian.org/

Some Linux distributions are already providing GCC cross-compilers like the one
you want.

Current GCC is 15. I would recommend trying to build it.

> 
> Can somebody help me with this, please?

The first thing to do is to have your source GCC tree different (and outside of)
the build tree.

On my Debian desktop, the GCC source tree is on /usr/src/Lang/gcc-15.1.0/ and
the build tree is /usr/src/Lang/_Build-gcc-15

The configuration options I used are  '/usr/src/Lang/gcc-15.1.0/configure'  \
   '-v' '--prefix=/usr/local' '--with-gcc-major-version-only' \
   '--program-suffix=-15' '--enable-shared' '--enable-plugin' \
   '--enable-default-pie' '--with-system-zlib' '--disable-multilib' \
   '--with-tune=native' '--enable-checking=release' '--enable-host-shared' \
   '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' \
   '--target=x86_64-linux-gnu' 'CFLAGS=-g -O2' 'CXXFLAGS=-g -O2' \
   'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' \   
'target_alias=x86_64-linux-gnu' '--enable-languages=c,c++,jit,lto,rust' 


But of course you need to adapt them to your use case.

Expect a build time of several hours, and expect to fail the first ones.

Once a build is successful consider running make install or even better
     make install DESTDIR=/tmp/gccinstall

and once you are satisfied, 

     sudo cp -va /tmp/gccinstall/usr/local/. /usr/local/.


You may want to read https://arxiv.org/abs/1109.0779

My current open source project is refpersys.org (inference engine, GPL licensed)

Regards.

-- 
Basile STARYNKEVITCH                            <basile@starynkevitch.net>
8 rue de la Faïencerie                       http://starynkevitch.net/Basile/  
92340 Bourg-la-Reine                         https://github.com/bstarynk
France                                https://github.com/RefPerSys/RefPerSys


More information about the Gcc-help mailing list