Bug 23157 – undefined reference to `__cmsg_nxthdr' on Alpine Linux (musl libc)

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2022-06-04T07:21:49Z
Last change time
2022-08-24T10:54:39Z
Keywords
pull
Assigned to
No Owner
Creator
Tomoya Tanjo

Comments

Comment #0 by ttanjo — 2022-06-04T07:21:49Z
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.
Comment #1 by dlang-bot — 2022-06-04T07:39:35Z
@tom-tan created dlang/druntime pull request #3830 "Fix Issue 23157 - undefined reference to `__cmsg_nxthdr' on Alpine Li…" fixing this issue: - Fix Issue 23157 - undefined reference to `__cmsg_nxthdr' on Alpine Linux (musl libc) https://github.com/dlang/druntime/pull/3830
Comment #2 by dlang-bot — 2022-08-22T10:54:29Z
@RazvanN7 created dlang/dmd pull request #14378 "Port the fix for issue 23157" mentioning this issue: - Port the fix for issue 23157 https://github.com/dlang/dmd/pull/14378
Comment #3 by dlang-bot — 2022-08-24T10:54:23Z
dlang/dmd pull request #14378 "Port the fix for issue 23157" was merged into master: - 2e48741c49b81d6ae8c3b88559d21bbd739e5b56 by RazvanN7: Port the fix for issue 23157 https://github.com/dlang/dmd/pull/14378