Error in cross-compiling the current project, error: failed to run custom build command for ` ncurses v5.101.0`

cursive % cargo build -v --no-default-features --features pancurses-backend --example dialog --target x86_64-unknown-linux-musl
Fresh autocfg v1.1.0
Fresh unicode-ident v1.0.6
Fresh cfg-if v1.0.0
Fresh fnv v1.0.7
Fresh ident_case v1.0.1
Fresh itoa v1.0.5
Fresh version_check v0.9.4
Fresh proc-macro2 v1.0.51
Fresh libc v0.2.139
Fresh num-traits v0.2.15
Fresh log v0.4.17
Fresh unicode-width v0.1.10
Fresh num_threads v0.1.6
Fresh quote v1.0.23
Fresh num-integer v0.1.45
Fresh getrandom v0.2.8
Fresh lazy_static v1.4.0
Fresh time-macros v0.2.4
Fresh num-complex v0.4.3
Fresh crossbeam-utils v0.8.14
Fresh memchr v2.5.0
Fresh stable_deref_trait v1.2.0
Fresh syn v1.0.107
Fresh num-rational v0.4.1
Fresh num-iter v0.1.43
Fresh time v0.3.9
Fresh once_cell v1.17.1
Fresh pkg-config v0.3.26
Fresh cc v1.0.79
Fresh aho-corasick v0.7.20
Fresh serde v1.0.152
Fresh crossbeam-channel v0.5.6
Fresh darling_core v0.14.3
Fresh enum-map-derive v0.11.0
Fresh num v0.4.0
Fresh ahash v0.8.3
Fresh thiserror-impl v1.0.38
Fresh owning_ref v0.4.1
Fresh atty v0.2.14
Fresh hashbrown v0.12.3
Fresh regex-syntax v0.6.28
Compiling darling_macro v0.14.3
Compiling enum-map v2.4.2
Fresh xi-unicode v0.3.0
Fresh unicode-segmentation v1.10.1
Fresh ryu v1.0.12
Compiling thiserror v1.0.38
Fresh regex v1.7.1
Compiling ncurses v5.101.0
Fresh indexmap v1.9.2
Fresh unsafe-libyaml v0.2.5
Running rustc --crate-name darling_macro --edition=2018 /Users/sun/.cargo/registry/src/github.com-1ecc6299db9ec823/darling_macro-0.14.3/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C metadata=4a2a481d13c05ffe -C extra-filename=-4a2a481d13c05ffe --out-dir /Users/sun/Documents/workspace/rustprojects/cursive/target/debug/deps -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/debug/deps --extern darling_core=/Users/sun/Documents/workspace/rustprojects/cursive/target/debug/deps/libdarling_core-dd9ae5e1e36580f6.rlib --extern quote=/Users/sun/Documents/workspace/rustprojects/cursive/target/debug/deps/libquote-e82e32528b2f5ca8.rlib --extern syn=/Users/sun/Documents/workspace/rustprojects/cursive/target/debug/deps/libsyn-422894d921433bcb.rlib --extern proc_macro --cap-lints allow
Running rustc --crate-name enum_map --edition=2021 /Users/sun/.cargo/registry/src/github.com-1ecc6299db9ec823/enum-map-2.4.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=8a2acd9408f2e820 -C extra-filename=-8a2acd9408f2e820 --out-dir /Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps --target x86_64-unknown-linux-musl -C linker=x86_64-linux-musl-gcc -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/debug/deps --extern enum_map_derive=/Users/sun/Documents/workspace/rustprojects/cursive/target/debug/deps/libenum_map_derive-3a8cddb9661fe2aa.dylib --cap-lints allow
Fresh glob v0.3.1
Fresh serde_yaml v0.9.17
Fresh serde_json v1.0.93
Fresh cursive-macros v0.1.0 (/Users/sun/Documents/workspace/rustprojects/cursive/cursive-macros)
Fresh rand_core v0.6.4
Running rustc --crate-name thiserror --edition=2018 /Users/sun/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-1.0.38/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=fb790a745764cfb0 -C extra-filename=-fb790a745764cfb0 --out-dir /Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps --target x86_64-unknown-linux-musl -C linker=x86_64-linux-musl-gcc -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/debug/deps --extern thiserror_impl=/Users/sun/Documents/workspace/rustprojects/cursive/target/debug/deps/libthiserror_impl-d21e6f5609a2778d.dylib --cap-lints allow
Running /Users/sun/Documents/workspace/rustprojects/cursive/target/debug/build/ncurses-7f72ac0e554e42d3/build-script-build
Fresh rustversion v1.0.11
Fresh signal-hook-registry v1.4.1
Fresh ppv-lite86 v0.2.17
Fresh overload v0.1.1
Fresh iana-time-zone v0.1.53
Fresh ansi_term v0.12.1
Compiling signal-hook v0.3.15
Compiling nu-ansi-term v0.46.0
Fresh chrono v0.4.23
Fresh rand_chacha v0.3.1
Compiling arraydeque v0.4.5
Compiling getopts v0.2.21
Compiling maplit v1.0.2
Compiling rand v0.8.5
Running rustc --crate-name signal_hook --edition=2018 /Users/sun/.cargo/registry/src/github.com-1ecc6299db9ec823/signal-hook-0.3.15/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="channel"' --cfg 'feature="default"' --cfg 'feature="iterator"' -C metadata=4c2e8a5d77089dc8 -C extra-filename=-4c2e8a5d77089dc8 --out-dir /Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps --target x86_64-unknown-linux-musl -C linker=x86_64-linux-musl-gcc -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/debug/deps --extern libc=/Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps/liblibc-1bf4d8a869d6c44f.rmeta --extern signal_hook_registry=/Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps/libsignal_hook_registry-02b053343b22590e.rmeta --cap-lints allow
Running rustc --crate-name nu_ansi_term --edition=2018 /Users/sun/.cargo/registry/src/github.com-1ecc6299db9ec823/nu-ansi-term-0.46.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=205aa6789dc04b7d -C extra-filename=-205aa6789dc04b7d --out-dir /Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps --target x86_64-unknown-linux-musl -C linker=x86_64-linux-musl-gcc -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/debug/deps --extern overload=/Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps/liboverload-8b3bc82bf9cdf91e.rmeta --cap-lints allow
Running rustc --crate-name arraydeque /Users/sun/.cargo/registry/src/github.com-1ecc6299db9ec823/arraydeque-0.4.5/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=2576c09809496c7a -C extra-filename=-2576c09809496c7a --out-dir /Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps --target x86_64-unknown-linux-musl -C linker=x86_64-linux-musl-gcc -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/debug/deps --cap-lints allow --cfg has_manually_drop_in_union
Running rustc --crate-name getopts /Users/sun/.cargo/registry/src/github.com-1ecc6299db9ec823/getopts-0.2.21/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=3611ba6627a578bb -C extra-filename=-3611ba6627a578bb --out-dir /Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps --target x86_64-unknown-linux-musl -C linker=x86_64-linux-musl-gcc -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/debug/deps --extern unicode_width=/Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps/libunicode_width-5affc1c2bf7432f1.rmeta --cap-lints allow
Running rustc --crate-name maplit /Users/sun/.cargo/registry/src/github.com-1ecc6299db9ec823/maplit-1.0.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=4f160002cf38665a -C extra-filename=-4f160002cf38665a --out-dir /Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps --target x86_64-unknown-linux-musl -C linker=x86_64-linux-musl-gcc -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/debug/deps --cap-lints allow
Running rustc --crate-name rand --edition=2018 /Users/sun/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.8.5/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="alloc"' --cfg 'feature="default"' --cfg 'feature="getrandom"' --cfg 'feature="libc"' --cfg 'feature="rand_chacha"' --cfg 'feature="std"' --cfg 'feature="std_rng"' -C metadata=fbbbad1f621d1806 -C extra-filename=-fbbbad1f621d1806 --out-dir /Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps --target x86_64-unknown-linux-musl -C linker=x86_64-linux-musl-gcc -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps -L dependency=/Users/sun/Documents/workspace/rustprojects/cursive/target/debug/deps --extern libc=/Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps/liblibc-1bf4d8a869d6c44f.rmeta --extern rand_chacha=/Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps/librand_chacha-1cdf7eec643f6911.rmeta --extern rand_core=/Users/sun/Documents/workspace/rustprojects/cursive/target/x86_64-unknown-linux-musl/debug/deps/librand_core-137799ad1f775178.rmeta --cap-lints allow
error: failed to run custom build command for ncurses v5.101.0

