libasync
libasync copied to clipboard
Error when trying to build under Alpine (Musl)
Hi @etcimon.
Do you know if the lib should work on Alpine docker container?
I faced with this error:
/root/.dub/cache/libasync/~master/build/regular-release-RNnj5zspAaZtWLsA4BwBbA/libasync.a(libasync.posix.o): in function _D8libasync5posix13EventLoopImpl6notifyMFNbIiOCQBt6signal11AsyncSignalZb': posix.d:(.text._D8libasync5posix13EventLoopImpl6notifyMFNbIiOCQBt6signal11AsyncSignalZb+0x1d): undefined reference to pthread_sigqueue'
It seems like a linker issue, I think you need to link to a stub for pthreads to work in this docker.
https://github.com/alpinelinux/docker-alpine/issues/227
Have you tried linking with the supplied libpthread.a?
I've tried to use it, no luck. But I found the root of the problem (I suppose). Musl still doesn't have pthread_sigqueue. And we don't have it for Musl in core as well. https://github.com/dlang/dmd/blob/master/druntime/src/core/sys/posix/signal.d#L3056
So libasync is not compatible with Musl until someone implement it and upstream into main repo.
Btw BSD systems also don’t have this function. In the web people are mentioning that it is not very portable (only glibc probably has it).
For example, Microsoft rewrote their implementation with pthread_kill https://github.com/dotnet/runtime/issues/4472