Skip to content

rust: update to 1.85.0#23426

Merged
ognevny merged 1 commit intomsys2:masterfrom
ognevny:update-rust
Feb 21, 2025
Merged

rust: update to 1.85.0#23426
ognevny merged 1 commit intomsys2:masterfrom
ognevny:update-rust

Conversation

@ognevny
Copy link
Collaborator

@ognevny ognevny commented Feb 18, 2025

  • remove backports
  • do not package rust-src for i686
  • (taken from arch) apply --long option to zstd for pkg tarball
  • strip wasm .rlib files manually

config change:

@ognevny
Copy link
Collaborator Author

ognevny commented Feb 18, 2025

IIUC after this change libunwind will be linked dynamically for gnullvm targets

@mati865 am I correct?

@mati865
Copy link
Collaborator

mati865 commented Feb 18, 2025

Yes, but this was already present in 1.84.0.

@ognevny
Copy link
Collaborator Author

ognevny commented Feb 18, 2025

Yes, but this was already present in 1.84.0.

in relevant PR rustbot put it into 1.85.0 milestone

@ognevny
Copy link
Collaborator Author

ognevny commented Feb 18, 2025

in relevant PR rustbot put it into 1.85.0 milestone

yeah, now some executables now link libunwind.dll

  /clang64/bin/cargo-fmt.exe:
  	libunwind.dll => D:\M\msys64\clang64\bin\libunwind.dll (0x0000019ceb470000)
  /clang64/bin/cargo.exe:
  	libunwind.dll => D:\M\msys64\clang64\bin\libunwind.dll (0x000001aa355d0000)

I'll open a separate PR for rebuilding all rust-based packages with

if [[ ${MINGW_PACKAGE_PREFIX} == *-clang-* ]]; then
  depends=("${MINGW_PACKAGE_PREFIX}-libunwind")
fi

being put where needed

@mati865
Copy link
Collaborator

mati865 commented Feb 18, 2025

Yes, but this was already present in 1.84.0.

in relevant PR rustbot put it into 1.85.0 milestone

Ah, you are right. I had looked at the milestone at rust-lang/rust#132965

@mati865
Copy link
Collaborator

mati865 commented Feb 18, 2025

I'll open a separate PR for rebuilding all rust-based packages with

if [[ ${MINGW_PACKAGE_PREFIX} == *-clang-* ]]; then
  depends=("${MINGW_PACKAGE_PREFIX}-libunwind")
fi

being put where needed

There is no specific need to rebuild them. Both std and unwinder are linked statically so they won't break.

Regarding libunwind, it provides *-gcc-libs package, so anything that depends on *-gcc-libs will pull libunwind in CLANG* envs:

depends=($( (( _clangprefix )) || echo "${MINGW_PACKAGE_PREFIX}-gcc-libs"))

@ognevny
Copy link
Collaborator Author

ognevny commented Feb 18, 2025

Regarding libunwind, it provides *-gcc-libs package, so anything that depends on *-gcc-libs will pull libunwind in CLANG* envs:

I meant that majority of rust-based packages here doesn't depend on any library. and libunwind.dll becomes the only dll linked (and for CLANG*) only. rust itself will always ship libunwind, so it'll be always linked

@ognevny
Copy link
Collaborator Author

ognevny commented Feb 18, 2025

and also libc++ provides gcc-libs, libunwind only depends on it in CLANG* environments. in non-clang envs libunwind is not a dependency of gcc-libs

@mati865
Copy link
Collaborator

mati865 commented Feb 18, 2025

and also libc++ provides gcc-libs, libunwind only depends on it in CLANG* environments. in non-clang envs libunwind is not a dependency of gcc-libs

Right. What I meant to tell is all packages using Rust as the compiler depend or libgcc_s.dll in GNU envs and soon libunwind.dll in LLVM envs. So adding libunwind as the dependency seems weird, since they don't depend on gcc-libs in GNU envs.

@ognevny
Copy link
Collaborator Author

ognevny commented Feb 18, 2025

Right. What I meant to tell is all packages using Rust as the compiler depend or libgcc_s.dll in GNU envs.

libgcc_s is linked statically IIRC

So adding libunwind as the dependency seems weird, since they don't depend on gcc-libs in GNU envs.

that's why I will put libunwind conditionally

@mati865
Copy link
Collaborator

mati865 commented Feb 18, 2025

Right. What I meant to tell is all packages using Rust as the compiler depend or libgcc_s.dll in GNU envs.

libgcc_s is linked statically IIRC

No, there are two libraries: libgcc_eh.a and libgcc_s.dll.a. First one is static, the other one is an import library for shared library.
Rust, just like other compiler links shared library, so resulting binaries depend on it.

@ognevny
Copy link
Collaborator Author

ognevny commented Feb 18, 2025

libgcc_s is linked statically IIRC

windows-gnu should have crt_static_allow_dylib: true like windows-gnullvm, right?

@ognevny
Copy link
Collaborator Author

ognevny commented Feb 18, 2025

No, there are two libraries: libgcc_eh.a and libgcc_s.dll.a. First one is static, the other one is an import library for shared library. Rust, just like other compiler links shared library, so resulting binaries depend on it.

I've just checked lsd package. the binary depends only on windows libs, but none from msys2

$ ntldd -R /ucrt64/bin/lsd | rg msys
<empty>

@mati865
Copy link
Collaborator

mati865 commented Feb 18, 2025

Ah, I forgot about late_link_args_dynamic and late_link_args_static. So, binaries created for windows-gnu will use static unwinder if they don't depend on other shared libraries, like in lsd's case. I don't want to reboot into Windows right now but I'm confident if you inspect uv package or any other package depending on any DLL (regardless if the DLL needs unwinder or not), ntldd will show libgcc_s.

windows-gnullvm can be controlled whether to link static or shared unwind library with crt-static: https://doc.rust-lang.org/reference/linkage.html#r-link.crt.crt-static
Either by passing it via RUSTFLAGS or command line.

windows-gnu should have crt_static_allow_dylib: true like windows-gnullvm, right?

I cannot without bigger changes, right that would clash with its logic for determining which unwind library to link.


EDIT: Ideally both targets would share the same logic (and be controllable via crt-static), but that won't happen soon.

@ognevny ognevny force-pushed the update-rust branch 3 times, most recently from c4548b5 to 8adb767 Compare February 20, 2025 18:34
@ognevny ognevny marked this pull request as ready for review February 20, 2025 18:35
@mati865
Copy link
Collaborator

mati865 commented Feb 20, 2025

@ognevny
Copy link
Collaborator Author

ognevny commented Feb 20, 2025

but, why not having dynamic crt here (even when it's only for CLANG environments)? it's not hard to maintain the requirement of having libunwind installed to use rust-based binaries

@mati865
Copy link
Collaborator

mati865 commented Feb 20, 2025

Only to avoid having to deal with PKGBUILDs updates.

@ognevny
Copy link
Collaborator Author

ognevny commented Feb 20, 2025

I understand you...

so I'll fill an issue upstream for crt-static support for windows-gnu tomorrow (you can actually do this too). also I'll push that config change you mentioned. in some cases I'll use -crt-static if other dlls are linked

@ognevny ognevny merged commit 2f1b2da into msys2:master Feb 21, 2025
7 checks passed
@ognevny ognevny deleted the update-rust branch February 21, 2025 07:48
@ognevny
Copy link
Collaborator Author

ognevny commented Feb 24, 2025

looks like one of the removed backport will come back again: rust-lang/rust#137460

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments