Question

I am using buildroot to build a fresh gcc cross-compiler on a dedicated machine.

It worked fine, but I now need to run this gcc from another machine, on which I have not the same libc version :-(. Of course gcc then crashed.

Is it possible to build gcc statically using buildroot ?

Was it helpful?

Solution

You could try passing -static to the linker (via LDFLAGS), but be aware that full static linking is not supported by glibc anymore (resp. it needs a glibc build which supports static linking).

This is due to the fact that nss libraries (name server switch) will be loaded dynamically (unless you compile your own glibc - but that defeats the purpose of nss). This might be enough for you however to reduce dependencies against system libraries.

But I could assume that a statically linked gcc is fairly huge - this might result in long startup times.

OTHER TIPS

If your objective is only to make a relocatable toolchain, statically link with expat, gmp, mpfr and mpc should enough. You can simply apply https://patchwork.ozlabs.org/patch/359841/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top