Skip to content
Tcl Source Code View Ticket
Login

View Ticket

build failure on Alpine Linux (MUSL) - sys/queue.h no such file or directory

Closed / Fixed3ff2d724d03ba7d6edb8159fe1f4871619db8567Created 2 years agoUpdated 43 days ago
Descriptionplain2024-08-07 15:34:15
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,
Referenced by3
  • 617c86df64Fix [3ff2d724d0]: build failure on Alpine Linux (MUSL) - sys/queue.h no such file or directory check-in2026-10-20 18:36:54
  • 5e89bab5e2Fix [3ff2d724d0]: build failure on Alpine Linux (MUSL) - sys/queue.h no such file or directory check-in2026-10-20 18:34:22
  • f7ece61aa8Fix [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
danmack42plain2024-08-07 16:16:03
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.
jan.nijtmanswiki2024-08-07 16:51:52

I think you will find your answer here.

apk add --no-cache bsd-compat-headers

Hope this helps, Jan Nijtmans

danmack42plain2024-08-07 17:35:10
thank you, that's it.   appreciate your help.

dan
oehharwiki2024-08-07 19:11:38

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

serhiy.storchakawiki2026-10-20 13:07:22

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.

oehharwiki2026-10-20 13:29:32

Great. The preprocessor gymnastics feel good. It would be ok for me to merge.

Thanks, Harald

serhiy.storchaka Closed ticket [3ff2d724d0]. [History diff]2026-10-20 18:37:41
jan.nijtmanswiki2026-10-20 21:28:33

Please don't forget the changes.md/changes entries

Log in (anonymous is fine) to add a comment.