Crt-static and uclibc-ng

So I'd like to be able to compile static (+crt-static) binaries utilizing the uclibc-ng library. I'm the maintainer for tier 3 target armv7-unknown-linux-uclibceabi. uclibc-ng like musl is friendly to creating completely static binaries, I do it all the time with regular c/c++ code. The issue right now is that anything more complicated than a 'hello world' program in rust will segfault. I think there must be some tweaking to achieve this for uclibc-ng.

One of the first issues I see is the what is being passed to the linker while using -Ctarget-feature=+crt-static. I would expect to only see -Wl,-Bstatic which is what it shows for the majority of the native target libraries (-lc,-lpthread etc) , but -Wl,-Bdynamic is also showing up with -ldl. I created a wrapper script for the linker which removes -Wl,-Bdynamic. Running that through gdb I see the segfault message says 0x00d38f28 in dlsym () Seem like there still some dynamic linking logic going on still, and now I'm not sure where to look from here.

thanks,
Lance

edit: When dynamic linking everything is working perfectly.

Can you find which function calls dlsym?

Ah, so the applications I'm attempting to compile depends on an older version of tokio that depends on an older version mio-0.6.23 which calls dlsym. Newer versions of mio removed the call to dlsym. So that's where my issues is. Doing some more testing I have been able to compile static binaries of other projects successfully. I guess I got lucky and tried a few that all had dependencies on that older library version.
Thanks @bjorn3 for engaging and making me think of compiling a debug build and doing a gdb backtrace to see that.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.