-
Notifications
You must be signed in to change notification settings - Fork 364
Open
Description
Im using cargo-xwin.
build.rs(error comes from .generate()):
use std::env;
use std::path::PathBuf;
fn main() {
println!("cargo::rerun-if-changed=src");
println!("cargo::rerun-if-changed=cbindgen.toml");
// println!("cargo::rustc-flags=-C linker-flavor=gcc");
let crate_dir: String = env::var("CARGO_MANIFEST_DIR").unwrap();
let c_out_path: PathBuf = PathBuf::from(&crate_dir).join("include/plugin_api.h");
let cxx_out_path: PathBuf = PathBuf::from(&crate_dir).join("include/plugin_api.hpp");
cbindgen::Builder::new()
.with_crate(&crate_dir)
.with_config(cbindgen::Config::from_file("cbindgen.toml").unwrap())
.with_language(cbindgen::Language::C)
.with_include_guard("CG_PLUGIN_API_H")
.generate()
.expect("Unable to generate bindings")
.write_to_file(c_out_path);
cbindgen::Builder::new()
.with_crate(&crate_dir)
.with_config(cbindgen::Config::from_file("cbindgen.toml").unwrap())
.with_language(cbindgen::Language::Cxx)
.with_pragma_once(true)
.generate()
.expect("Unable to generate bindings")
.write_to_file(cxx_out_path);
}Build command:
cargo xwin build --target x86_64-pc-windows-msvc
I got that error:
error: failed to run custom build command for `plugin_runtime v0.1.0 (/crates/plugin_runtime)`
Caused by:
process didn't exit successfully: `/target/release/build/plugin_runtime-2d8d4dbe88cdc80e/build-script-build` (exit status: 101)
--- stdout
cargo::rerun-if-changed=src
cargo::rerun-if-changed=cbindgen.toml
--- stderr
thread 'main' (371664) panicked at crates/plugin_runtime/build.rs:19:10:
Unable to generate bindings: CargoMetadata("/crates/plugin_runtime/Cargo.toml", Metadata(Output { status: ExitStatus(unix_wait_status(25856)), stdout: "", stderr: "error: failed to run `rustc` to learn about target-specific information\n\nCaused by:\n process didn't exit successfully: `/home/corrm/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names -C 'link-arg=/STACK:8000000' -C linker-flavor=lld-link -Lnative=/home/corrm/.cache/cargo-xwin/xwin/crt/lib/x86_64 -Lnative=/home/corrm/.cache/cargo-xwin/xwin/sdk/lib/um/x86_64 -Lnative=/home/corrm/.cache/cargo-xwin/xwin/sdk/lib/ucrt/x86_64 --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg -Wwarnings` (exit status: 1)\n --- stdout\n ___\n lib___.rlib\n lib___.so\n lib___.so\n lib___.a\n lib___.so\n /home/corrm/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\n off\n packed\n unpacked\n ___\n debug_assertions\n panic=\"unwind\"\n proc_macro\n target_abi=\"\"\n target_arch=\"x86_64\"\n target_endian=\"little\"\n target_env=\"gnu\"\n target_family=\"unix\"\n target_feature=\"fxsr\"\n target_feature=\"sse\"\n target_feature=\"sse2\"\n target_has_atomic=\"16\"\n target_has_atomic=\"32\"\n target_has_atomic=\"64\"\n target_has_atomic=\"8\"\n target_has_atomic=\"ptr\"\n target_os=\"linux\"\n target_pointer_width=\"64\"\n target_vendor=\"unknown\"\n unix\n\n --- stderr\n error: linker flavor `lld-link` is incompatible with the current target\n |\n = note: compatible flavors are: gnu, gnu-lld, gnu-cc, gnu-lld-cc, gcc, ld, ld.lld\n\n error: aborting due to 1 previous error\n\n" }))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
To make it ez to read:
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `/home/corrm/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names -C 'link-arg=/STACK:8000000' -C linker-flavor=lld-link -Lnative=/home/corrm/.cache/cargo-xwin/xwin/crt/lib/x86_64 -Lnative=/home/corrm/.cache/cargo-xwin/xwin/sdk/lib/um/x86_64 -Lnative=/home/corrm/.cache/cargo-xwin/xwin/sdk/lib/ucrt/x86_64 --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg -Wwarnings` (exit status: 1)
--- stdout
___
lib___.rlib
lib___.so
lib___.so
lib___.a
lib___.so
/home/corrm/.rustup/toolchains/stable-x86_64-unknown-linux-gnu
off
packed
unpacked
___
debug_assertions
panic=\"unwind\"
proc_macro
target_abi=\"\"
target_arch=\"x86_64\"
target_endian=\"little\"
target_env=\"gnu\"
target_family=\"unix\"
target_feature=\"fxsr\"
target_feature=\"sse\"
target_feature=\"sse2\"
target_has_atomic=\"16\"
target_has_atomic=\"32\"
target_has_atomic=\"64\"
target_has_atomic=\"8\"
target_has_atomic=\"ptr\"
target_os=\"linux\"
target_pointer_width=\"64\"
target_vendor=\"unknown\"
unix
--- stderr
error: linker flavor `lld-link` is incompatible with the current target
|
= note: compatible flavors are: gnu, gnu-lld, gnu-cc, gnu-lld-cc, gcc, ld, ld.lld
error: aborting due to 1 previous error
i tired to change rustflags(.cargo/config.toml):
[target.x86_64-pc-windows-msvc]
rustflags = [
"-C",
"linker-flavor=gcc",
]
but that give the same error but with(-C linker-flavor=gcc -C linker-flavor=lld-link):
process didn't exit successfully: `/home/corrm/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names -C linker-flavor=gcc -C linker-flavor=lld-link -Lnative=/home/corrm/.cache/cargo-xwin/xwin/crt/lib/x86_64 -Lnative=/home/corrm/.cache/cargo-xwin/xwin/sdk/lib/um/x86_64 -Lnative=/home/corrm/.cache/cargo-xwin/xwin/sdk/lib/ucrt/x86_64 --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg -Wwarnings`
If there any workaround I would really appreciate
Metadata
Metadata
Assignees
Labels
No labels