-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
problem building some programs on musl #1361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This might just be due to an out-of-date |
I reported the issue to the libc crate: rust-lang/libc#3190
|
Looks like a slightly different issue right? Could you make a new one? On our side, we should probably disable that functionality for the time being. |
As far as I understand, the issue is almost the same. This ticket was worked-around with this commit , so now instead of uucore failing and producing the logs in this ticket, the utilities which depend on uucore's utmpx functionality are failing when building for musl. The proper long-term fix is to implement the functionality on libc's side, which I'll try to work on. |
I'd probably call this more of a platform support documentation issue than a coding bug. I can add some |
That's a big hill to climb; I wish you luck! |
I investigated this further, and while the utmpx functions are exported by musl in a header-file, those are only stub implementations doing nothing. I'll try to improve the build errors, but compiling e.g. the utility "users" using musl stubs doesn't really make sense, because while it would compile, it would produce a runtime error (this explains why only stubs are provided). |
@Ecordonnier Just checking in here. I see that rust-lang/libc#3190 and rust-lang/libc#3213 are still open. Should we poll there to see if we can get them merged? |
@tertsdiepraam I'm not very familiar with the rust libc project, but my understanding is that this PR is changing the API and therefore tagged as "breakage-candidate" so that it can be merged when they do a release with non-backwards-compatible API. I asked them for confirmation in the PR. |
Interesting! I'll subscribe to the PR. Thanks! |
The required functions were added to libc ( rust-lang/libc@e3caaf6 ), however those changes will be available via cargo only once libc 0.3 is released ( rust-lang/libc#3248 ). The main branch of libc is now used for the development of 0.3, and the version 0.2 is developed on the branch libc-0.2 (and hence the libc release 0.2.152 does NOT contain e3caaf6b0ea08a ). Edit May 2024: The status is still the same. libc version 1.0 will be needed in order to fix this, and this will probably take at least several months: rust-lang/libc#3248 |
According to https://github.com/rust-lang/libc/releases/tag/0.2.165 , the utmpx API should now be available for musl (even though keep in mind those are stub functions which don't do anything because musl chose to not implement those for security reasons, but it should at least compile). See this commit which was merged into 0.2.165. libc 0.2.170 is currently used in Cargo.lock so those changes are available to coreutils. I tried removing this line, however it is not enough and it still doesn't build:
I opened rust-lang/libc#4322 as follow-up issue. |
Unfortunately, the name of those constants are not standardized: glibc uses __UT_HOSTSIZE, __UT_LINESIZE, __UT_NAMESIZE musl uses UT_HOSTSIZE, UT_LINESIZE, UT_NAMESIZE See: 1. https://git.musl-libc.org/cgit/musl/tree/include/utmpx.h 2. https://github.com/bminor/glibc/blob/master/sysdeps/gnu/bits/utmpx.h#L35 This is a partial fix for uutils#1361 Signed-off-by: Etienne Cordonnier <[email protected]>
Unfortunately, the name of those constants are not standardized: glibc uses __UT_HOSTSIZE, __UT_LINESIZE, __UT_NAMESIZE musl uses UT_HOSTSIZE, UT_LINESIZE, UT_NAMESIZE See: 1. https://git.musl-libc.org/cgit/musl/tree/include/utmpx.h 2. https://github.com/bminor/glibc/blob/master/sysdeps/gnu/bits/utmpx.h#L35 This is a partial fix for uutils#1361 Signed-off-by: Etienne Cordonnier <[email protected]>
I think I have managed to make it work in this test branch: https://github.com/Ecordonnier/coreutils/tree/eco/enable-musl
|
excellent, thanks! |
Unfortunately, the name of those constants are not standardized: glibc uses __UT_HOSTSIZE, __UT_LINESIZE, __UT_NAMESIZE musl uses UT_HOSTSIZE, UT_LINESIZE, UT_NAMESIZE See: 1. https://git.musl-libc.org/cgit/musl/tree/include/utmpx.h 2. https://github.com/bminor/glibc/blob/master/sysdeps/gnu/bits/utmpx.h#L35 This is a partial fix for uutils#1361 Signed-off-by: Etienne Cordonnier <[email protected]>
My libc PR got merged and backported to the 0.2 branch, so I've sent a PR to re-enable utmpx for musl in uutils-coreutils. However this will be mergeable only after libc version 0.2.172 is released (I think it will take maximum 1-2 months, looking at their release frequency). I have tested how those stub functions are handled in GNU coreutils. As you can see in my tests GNU coreutils has no special handling for musl, and returns a success exit value even though the commands don't find the users on the system. I think uutils coreutils should do the same thing and ship those utilities as-is when compiling with musl, in order to be a drop-in replacement for GNU coreutils also when it is compiled with musl:
|
musl provides stubs of those functions, so let's enable the feature so that it can compile with musl. Note that those stubs always return a success exit value, and commands such as "users" will report an empty list of users, when calling those stubs. This is consistent with the behavior of GNU coreutils which does the same thing. The coreutils utillities using utmpx are "pinky", "uptime", "users", "who". This is the expected behavior when using those utilities compiled with those musl utmpx stubs: ``` root@qemuarm64:~# users root@qemuarm64:~# echo $? 0 root@qemuarm64:~# pinky Login Name TTY Idle When Where root@qemuarm64:~# echo $? 0 root@qemuarm64:~# uptime 12:58:47 up 0 min, 0 users, load average: 0.07, 0.02, 0.00 root@qemuarm64:~# echo $? 0 root@qemuarm64:~# who root@qemuarm64:~# echo $? 0 ``` Closes uutils#1361 Signed-off-by: Etienne Cordonnier <[email protected]>
musl provides stubs of those functions, and those stubs are available in the libc crate version 0.2.172. Thus let's enable the feature so that it can compile with musl. Note that those stubs always return a success exit value, and commands such as "users" will report an empty list of users, when calling those stubs. This is consistent with the behavior of GNU coreutils which does the same thing. The coreutils utillities using utmpx are "pinky", "uptime", "users", "who". This is the expected behavior when using those utilities compiled with those musl utmpx stubs: ``` root@qemuarm64:~# users root@qemuarm64:~# echo $? 0 root@qemuarm64:~# pinky Login Name TTY Idle When Where root@qemuarm64:~# echo $? 0 root@qemuarm64:~# uptime 12:58:47 up 0 min, 0 users, load average: 0.07, 0.02, 0.00 root@qemuarm64:~# echo $? 0 root@qemuarm64:~# who root@qemuarm64:~# echo $? 0 ``` Closes uutils#1361 Signed-off-by: Etienne Cordonnier <[email protected]>
musl provides stubs of those functions, and those stubs are available in the libc crate version 0.2.172. Thus let's enable the feature so that it can compile with musl. Note that those stubs always return a success exit value, and commands such as "users" will report an empty list of users, when calling those stubs. This is consistent with the behavior of GNU coreutils which does the same thing. The coreutils utillities using utmpx are "pinky", "uptime", "users", "who". This is the expected behavior when using those utilities compiled with those musl utmpx stubs: ``` root@qemuarm64:~# users root@qemuarm64:~# echo $? 0 root@qemuarm64:~# pinky Login Name TTY Idle When Where root@qemuarm64:~# echo $? 0 root@qemuarm64:~# uptime 12:58:47 up 0 min, 0 users, load average: 0.07, 0.02, 0.00 root@qemuarm64:~# echo $? 0 root@qemuarm64:~# who root@qemuarm64:~# echo $? 0 ``` Closes uutils#1361 Signed-off-by: Etienne Cordonnier <[email protected]>
musl provides stubs of those functions, and those stubs are available in the libc crate version 0.2.172. Thus let's enable the feature so that it can compile with musl. Note that those stubs always return a success exit value, and commands such as "users" will report an empty list of users, when calling those stubs. This is consistent with the behavior of GNU coreutils which does the same thing. The coreutils utillities using utmpx are "pinky", "uptime", "users", "who". This is the expected behavior when using those utilities compiled with those musl utmpx stubs: ``` root@qemuarm64:~# users root@qemuarm64:~# echo $? 0 root@qemuarm64:~# pinky Login Name TTY Idle When Where root@qemuarm64:~# echo $? 0 root@qemuarm64:~# uptime 12:58:47 up 0 min, 0 users, load average: 0.07, 0.02, 0.00 root@qemuarm64:~# echo $? 0 root@qemuarm64:~# who root@qemuarm64:~# echo $? 0 ``` Closes uutils#1361 Signed-off-by: Etienne Cordonnier <[email protected]>
bump libc to 0.2.172 musl provides stubs of utmpx functions, and those stubs are available in the libc crate version 0.2.172. Thus let's enable the feature so that it can compile with musl. Note that those stubs always return a success exit value, and commands such as "users" will report an empty list of users, when calling those stubs. This is consistent with the behavior of GNU coreutils which does the same thing. The coreutils utillities using utmpx are "pinky", "uptime", "users", "who". This is the expected behavior when using those utilities compiled with those musl utmpx stubs: ``` root@qemuarm64:~# users root@qemuarm64:~# echo $? 0 root@qemuarm64:~# pinky Login Name TTY Idle When Where root@qemuarm64:~# echo $? 0 root@qemuarm64:~# uptime 12:58:47 up 0 min, 0 users, load average: 0.07, 0.02, 0.00 root@qemuarm64:~# echo $? 0 root@qemuarm64:~# who root@qemuarm64:~# echo $? 0 ``` Closes uutils#1361 Signed-off-by: Etienne Cordonnier <[email protected]>
bump libc to 0.2.172 musl provides stubs of utmpx functions, and those stubs are available in the libc crate version 0.2.172. Thus let's enable the feature so that it can compile with musl. Note that those stubs always return a success exit value, and commands such as "users" will report an empty list of users, when calling those stubs. This is consistent with the behavior of GNU coreutils which does the same thing. The coreutils utillities using utmpx are "pinky", "uptime", "users", "who". This is the expected behavior when using those utilities compiled with those musl utmpx stubs: ``` root@qemuarm64:~# users root@qemuarm64:~# echo $? 0 root@qemuarm64:~# pinky Login Name TTY Idle When Where root@qemuarm64:~# echo $? 0 root@qemuarm64:~# uptime 12:58:47 up 0 min, 0 users, load average: 0.07, 0.02, 0.00 root@qemuarm64:~# echo $? 0 root@qemuarm64:~# who root@qemuarm64:~# echo $? 0 ``` Closes uutils#1361 Signed-off-by: Etienne Cordonnier <[email protected]>
cabulertion.
i had problem while building uutils on musl
namely i am getting errors :
The text was updated successfully, but these errors were encountered: