build failure on Alpine Linux (MUSL) - sys/queue.h no such file or directory
Downloaded tcl9.0b3 gz tarball from sourceforge. Did a generic configure on Alpine Linux v3.20 and tried a source build. During build, errors at this point:
/home/mack/src/tcltk/tcl9.0b3/unix/tclEpollNotfy.c:28:10: fatal error: sys/queue.h: No such file or directory
28 | #include <sys/queue.h>
| ^~~~~~~~~~~~~
compilation terminated.
Looks like a new dependency on queue.h which does exist on alpine.
Tcl version: 8.6.14 builds without any problems.
Thank you,
617c86df64Fix [3ff2d724d0]: build failure on Alpine Linux (MUSL) - sys/queue.h no such file or directory check-in2026-10-20 18:36:545e89bab5e2Fix [3ff2d724d0]: build failure on Alpine Linux (MUSL) - sys/queue.h no such file or directory check-in2026-10-20 18:34:22f7ece61aa8Fix [3ff2d724d0]: Tcl did not build with musl (e.g. Alpine Linux without bsd-compat-headers), which has no <sys/queue.h>. Define the six list macros that tclEpollNotfy.c uses instead of including that header. check-in2026-10-20 13:06:40
as a workaround, I just copied the netbsd version of queue.h file into the compat directory and changed the sys/queue.h to ../compat/queue.h for now.
I think you will find your answer here.
apk add --no-cache bsd-compat-headers
Hope this helps, Jan Nijtmans
thank you, that's it. appreciate your help. dan
Would it be helpful to add this information into the TCL migration guide or release notes? Or is this a general purpose problem and not related to TCL?
Should "configure" detect this?
Thanks, Harald
As Harald asked, Tcl itself can avoid this: tclEpollNotfy.c only needs six list macros from <sys/queue.h>, which musl does not provide. Proposed fix in branch epoll-no-sys-queue: define them in tclEpollNotfy.c instead of including that header, so no configure check and no bsd-compat-headers are needed. Tested on Alpine 3.24 without bsd-compat-headers: the current main fails as reported, with the branch it builds and the event, socket, I/O and notifier tests pass; also tested on Linux with glibc.
Great. The preprocessor gymnastics feel good. It would be ok for me to merge.
Thanks, Harald
Please don't forget the changes.md/changes entries