0

I want to build a statically linked application that could use dynamically loadable plugins. The problem is that I can't get rid of the libc.so dependency.

I'm using musl libc and compiling like

 /opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -Wl,-E -fPIC -I... -static-libgcc -Wl,-Bstatic -ldl -lc -lgcc source.c -o output_bin foo.a bar.a -Wl,-Bdynamic

readelf -d shows that executable depends on libc.so, so executable doesn't work on other machines without musl libc.

Is it possible to include libc symbols into elf executable and link all external plugins to elf itself, without external .so dependencies? How to achieve this?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

1 Answers1

0

Maybe you should try compiling it without the stdlib using -nostdlib parameter.

learning_frog
  • 305
  • 1
  • 3
  • 14