RT 安装了 https://github.com/messense/homebrew-macos-cross-toolchains 似乎也不好使,有没有大佬帮帮我
1
liuxu 2023-03-08 18:12:29 +08:00
你 cargo 带上--target 就行了 https://rust-lang.github.io/rustup/cross-compilation.html ,这是 rust 目前支持的 CPU 架构 https://doc.rust-lang.org/nightly/rustc/platform-support.html
|
2
horizon OP |
3
horizon OP |
4
liuxu 2023-03-09 11:21:13 +08:00
|
5
horizon OP @liuxu 感谢解答。
错误如下: ``` Caused by: process didn't exit successfully: `/Users/linctex/Workspace/dufs/target/debug/build/ring-e3146748fc8e5aed/build-script-build` (exit status: 101) --- stdout OPT_LEVEL = Some("0") TARGET = Some("x86_64-unknown-linux-gnu") HOST = Some("aarch64-apple-darwin") cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu CC_x86_64-unknown-linux-gnu = None cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu CC_x86_64_unknown_linux_gnu = None cargo:rerun-if-env-changed=TARGET_CC TARGET_CC = None cargo:rerun-if-env-changed=CC CC = None RUSTC_LINKER = None cargo:rerun-if-env-changed=CROSS_COMPILE CROSS_COMPILE = None cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu CFLAGS_x86_64-unknown-linux-gnu = None cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu CFLAGS_x86_64_unknown_linux_gnu = None cargo:rerun-if-env-changed=TARGET_CFLAGS TARGET_CFLAGS = None cargo:rerun-if-env-changed=CFLAGS CFLAGS = None cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS CRATE_CC_NO_DEFAULTS = None DEBUG = Some("true") CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2") --- stderr running "x86_64-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-g3" "-DNDEBUG" "-c" "-o/Users/linctex/Workspace/dufs/target/x86_64-unknown-linux-gnu/debug/build/ring-574835f3f1e4e3d0/out/aesni-x86_64-elf.o" "/Users/linctex/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/aesni-x86_64-elf.S" thread 'main' panicked at 'failed to execute ["x86_64-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-g3" "-DNDEBUG" "-c" "-o/Users/linctex/Workspace/dufs/target/x86_64-unknown-linux-gnu/debug/build/ring-574835f3f1e4e3d0/out/aesni-x86_64-elf.o" "/Users/linctex/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/aesni-x86_64-elf.S"]: No such file or directory (os error 2)', /Users/linctex/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/build.rs:653:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace warning: build failed, waiting for other jobs to finish... ``` |
6
liuxu 2023-03-09 12:01:53 +08:00
看上去是没有 x86_64_unknown_linux_gnu 编译工具链,rustup target list 看看你安装了没,没有就 rustup target add x86_64-unknown-linux-gnu 安装下
|
8
liuxu 2023-03-09 17:03:20 +08:00 1
@horizon 我也是 M1 ,这个应该就是 CC_x86_64_unknown_linux_gnu 编译器和连接器不对的原因,依赖有问题的项目是 https://github.com/briansmith/ring
用 CC_x86_64_unknown_linux_gnu=clang cargo build...是可以过掉这个 aesni-x86_64-elf.S 文件编译的 还编译不过我感觉需要给 homebrew-macos-cross-toolchains 或者 briansmith/ring 发 issue |
10
whoami9894 2023-03-09 17:25:04 +08:00
交叉编译 ring 这种非 pure Rust 项目需要对应的 cc 工具链,报错这么明显告诉你 x86_64-linux-gnu-gcc: No such file
|
11
horizon OP @whoami9894 谢谢
|
12
horizon OP @whoami9894 感谢,安装了 llvm 好了
|
13
horizon OP |
14
proxytoworld 2023-03-15 01:05:11 +08:00 1
这是编译成了 musl ,不是 gnu target
|
15
horizon OP |