Caused by:
process didn't exit successfully: /Users/sun/Documents/workspace/rustprojects/cursive/target/debug/build/ncurses-7f72ac0e554e42d3/build-script-build (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=NCURSES5_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=NCURSES_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:rustc-link-lib=ncurses
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-apple-darwin")
cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-musl
CC_x86_64-unknown-linux-musl = None
cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_musl
CC_x86_64_unknown_linux_musl = None
cargo:rerun-if-env-changed=TARGET_CC
TARGET_CC = None
cargo:rerun-if-env-changed=CC
CC = None
RUSTC_LINKER = Some("x86_64-linux-musl-gcc")
cargo:rerun-if-env-changed=CROSS_COMPILE
CROSS_COMPILE = None
cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-musl
CFLAGS_x86_64-unknown-linux-musl = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_musl
CFLAGS_x86_64_unknown_linux_musl = 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
thread 'main' panicked at 'compilation failed: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /Users/sun/.cargo/registry/src/github.com-1ecc6299db9ec823/ncurses-5.101.0/build.rs:105:30
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

Do you have a musl-linked copy of the ncurses C library installed?

1 Like

My native machine is macos. I need to cross-compile the binary package of linux

You'd need to cross-build a copy of ncurses, or, alternatively, would need to avoid the ncurses dependency. cursive, which appears to be the terminal library you're using, has support for multiple backends.

To use termion instead of ncurses, change your Cargo.toml to pick the alternative backend:

[dependencies]
cursive = { version = "0.20", default-features = false, features = ["termion-backend"] }

I tried termion, thank you very much

1 Like