Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 838172

Summary: sys-libs/musl installs /usr/include/ucontext.h, but does not implement the functions declared within it (was: sys-libs/libxcrypt-4.4.28-r2 fails tests on MUSL: ld: explicit-bzero.c:(.text.startup+0xed): undefined reference to makecontext)
Product: Gentoo Linux Reporter: Agostino Sarubbo <ago>
Component: Current packagesAssignee: Gentoo musl team <musl>
Severity: normal CC: toolchain
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Attachments: build.log

Description Agostino Sarubbo gentoo-dev 2022-04-13 07:14:07 UTC

Issue: sys-libs/libxcrypt-4.4.28 fails tests on MUSL.
Discovered on: amd64 (internal ref: tinderbox_musl)

This machine uses MUSL libc
Comment 1 Agostino Sarubbo gentoo-dev 2022-04-13 07:14:10 UTC
Created attachment 770495 [details]

build log and emerge --info
Comment 2 Agostino Sarubbo gentoo-dev 2022-04-13 07:14:11 UTC
Error(s) that match a know pattern in addition to what has been reported in the summary:

/usr/lib/gcc/x86_64-gentoo-linux-musl/11.2.1/../../../../x86_64-gentoo-linux-musl/bin/ld: explicit-bzero.c:(.text.startup+0x108): undefined reference to `swapcontext'
/usr/lib/gcc/x86_64-gentoo-linux-musl/11.2.1/../../../../x86_64-gentoo-linux-musl/bin/ld: explicit-bzero.c:(.text.startup+0x134): undefined reference to `swapcontext'
/usr/lib/gcc/x86_64-gentoo-linux-musl/11.2.1/../../../../x86_64-gentoo-linux-musl/bin/ld: explicit-bzero.c:(.text.startup+0x177): undefined reference to `swapcontext'
/usr/lib/gcc/x86_64-gentoo-linux-musl/11.2.1/../../../../x86_64-gentoo-linux-musl/bin/ld: explicit-bzero.c:(.text.startup+0xed): undefined reference to `makecontext'
explicit-bzero.c:(.text+0x3c5): undefined reference to `swapcontext'
explicit-bzero.c:(.text+0x5a): undefined reference to `swapcontext'
explicit-bzero.c:(.text+0xd5): undefined reference to `swapcontext'
explicit-bzero.c:(.text.startup+0x92): undefined reference to `getcontext'
collect2: error: ld returned 1 exit status
Comment 3 Fabian Groffen gentoo-dev 2022-06-01 19:47:12 UTC

these functions (swapcontext, makecontext) are not implemented, and need to be blocked out when using musl

we could drop test/explicit-bzero from check_PROGRAMS ( for musl
Comment 4 Agostino Sarubbo gentoo-dev 2022-10-08 10:20:37 UTC
tinderbox_musl has reproduced this issue with version 4.4.28-r2 - Updating summary.
Comment 5 Mike Gilbert gentoo-dev 2022-10-08 14:53:47 UTC
(In reply to Fabian Groffen from comment #3)

musl installs /usr/include/ucontext.h which declares the swapcontext and getcontext functions. If libc doesn't provide these functions, arguably /usr/include/ucontext.h should not be installed at all.

libxcrypt has a configure test that checks for ucontext.h, and there is a check in test/explicit-bzero.c that checks for HAVE_UCONTEXT_H. If the macro is not set, the test simply exits with status 77 (skip).
Comment 6 Larry the Git Cow gentoo-dev 2022-10-08 15:31:37 UTC
The bug has been closed via the following commit(s):

commit 6da5a9571d82af96730a4ecb966b58b4c18c13a7
Author:     Mike Gilbert <>
AuthorDate: 2022-10-08 15:29:25 +0000
Commit:     Mike Gilbert <>
CommitDate: 2022-10-08 15:29:25 +0000

    sys-libs/libxcrypt: add musl workaround
    Signed-off-by: Mike Gilbert <>

 sys-libs/libxcrypt/libxcrypt-4.4.28-r1.ebuild | 7 +++++++
 sys-libs/libxcrypt/libxcrypt-4.4.28-r2.ebuild | 7 +++++++
 2 files changed, 14 insertions(+)
Comment 7 Larry the Git Cow gentoo-dev 2022-11-02 03:02:33 UTC
The bug has been closed via the following commit(s):

commit 67b62e98c3b475c46489f25469492f579ed531ca
Author:     Sam James <>
AuthorDate: 2022-11-02 02:29:52 +0000
Commit:     Sam James <>
CommitDate: 2022-11-02 02:29:52 +0000

    sys-libs/libxcrypt: add 4.4.30
    Signed-off-by: Sam James <>

 sys-libs/libxcrypt/Manifest                |   1 +
 sys-libs/libxcrypt/libxcrypt-4.4.30.ebuild | 329 +++++++++++++++++++++++++++++
 2 files changed, 330 insertions(+)