Building libunwind on x86 musl-libc against libucontext
by andigena from LinuxQuestions.org on (#5FX2B)
I'm trying to build libunwind 1.5-rc2 on an i686 Gentoo chroot with musl libc. The issue is that libunwind inexplicably relies on the effectively-deprecated getcontext() and setcontext() functions implemented in glibc. It's transferred to using its own implementation of both on amd64, but because implementing it requires architecture-specific ASM code, it has only implemented getcontext(), not setcontext() on x86. The external package libucontext provides these functions but I can't figure out how to get libunwind to build against it after installation (which I did with a simple ./configure && make && make install); it's giving me the same build error about an undefined reference to setcontext. I imagine that the solution is a simple library linking issue but I'm not knowledgeable about working with linkers and the musl-libc one seems pretty rudimentary.
The error occurred late in compilation and it was hard to tell which file is at fault so I ran Code:grep -rlw setcontext and found ./src/x86/Gos-linux.c - I added a "include <ucontext.h>" line at the top, but that didn't help. I also tried running ldconfig, in case the library failed to link after installation or something, and that gave me the error that "Updating links is not implemented."
Suggestions?
./configure output: https://pastebin.com/4bGTg6vL
make output: https://pastebin.com/umCukwjt


The error occurred late in compilation and it was hard to tell which file is at fault so I ran Code:grep -rlw setcontext and found ./src/x86/Gos-linux.c - I added a "include <ucontext.h>" line at the top, but that didn't help. I also tried running ldconfig, in case the library failed to link after installation or something, and that gave me the error that "Updating links is not implemented."
Suggestions?
./configure output: https://pastebin.com/4bGTg6vL
make output: https://pastebin.com/umCukwjt