Libgcc_s.a missing

I unpacked SDK for cortexA7 but this library is not there, there is only libgcc_s.so library

but I need *.a for static linking, where can I get it?

The OpenWrt "SDK" (misnamed as it is an image builder) Edit: Image Builder, if that is what you are using, does not support custom software. You'll need to use the build system.

As jow points out, there is also an SDK, documented at https://openwrt.org/docs/guide-developer/using_the_sdk, which is distinct from the image builder.

1 Like

Jeff, thank you but i do not understand. I found another 4 *.a libraries i needed in SDK.
What do you mean 'build system'?

https://openwrt.org/docs/guide-developer/build-system/start

Uhm - thats does not sound correct. You can build custom software just fine with the SDK. And no, the SDK cannot produce images. Maybe you confused it with the ImageBuilder?

For me it is there: [...]

Update: yes, there's indeed no libgcc_s.a available - it is not possible to obtain one without rebuilding the toolchain from scratch. You can however try to build your code using -fno-builtin, this should eliminate uses of functions like __builtin_memcpy() and the like which require libgcc.

Reference:

Edit:

I took a deeper look and not even the complete buildroot provides a libgcc_s.a. It appears that recent gcc versions do not offer a simple way to obtain a completely static libgcc anymore.

Best is to try using the aforementioned -fno-builtin C flag during compilation.

I do not remember where but I think I have seen somewhere information that libgcc_s is stronly tied to the kernel version and hardware so it is not possible to use it for static linking but always dynamic must be used - the library that is inside host system. Can this be true? It would explain why static version is not provided...

Actually I believe its called libgcc.a, and can be found at staging_dir/toolchain-arm_cortex-a8+vfpv3_gcc-7.3.0_musl_eabi/lib/gcc/arm-openwrt-linux-muslgnueabi/7.3.0/libgcc.a. To use it you add the -static-libgcc compiler option. Therefore there is no need for it in the normal library directories.

The library is dependent mostly on the CPU capabilities and to some degree on compiler version, but I don't think it depends on the Linux kernel.

You can read about libgcc at https://gcc.gnu.org/onlinedocs/gccint/Libgcc.html

1 Like

Thanx, but i need both libgcc and libgcc_s , what is the difference?

libgcc_s is a dynamic version of libgcc (or maybe parts of it). I tried this on a simple C program on cortex-a8, normally ldd shows:

/lib/ld-musl-armhf.so.1 (0xb6ebd000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6ea2000)
libc.so => /lib/ld-musl-armhf.so.1 (0xb6ebd000)

Using -static-libgcc:

/lib/ld-musl-armhf.so.1 (0xb6f40000)
libc.so => /lib/ld-musl-armhf.so.1 (0xb6f40000)

With -static-libgcc GCC automatically links against libgcc.a instead of libgcc_s.so.

What are you doing to make you believe there should be a libgcc_s.a? There is no such thing.

Jan, I played a bit around make process and now I finished with something else, I tried two different projects that normally (not static) work well and give executable working results
.
but, the normal process uses *.so libraries already present in OpenWrt system, the system I downloaded from chinees Sunxi factory page, though they claim it is CC 15.05.1 it is not, it has got different kernel, I had some problems installing packages and I had to force opkg to install them, they work....
.
but for my static process I took *.a libraries from official SDK for CC15.05.1 (older kernel)

can this be a problem?

If you have a minute, could you plese look at the logs for two static attermpts? I uloded them on:


thanx!