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
dev-lang/rust: fix the build with musl-1.2.4 #31205
Conversation
Pull Request assignmentSubmitter: @orbea dev-lang/rust: @gyakovlev, @gentoo/rust Linked bugsBugs linked: 903607 In order to force reassignment and/or bug reference scan, please append Docs: Code of Conduct ● Copyright policy (expl.) ● Devmanual ● GitHub PRs ● Proxy-maint guide |
Pull request CI reportReport generated at: 2023-05-28 23:43 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
Would it potentially be a good idea to have a dependency along the lines of
to ensure people aren't trying to build it without system-bootstrap on 1.2.4? |
Good idea, I updated the PR. It seems there is already a |
Pull request CI reportReport generated at: 2023-06-01 13:24 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
I updated this PR for rust-1.70.0. @gyakovlev Can you please review this PR, its a blocking issue for me. |
Pull request CI reportReport generated at: 2023-06-05 00:29 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
Pull request CI reportReport generated at: 2023-06-05 17:24 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
783738e
to
f8bcc5d
Compare
Pull request CI reportReport generated at: 2023-06-08 18:44 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
@gyakovlev Can you please review this? Its a pain to rebase this over and over again. |
Pull request CI reportReport generated at: 2023-06-09 16:39 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
Would probably be a good idea to re-add 1.69 since 1.70 is now unkeyworded and masked. |
Downgrading rust is unfortunately a lot of effort to test. |
Did it myself, working fine for me. |
(Plus it was working fine before, so it should be fine.) |
If @gyakovlev wants it I can add it back, but until I hear something one way or another I'd prefer to do as little work as possible. |
Pull request CI reportReport generated at: 2023-06-29 15:35 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
Downgrading musl works if only a few packages have been compiled with
|
What I've been doing is reverting the musl commits that removed lfs64 support before rebuilding rust. I don't know if this would be feasible, however the only thing I can think of that would be able to fix it is adding a default disabled USE flag to musl that reverts the LFS64 removal until the issue gets fixed upstream, and then adding something like
Obviously this would be an inelegant fix but I don't think there's a particularly good solution to this until Rust gets it together and finally fixes it upstream. |
Fwiw I believe this is the only rust PR we are waiting on. rust-lang/rust#106246 Conditional patches for musl sounds like an even bigger mess to me. |
Yeah, at this point it's probably best to just wait on upstream until the fixes make it into the bootstrap tarballs. |
That only makes it harder for anyone with musl-1.2.4 and downgrading your system could be problematic regardless if rust is fixed or not. Also we might be waiting a long time... |
I'm using this wrapper to workaround linking issue for upstream release #include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>
int fstat64(int fd, struct stat *statbuf) {
return fstat(fd, statbuf);
}
off_t lseek64(int fd, off_t offset, int whence) {
return lseek(fd, offset, whence);
}
int stat64(const char* pathname, struct stat* statbuf) {
return stat(pathname, statbuf);
}
int open64(const char* pathname, int flags) {
return open(pathname, flags);
}
int openat64(int dirfd, const char* pathname, int flags, mode_t mode) {
return openat(dirfd, pathname, flags, mode);
}
int fstatat64(int dirfd, const char* pathname, struct stat* statbuf, int flags) {
return fstatat(dirfd, pathname, statbuf, flags);
}
struct dirent* readdir64(DIR *dirp) {
return readdir(dirp);
}
int lstat64(const char* pathname, struct stat* statbuf) {
return lstat(pathname, statbuf);
} Compile this to archive file (eg.
|
Here's a very hacky solution that allows bootstrapping from the stage0 tarball without downgrading or patching musl, using objcopy to redefine symbols in the rust stdlib: src_prepare() {
eapply_crate vendor/getrandom "${FILESDIR}"/1.69.0-musl-1.2.4-getrandom.patch
eapply_crate vendor/libc-0.2.138 "${FILESDIR}"/1.69.0-musl-1.2.4-libc-0.2.138.patch
eapply_crate vendor/libc-0.2.139 "${FILESDIR}"/1.69.0-musl-1.2.4-libc.patch
eapply_crate vendor/libc "${FILESDIR}"/1.69.0-musl-1.2.4-libc.patch
if ! use system-bootstrap; then
has_version sys-devel/gcc || esetup_unwind_hack
local rust_stage0_root="${WORKDIR}"/rust-stage0
local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)"
if use elibc_musl; then
LIBSTD="${WORKDIR}/${rust_stage0}/rust-std-$(rust_abi)/lib/rustlib/$(rust_abi)/lib/libstd-"*".rlib"
"$(tc-getOBJCOPY)" \
--redefine-sym=stat64=stat \
--redefine-sym=fstat64=fstat \
--redefine-sym=lstat64=lstat \
--redefine-sym=open64=open \
--redefine-sym=readdir64=readdir \
--redefine-sym=fstatat64=fstatat \
--redefine-sym=lseek64=lseek \
--redefine-sym=ftruncate64=ftruncate \
"${LIBSTD}" \
"${LIBSTD}.out" || die
mv "${LIBSTD}.out" "${LIBSTD}" || die
fi
"${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig \
--without=rust-docs-json-preview,rust-docs --destdir="${rust_stage0_root}" --prefix=/ || die
fi
default
} |
Would that be compatible with both gcc and clang? Also |
Yes. All functions on >=musl-1.2 are automatically 64-bit, and this works with both LLVM and GNU binutils. |
@vimproved I pushed your suggestion with minor changes. |
Pull request CI reportReport generated at: 2023-07-16 17:10 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
Pull request CI reportReport generated at: 2023-07-17 00:45 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
You mean >=musl-0.5.0. |
Pull request CI reportReport generated at: 2023-07-20 19:40 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
Didn't know that, thanks for the correction. Was thinking of 64-bit time_t probably. |
Pull request CI reportReport generated at: 2023-07-21 22:11 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
Pull request CI reportReport generated at: 2023-07-24 19:40 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
Pull request CI reportReport generated at: 2023-08-04 16:20 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
@xen0n Can you please review this PR? |
This fixes the build with musl-1.2.4, may need -system-bootstrap after updating musl. Closes: https://bugs.gentoo.org/903607 Upstream-PR: rust-lang/rust#106246 Upstream-Issue: rust-lang/libc#2934 Upstream-PR: rust-lang/libc#2935 Upstream-Commit: rust-lang/libc@1e8c55c Upstream-PR: rust-random/getrandom#326 Upstream-Commit: rust-random/getrandom@7f73e3c Signed-off-by: orbea <orbea@riseup.net>
Pull request CI reportReport generated at: 2023-08-07 01:05 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
This fixes the build with musl-1.2.4, may need
-system-bootstrap
after updating musl.Closes: https://bugs.gentoo.org/903607
Upstream-PR: rust-lang/rust#106246
Upstream-Issue: rust-lang/libc#2934
Upstream-PR: rust-lang/libc#2935
Upstream-Commit: rust-lang/libc@1e8c55c
Upstream-PR: rust-random/getrandom#326
Upstream-Commit: rust-random/getrandom@7f73e3c