[Issue 23157] New: undefined reference to `__cmsg_nxthdr' on Alpine Linux (musl libc)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 4 07:21:49 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=23157

          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 at puremagic.com
          Reporter: ttanjo at 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:
```console
$ docker run --rm -it alpine:edge sh
# apk add --no-cache alpine-sdk ldc
# git clone --depth 1 https://github.com/dlang/dmd.git
# git clone --depth 1 https://github.com/dlang/druntime.git
# cd dmd
# make -f posix.mak HOST_DC=ldmd2
# cd ../druntime
# make -f posix.mak
# make -f posix.mak unittest
...
../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
/usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld:
generated/linux/debug/64/unittest/libdruntime-ut.so: undefined reference to
`__cmsg_nxthdr'
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.

--


More information about the Digitalmars-d-bugs mailing list