From beecee9a8cceb41613567dd6fb44b547fb48e6f2 Mon Sep 17 00:00:00 2001 From: Wenlong Zhang Date: Fri, 22 Nov 2024 16:52:15 +0800 Subject: [PATCH 1/2] fix build error for loongarch64 --- 0001-fix-build-error-for-loongarch64.patch | 11 +++++++++++ rust.spec | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 0001-fix-build-error-for-loongarch64.patch diff --git a/0001-fix-build-error-for-loongarch64.patch b/0001-fix-build-error-for-loongarch64.patch new file mode 100644 index 0000000..4acb4e8 --- /dev/null +++ b/0001-fix-build-error-for-loongarch64.patch @@ -0,0 +1,11 @@ +--- a/vendor/compiler_builtins-0.1.123/configure.rs ++++ b/vendor/compiler_builtins-0.1.123/configure.rs +@@ -72,6 +72,8 @@ pub fn configure_f16_f128(target: &Target) { + "sparc" | "sparcv9" => (true, false), + // `f16` miscompiles + "wasm32" | "wasm64" => (false, true), ++ "loongarch64" => (false, true), ++ "riscv64" | "riscv64gc" => (false, true), + // Most everything else works as of LLVM 19 + _ => (true, true), + }; diff --git a/rust.spec b/rust.spec index ee1d4a9..bbf3c5a 100644 --- a/rust.spec +++ b/rust.spec @@ -19,7 +19,7 @@ Name: rust Version: 1.82.0 -Release: 4 +Release: 5 Summary: The Rust Programming Language License: Apache-2.0 OR MIT URL: https://www.rust-lang.org @@ -39,6 +39,7 @@ Patch0002: rustc-1.70.0-rust-gdb-substitute-path.patch Patch0003: 0001-add-support-for-ppc64le.patch # https://github.com/rust-lang/rust/pull/130034 (from 1.83) Patch0004: 0001-Fix-enabling-wasm-component-ld-to-match-other-tools.patch +Patch0005: 0001-fix-build-error-for-loongarch64.patch %{lua: function rust_triple(arch) local abi = "gnu" @@ -277,6 +278,7 @@ sed -i.try-python -e '/^try python3 /i try "%{python}" "$@"' ./configure %patch -P 0002 -p1 %patch -P 0003 -p1 %patch -P 0004 -p1 +%patch -P 0005 -p1 rm -rf vendor/curl-sys*/curl/ rm -rf vendor/jemalloc-sys/jemalloc/ rm -rf vendor/libffi-sys*/libffi/ @@ -545,6 +547,9 @@ export %{rust_env} %{_mandir}/man1/cargo*.1* %changelog +* Fri Nov 29 2024 Wenlong Zhang - 1.82.0-5 +- fix build error for loongarch64 + * Fri Nov 29 2024 jchzhou - 1.82.0-4 - Fix a minor unpackaged file issue -- Gitee From 2ee37cd58a5686ba86d6e5fe510f8bcc76a79989 Mon Sep 17 00:00:00 2001 From: jchzhou Date: Fri, 6 Dec 2024 11:49:37 +0800 Subject: [PATCH 2/2] Add a switch for the musl target & disable it for loongarch64 & riscv64 Signed-off-by: jchzhou Co-authored-by: misaka00251 --- rust.spec | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/rust.spec b/rust.spec index bbf3c5a..5b5eb6e 100644 --- a/rust.spec +++ b/rust.spec @@ -17,9 +17,13 @@ %bcond_with rust_lld %endif +%ifnarch riscv64 loongarch64 +%bcond_without musl_target +%endif + Name: rust Version: 1.82.0 -Release: 5 +Release: 6 Summary: The Rust Programming Language License: Apache-2.0 OR MIT URL: https://www.rust-lang.org @@ -100,10 +104,10 @@ BuildRequires: cargo >= %{bootstrap_cargo} BuildRequires: (%{name} >= %{bootstrap_rust} with %{name} <= %{version}) %global local_rust_root %{_prefix} %endif -%ifarch loongarch64 -BuildRequires: make gcc gcc-c++ ncurses-devel curl curl-devel pkgconfig(libcurl) pkgconfig(liblzma) -%else +%if %{with musl_target} BuildRequires: make gcc gcc-c++ ncurses-devel curl curl-devel musl-libc-static musl-gcc pkgconfig(libcurl) pkgconfig(liblzma) +%else +BuildRequires: make gcc gcc-c++ ncurses-devel curl curl-devel pkgconfig(libcurl) pkgconfig(liblzma) %endif BuildRequires: pkgconfig(openssl) pkgconfig(zlib) pkgconfig(libssh2) >= 1.6.0 gnupg2 wget %global python python3 @@ -356,12 +360,8 @@ test -r "%{profiler}" %configure --disable-option-checking \ --docdir=%{_pkgdocdir} \ --libdir=%{common_libdir} \ -%ifarch loongarch64 - --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \ -%else - %{rust_musl_root}=%{musl_root} \ - --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple},%{rust_musl_triple} \ -%endif + %{?with_musl_target:%{rust_musl_root}=%{musl_root}} \ + --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple}%{?with_musl_target:,%{rust_musl_triple}} \ --set target.%{rust_triple}.profiler="%{profiler}" \ %{!?with_rust_lld: --set rust.lld=false} \ --python=%{python} \ @@ -464,10 +464,9 @@ export %{rust_env} %{_libexecdir}/rust-analyzer-proc-macro-srv %endif %{rustlibdir}/%{rust_triple}/lib/*.so -%ifnarch loongarch64 +%if %{with musl_target} %dir %{rustlibdir}/%{rust_musl_triple} %dir %{rustlibdir}/%{rust_musl_triple}/lib -%{rustlibdir}/%{rust_musl_triple}/lib/*.so %endif %files std-static @@ -475,7 +474,7 @@ export %{rust_env} %dir %{rustlibdir}/%{rust_triple} %dir %{rustlibdir}/%{rust_triple}/lib %{rustlibdir}/%{rust_triple}/lib/*.rlib -%ifnarch loongarch64 +%if %{with musl_target} %dir %{rustlibdir}/%{rust_musl_triple} %dir %{rustlibdir}/%{rust_musl_triple}/lib %{rustlibdir}/%{rust_musl_triple}/lib/*.rlib @@ -547,6 +546,10 @@ export %{rust_env} %{_mandir}/man1/cargo*.1* %changelog +* Fri Dec 06 2024 jchzhou - 1.82.0-6 +- Co-authored-by: misaka00251 +- Add a switch for the musl target & disable it for loongarch64 & riscv64 + * Fri Nov 29 2024 Wenlong Zhang - 1.82.0-5 - fix build error for loongarch64 -- Gitee