www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23157] New: undefined reference to `__cmsg_nxthdr' on Alpine


          Issue ID: 23157
           Summary: undefined reference to `__cmsg_nxthdr' on Alpine Linux
                    (musl libc)
           Product: D
           Version: D2
          Hardware: x86
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: ttanjo gmail.com

The dmd (ac5f925c) can compile druntime (705fb36e5) on Alpine Linux (musl libc)
but `make -f posix.mak unittest` failed.
At least it works on dmd 2.098.0.

Here is a way to reproduce this issue:
$ docker run --rm -it alpine:edge sh


../dmd/generated/linux/release/64/dmd -conf= -Isrc -Iimport -w -de
-preview=dip1000 -preview=fieldwise -m64 -fPIC  -preview=dtorfields -g -debug
-ofgenerated/linux/debug/64/unittest/test_runner src/test_runner.d
-Lgenerated/linux/debug/64/unittest/libdruntime-ut.so -debuglib= -defaultlib=
-L-lpthread -L-lm
generated/linux/debug/64/unittest/libdruntime-ut.so: undefined reference to
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
make[1]: *** [posix.mak:436: generated/linux/debug/64/unittest/test_runner]
Error 1
make[1]: Leaving directory '/druntime'
make: *** [posix.mak:407: unittest-debug] Error 2

The reason is that `CMSG_NXTHDR` refers undefined `__cmsg_nxthdr` that is not
provided on musl libc.

Jun 04 2022