Tcl Source Code

View Ticket
Login
Ticket UUID: 3ff2d724d03ba7d6edb8159fe1f4871619db8567
Title: build failure on Alpine Linux (MUSL) - sys/queue.h no such file or directory
Type: Bug Created on: 2024-08-07 15:34:15
Submitter: danmack42 Assigned to: nobody
Subsystem: 53. Configuration and Build Tools Severity: Minor
Priority: 5 Medium Last modified: 2026-10-20 21:28:33
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2026-10-20 21:28:33
Version: 9.1.0
Description:
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,
User Comments:
danmack42 added on 2024-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.nijtmans added on 2024-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


danmack42 added on 2024-08-07 17:35:10:
thank you, that's it.   appreciate your help.

dan

oehhar added on 2024-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.storchaka added on 2026-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.


oehhar added on 2026-10-20 13:29:32:

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

Thanks, Harald


jan.nijtmans added on 2026-10-20 21:28:33:

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