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.

1 Answers1

5

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.

rubenvb
  • 74,642
  • 33
  • 187
  • 332
  • 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. – 0xC0000022L Apr 25 '15 at 00:41
  • @0xC0000022L 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. – rubenvb Apr 25 '15 at 09:30
  • yep, unfortunately that alone is not enough. There's more magic sauce needed, it seems. But thanks for taking the time to respond. – 0xC0000022L Apr 25 '15 at 10:22
  • @0xC0000022L Essentially nothing stops you from configuring/building it twice, once with `CC='gcc -m32'` and once with `CC='gcc -m64'`... – rubenvb Apr 25 '15 at 14:48
  • 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." – Vadim Volodin Mar 30 '21 at 20:24