[cfe-users] Clang without shared gcc libraries

Arne Redlich arne.redlich at googlemail.com
Fri Dec 13 06:04:59 PST 2013


2013/11/11 Arne Redlich <arne.redlich at googlemail.com>:
> Hi list,
>
> I'm running into a problem when trying to build binaries with a clang
> compiler (svn trunk, rev 194249) built with a gcc 4.8.1 without shared
> libraries on Linux x86_64 (Ubuntu 12.04.3):

[...]

> ~/Projects/buildtools/3.0/debug/bin/clang /tmp/test.c
> /usr/bin/ld: cannot find -lgcc_s
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>
> Clang obviously adds -lgcc_s to the linker command line (see below),
> whereas with the aforementioned gcc things work as expected.
> Asking clang not to use the shared gcc libs results in this:
>
> ~/Projects/buildtools/3.0/debug/bin/clang -static-libgcc /tmp/test.c
> /usr/bin/ld: cannot find -lgcc_eh

[Replying to myself]

In case anyone else runs into this: the fix - taken from [1] - is to
* create a symlink from libgcc.a to libgcc_eh.a
* use -static-libgcc when linking.

Arne

[1] http://www.linuxfromscratch.org/lfs/view/development/chapter05/gcc-pass1.html



More information about the cfe-users mailing list