-
Notifications
You must be signed in to change notification settings - Fork 102
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
macOS aarch64 compile bug #1501
Comments
This is bytecodealliance/wasmtime#8730, which is an incompatibility with the new linker of XCode 15. As workaround you can use |
ok cool... how would I add this to which |
I think the following would work: [target. "aarch64-apple-darwin"]
rustflags = ["-Clink-arg=-ld_classic"] |
yea I was trying that but for some reason I needed to add RUSTFLAGS env variable instead 🤷♂️. welp maybe I will figure out why later. |
What is the exact command that works? The following command still fails for me. RUSTFLAGS="-Clink-arg=-ld_classic" ./y.sh build Using the normal cargo build command works but the executable is not functional. # The following command builds
RUSTFLAGS="-Clink-arg=-ld_classic" cargo build
# The executable gives the following error
cargo-clif build
error[E0463]: can't find crate for `core`
|
= note: the `aarch64-apple-darwin` target may not be installed
= help: consider downloading the target with `rustup target add aarch64-apple-darwin`
= help: consider building the standard library from source with `cargo build -Zbuild-std` Thank you in advance. |
There are two options:
diff --git a/build_system/build_sysroot.rs b/build_system/build_sysroot.rs
index dfbe0f51..9e0327b9 100644
--- a/build_system/build_sysroot.rs
+++ b/build_system/build_sysroot.rs
@@ -241,7 +241,7 @@ fn build_clif_sysroot_for_triple(
}
// Build sysroot
- let mut rustflags = vec!["-Zforce-unstable-if-unmarked".to_owned(), "-Cpanic=abort".to_owned()];
+ let mut rustflags = vec!["-Zforce-unstable-if-unmarked".to_owned(), "-Cpanic=abort".to_owned(), "-Clink-arg=-Wl,-ld_classic".to_owned()];
match cg_clif_dylib_path {
CodegenBackend::Local(path) => {
rustflags.push(format!("-Zcodegen-backend={}", path.to_str().unwrap()));
diff --git a/scripts/cargo-clif.rs b/scripts/cargo-clif.rs
index 1e14f41d..ed29f8d3 100644
--- a/scripts/cargo-clif.rs
+++ b/scripts/cargo-clif.rs
@@ -12,7 +12,7 @@ fn main() {
sysroot = sysroot.parent().unwrap();
}
- let mut rustflags = vec!["-Cpanic=abort".to_owned(), "-Zpanic-abort-tests".to_owned()];
+ let mut rustflags = vec!["-Cpanic=abort".to_owned(), "-Zpanic-abort-tests".to_owned(), "-Clink-arg=-Wl,-ld_classic".to_owned()];
if let Some(name) = option_env!("BUILTIN_BACKEND") {
rustflags.push(format!("-Zcodegen-backend={name}"));
} else {
diff --git a/scripts/rustc-clif.rs b/scripts/rustc-clif.rs
index 92defd21..bf432f2f 100644
--- a/scripts/rustc-clif.rs
+++ b/scripts/rustc-clif.rs
@@ -19,6 +19,7 @@ fn main() {
let mut args = vec![];
args.push(OsString::from("-Cpanic=abort"));
args.push(OsString::from("-Zpanic-abort-tests"));
+ args.push(OsString::from("-Clink-arg=-Wl,-ld_classic"));
if let Some(name) = option_env!("BUILTIN_BACKEND") {
args.push(OsString::from(format!("-Zcodegen-backend={name}")))
} else {
diff --git a/scripts/rustdoc-clif.rs b/scripts/rustdoc-clif.rs
index 1cad312b..47592db4 100644
--- a/scripts/rustdoc-clif.rs
+++ b/scripts/rustdoc-clif.rs
@@ -19,6 +19,7 @@ fn main() {
let mut args = vec![];
args.push(OsString::from("-Cpanic=abort"));
args.push(OsString::from("-Zpanic-abort-tests"));
+ args.push(OsString::from("-Clink-arg=-Wl,-ld_classic"));
if let Some(name) = option_env!("BUILTIN_BACKEND") {
args.push(OsString::from(format!("-Zcodegen-backend={name}")))
} else {
|
Thank you very much @bjorn3. The second solution worked great. Should the errorserror[E0463]: can't find crate for `jobserver`
--> src/lib.rs:15:1
|
15 | extern crate jobserver;
| ^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
error[E0463]: can't find crate for `rustc_middle`
--> src/lib.rs:17:1
|
17 | extern crate rustc_middle;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_ast`
--> src/lib.rs:18:1
|
18 | extern crate rustc_ast;
| ^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_codegen_ssa`
--> src/lib.rs:19:1
|
19 | extern crate rustc_codegen_ssa;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_data_structures`
--> src/lib.rs:20:1
|
20 | extern crate rustc_data_structures;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_errors`
--> src/lib.rs:21:1
|
21 | extern crate rustc_errors;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_fs_util`
--> src/lib.rs:22:1
|
22 | extern crate rustc_fs_util;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_hir`
--> src/lib.rs:23:1
|
23 | extern crate rustc_hir;
| ^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_incremental`
--> src/lib.rs:24:1
|
24 | extern crate rustc_incremental;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_index`
--> src/lib.rs:25:1
|
25 | extern crate rustc_index;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_metadata`
--> src/lib.rs:26:1
|
26 | extern crate rustc_metadata;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_monomorphize`
--> src/lib.rs:27:1
|
27 | extern crate rustc_monomorphize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_session`
--> src/lib.rs:28:1
|
28 | extern crate rustc_session;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_span`
--> src/lib.rs:29:1
|
29 | extern crate rustc_span;
| ^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_target`
--> src/lib.rs:30:1
|
30 | extern crate rustc_target;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
error[E0463]: can't find crate for `rustc_driver`
--> src/lib.rs:34:1
|
34 | extern crate rustc_driver;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview` |
|
The text was updated successfully, but these errors were encountered: