How to Build Libgcc of GCC compiler
Asked Answered
G

1

7

Is there any way to build libgcc without building gcc compiler?

I have tried to run configure script of libgcc but it says ../../gcc/libgcc.mvars is missing.

My basic need is to build libgcc for multiple platforms with multiple configurations for various versions of libgcc.

Gram answered 28/3, 2014 at 8:5 Comment(0)
C
4

Not reliably, because the GCC build system is quite monolithic and fragile.

The quickest way to get the libgcc's built is to configure and build with something like the following:

../gcc-src/configure --target=$TARGET --enable-languages=c
make all-target-libgcc
make install-target-libgcc

You might have to make all-gcc first, not sure if the dependencies are set up correctly.

Chromoprotein answered 28/3, 2014 at 8:9 Comment(5)
consider platform A, 64-bit as host. Platform B defaults to 64-bit, but -m32 is supported. Any idea how to go about and build the libgcc for the -m32 target? Simply adding CFLAGS=-m32 to the make invocation would end up overwriting the original (-m64) libraries.Abscond
@Abscond If you use --enable-multilib this may just work. I'm not sure though, as I have always built libgcc as part of the whole GCC thing.Chromoprotein
yep, unfortunately that alone is not enough. There's more magic sauce needed, it seems. But thanks for taking the time to respond.Abscond
@Abscond Essentially nothing stops you from configuring/building it twice, once with CC='gcc -m32' and once with CC='gcc -m64'...Chromoprotein
Seems like you should use either --disable-multilib or --enable-multilib since it says "configure: error: I suspect your system does not have 32-bit development libraries (libc and headers). If you have them, rerun configure with --enable-multilib. If you do not have them, and want to build a 64-bit-only compiler, rerun configure with --disable-multilib."Cunctation

© 2022 - 2024 — McMap. All rights reserved.