Skip to content

Commit

Permalink
rust: remove libunwind
Browse files Browse the repository at this point in the history
fixes: void-linux#3605

[ci skip]
  • Loading branch information
jnbr committed Oct 11, 2018
1 parent afabf80 commit fab3ddc
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 2 deletions.
75 changes: 75 additions & 0 deletions srcpkgs/rust/patches/libunwind.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
use libgcc_s for unwind, no need for libunwind.a on musl
https://github.com/void-linux/void-packages/issues/3605


--- rustc-1.28.0-src/src/libunwind/build.rs.orig 2018-10-11 10:37:16.617653976 +0200
+++ rustc-1.28.0-src/src/libunwind/build.rs 2018-10-11 10:37:33.584492467 +0200
@@ -15,9 +15,7 @@
let target = env::var("TARGET").expect("TARGET was not set");

if target.contains("linux") {
- if target.contains("musl") {
- // musl is handled in lib.rs
- } else if !target.contains("android") {
+ if !target.contains("android") {
println!("cargo:rustc-link-lib=gcc_s");
}
} else if target.contains("freebsd") {
--- rustc-1.28.0-src/src/libunwind/lib.rs.orig 2018-10-11 10:37:51.012326568 +0200
+++ rustc-1.28.0-src/src/libunwind/lib.rs 2018-10-11 10:38:03.512207577 +0200
@@ -33,8 +33,3 @@
pub use libunwind::*;
}
}
-
-#[cfg(target_env = "musl")]
-#[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))]
-#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
-extern {}

--- rustc-1.28.0-src/src/bootstrap/sanity.rs.orig 2018-10-11 10:29:34.169735519 +0200
+++ rustc-1.28.0-src/src/bootstrap/sanity.rs 2018-10-11 10:30:02.467509880 +0200
@@ -21,7 +21,7 @@
use std::collections::HashMap;
use std::env;
use std::ffi::{OsString, OsStr};
-use std::fs::{self, File};
+use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
use std::process::Command;
@@ -186,34 +186,6 @@
}
}

- // Make sure musl-root is valid
- if target.contains("musl") {
- // If this is a native target (host is also musl) and no musl-root is given,
- // fall back to the system toolchain in /usr before giving up
- if build.musl_root(*target).is_none() && build.config.build == *target {
- let target = build.config.target_config.entry(target.clone())
- .or_insert(Default::default());
- target.musl_root = Some("/usr".into());
- }
- match build.musl_root(*target) {
- Some(root) => {
- if fs::metadata(root.join("lib/libc.a")).is_err() {
- panic!("couldn't find libc.a in musl dir: {}",
- root.join("lib").display());
- }
- if fs::metadata(root.join("lib/libunwind.a")).is_err() {
- panic!("couldn't find libunwind.a in musl dir: {}",
- root.join("lib").display());
- }
- }
- None => {
- panic!("when targeting MUSL either the rust.musl-root \
- option or the target.$TARGET.musl-root option must \
- be specified in config.toml")
- }
- }
- }
-
if target.contains("msvc") {
// There are three builds of cmake on windows: MSVC, MinGW, and
// Cygwin. The Cygwin build does not have generators for Visual
4 changes: 2 additions & 2 deletions srcpkgs/rust/template
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ patch_args="-Np1"
build_style=configure
make_build_args="dist VERBOSE=1"
hostmakedepends="cmake curl pkg-config python"
makedepends="libffi-devel llvm ncurses-devel libxml2-devel libunwind-devel zlib-devel"
makedepends="libffi-devel llvm ncurses-devel libxml2-devel zlib-devel"
short_desc="Safe, concurrent, practical systems language"
maintainer="Enno Boland <gottox@voidlinux.eu>"
homepage="https://www.rust-lang.org/"
Expand All @@ -24,7 +24,7 @@ if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" cargo llvm"

# These are required for building the buildhost's stage0/1
hostmakedepends+=" libffi-devel libxml2-devel libunwind-devel
hostmakedepends+=" libffi-devel libxml2-devel
ncurses-devel zlib-devel"
else
case "$XBPS_MACHINE" in
Expand Down

3 comments on commit fab3ddc

@Cogitri
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for libunwind.a on musl

So it's still needed for glibc and as such libunwind-devel shouldn't be removed from dependencies for glibc builds?

@jnbr
Copy link
Owner Author

@jnbr jnbr commented on fab3ddc Oct 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, should reword this. Only if compiling for musl, bootstrap/sanity.rs checks for libunwind.a. We don't need it in any of the cases.

@Cogitri
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, alright.

Please sign in to comment.