rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.58k stars 12.74k forks source link

error: failed to run custom build command for `ring v0.14.6` #63939

Closed IThawk closed 5 years ago

IThawk commented 5 years ago

error: build failed [root@eulerOS:/opt/rust]# RUST_BACKTRACE=1 cargo build --target x86_64-unknown-linux-musl Compiling ring v0.14.6 Compiling num-traits v0.2.8 Compiling atty v0.2.13 Compiling rand v0.4.6 Compiling base64 v0.10.1 Compiling want v0.2.0 Compiling tokio-resource-pool v0.4.1 Compiling tokio-current-thread v0.1.6 error: failed to run custom build command for ring v0.14.6

Caused by: process didn't exit successfully: /opt/rust/target/debug/build/ring-679905c0a315b704/build-script-build (exit code: 101) --- stdout CARGO: /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo CARGO_CFG_DEBUG_ASSERTIONS: CARGO_CFG_PROC_MACRO: CARGO_CFG_TARGET_ARCH: x86_64 CARGO_CFG_TARGET_ENDIAN: little CARGO_CFG_TARGET_ENV: musl CARGO_CFG_TARGET_FAMILY: unix CARGO_CFG_TARGET_FEATURE: crt-static,fxsr,sse,sse2 CARGO_CFG_TARGET_OS: linux CARGO_CFG_TARGET_POINTER_WIDTH: 64 CARGO_CFG_TARGET_VENDOR: unknown CARGO_CFG_UNIX: CARGO_FEATURE_DEFAULT: 1 CARGO_FEATURE_DEV_URANDOM_FALLBACK: 1 CARGO_FEATURE_USE_HEAP: 1 CARGO_HOME: /root/.cargo CARGO_MAKEFLAGS: --jobserver-fds=4,5 -j --jobserver-auth=4,5 -j CARGO_MANIFEST_DIR: /root/.cargo/registry/src/mirrors.ustc.edu.cn-15f9db60536bad60/ring-0.14.6 CARGO_MANIFEST_LINKS: ring-asm CARGO_PKG_AUTHORS: Brian Smith brian@briansmith.org CARGO_PKG_DESCRIPTION: Safe, fast, small crypto using Rust. CARGO_PKG_HOMEPAGE: CARGO_PKG_NAME: ring CARGO_PKG_REPOSITORY: https://github.com/briansmith/ring CARGO_PKG_VERSION: 0.14.6 CARGO_PKG_VERSION_MAJOR: 0 CARGO_PKG_VERSION_MINOR: 14 CARGO_PKG_VERSION_PATCH: 6 CARGO_PKG_VERSION_PRE: DEBUG: true HISTCONTROL: HISTSIZE: 100 HISTTIMEFORMAT: HOME: /root HOST: x86_64-unknown-linux-gnu HOSTNAME: eulerOS LANG: en_US.UTF-8 LD_LIBRARY_PATH: /opt/rust/target/debug/deps:/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib:/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib LESSOPEN: ||/usr/bin/lesspipe.sh %s LOGNAME: root LS_COLORS: rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.jpg=01;35:.jpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.axv=01;35:.anx=01;35:.ogv=01;35:.ogx=01;35:.aac=01;36:.au=01;36:.flac=01;36:.mid=01;36:.midi=01;36:.mka=01;36:.mp3=01;36:.mpc=01;36:.ogg=01;36:.ra=01;36:.wav=01;36:.axa=01;36:.oga=01;36:.spx=01;36:*.xspf=01;36: MAIL: /var/spool/mail/root NUM_JOBS: 8 OLDPWD: /opt OPT_LEVEL: 0 OUT_DIR: /opt/rust/target/x86_64-unknown-linux-musl/debug/build/ring-b880a6e4e0925f22/out PATH: /root/.cargo/bin:/root/.cargo/bin:/root/.cargo/bin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin PROFILE: debug PROMPT_COMMAND: EulerOS_history PWD: /opt/rust RUSTC: rustc RUSTDOC: rustdoc RUSTUP_HOME: /root/.rustup RUSTUP_TOOLCHAIN: stable-x86_64-unknown-linux-gnu RUST_BACKTRACE: 1 RUST_RECURSION_COUNT: 1 SELINUX_LEVEL_REQUESTED: SELINUX_ROLE_REQUESTED: SELINUX_USE_CURRENT_RANGE: SHELL: /bin/bash SHLVL: 1 SSH_CLIENT: 10.25.123.140 55125 22 SSH_CONNECTION: 10.25.123.140 55125 10.145.69.67 22 SSH_TTY: /dev/pts/1 SSL_CERT_DIR: /etc/pki/tls/certs SSL_CERT_FILE: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem TARGET: x86_64-unknown-linux-musl TERM: xterm TMOUT: 900000 USER: root XDG_RUNTIME_DIR: /run/user/0 XDG_SESSIONID: 19 : /root/.cargo/bin/cargo OPT_LEVEL = Some("0") TARGET = Some("x86_64-unknown-linux-musl") HOST = Some("x86_64-unknown-linux-gnu") CC_x86_64-unknown-linux-musl = None CC_x86_64_unknown_linux_musl = None TARGET_CC = None CC = None CROSS_COMPILE = None CFLAGS_x86_64-unknown-linux-musl = None CFLAGS_x86_64_unknown_linux_musl = None TARGET_CFLAGS = None CFLAGS = None CRATE_CC_NO_DEFAULTS = None DEBUG = Some("true") CARGO_CFG_TARGET_FEATURE = Some("crt-static,fxsr,sse,sse2") running "musl-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-static" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-declarations" "-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" "-U_FORTIFY_SOURCE" "-D_XOPEN_SOURCE=700" "-c" "-o/opt/rust/target/x86_64-unknown-linux-musl/debug/build/ring-b880a6e4e0925f22/out/aes-x86_64-elf.o" "/root/.cargo/registry/src/mirrors.ustc.edu.cn-15f9db60536bad60/ring-0.14.6/pregenerated/aes-x86_64-elf.S"

--- stderr thread 'main' panicked at 'failed to execute ["musl-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-static" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-declarations" "-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" "-U_FORTIFY_SOURCE" "-D_XOPEN_SOURCE=700" "-c" "-o/opt/rust/target/x86_64-unknown-linux-musl/debug/build/ring-b880a6e4e0925f22/out/aes-x86_64-elf.o" "/root/.cargo/registry/src/mirrors.ustc.edu.cn-15f9db60536bad60/ring-0.14.6/pregenerated/aes-x86_64-elf.S"]: No such file or directory (os error 2)', /root/.cargo/registry/src/mirrors.ustc.edu.cn-15f9db60536bad60/ring-0.14.6/build.rs:635:9 stack backtrace: 0: backtrace::backtrace::libunwind::trace at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88 1: backtrace::backtrace::trace_unsynchronized at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66 2: std::sys_common::backtrace::_print at src/libstd/sys_common/backtrace.rs:47 3: std::sys_common::backtrace::print at src/libstd/sys_common/backtrace.rs:36 4: std::panicking::default_hook::{{closure}} at src/libstd/panicking.rs:200 5: std::panicking::default_hook at src/libstd/panicking.rs:214 6: std::panicking::rust_panic_with_hook at src/libstd/panicking.rs:477 7: std::panicking::continue_panic_fmt at src/libstd/panicking.rs:384 8: std::panicking::begin_panic_fmt at src/libstd/panicking.rs:339 9: build_script_build::run_command::{{closure}} at ./build.rs:635 10: core::result::Result<T,E>::unwrap_or_else at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libcore/result.rs:766 11: build_script_build::run_command at ./build.rs:634 12: build_script_build::compile at ./build.rs:515 13: build_script_build::build_library::{{closure}} at ./build.rs:453 14: core::ops::function::impls::<impl core::ops::function::FnOnce for &mut F>::call_once at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libcore/ops/function.rs:279 15: core::option::Option::map at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libcore/option.rs:416 16: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::next at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libcore/iter/adapters/mod.rs:570 17: <alloc::vec::Vec as alloc::vec::SpecExtend<T,I>>::from_iter at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/liballoc/vec.rs:1883 18: <alloc::vec::Vec as core::iter::traits::collect::FromIterator>::from_iter at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/liballoc/vec.rs:1796 19: core::iter::traits::iterator::Iterator::collect at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libcore/iter/traits/iterator.rs:1466 20: build_script_build::build_library at ./build.rs:449 21: build_script_build::build_c_code::{{closure}} at ./build.rs:426 22: core::iter::traits::iterator::Iterator::for_each::{{closure}} at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libcore/iter/traits/iterator.rs:604 23: <core::slice::Iter as core::iter::traits::iterator::Iterator>::fold at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libcore/slice/mod.rs:3178 24: core::iter::traits::iterator::Iterator::for_each at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libcore/iter/traits/iterator.rs:604 25: build_script_build::build_c_code at ./build.rs:424 26: build_script_build::ring_build_rs_main at ./build.rs:294 27: build_script_build::main at ./build.rs:256 28: std::rt::lang_start::{{closure}} at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libstd/rt.rs:64 29: std::rt::lang_start_internal::{{closure}} at src/libstd/rt.rs:49 30: std::panicking::try::do_call at src/libstd/panicking.rs:296 31: rust_maybe_catch_panic at src/libpanic_unwind/lib.rs:82 32: std::panicking::try at src/libstd/panicking.rs:275 33: std::panic::catch_unwind at src/libstd/panic.rs:394 34: std::rt::lang_start_internal at src/libstd/rt.rs:48 35: std::rt::lang_start at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libstd/rt.rs:64 36: main 37: libc_start_main 38: note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

warning: build failed, waiting for other jobs to finish... error: build failed

Mark-Simulacrum commented 5 years ago

This isn't a bug with rust-lang/rust and likely represents a lack of a musl C compiler on your system though I'd need more information to be certain. Closing.

IThawk commented 5 years ago

how to solve

Mark-Simulacrum commented 5 years ago

You'll want to ask on users.rust-lang.org or a similar forum.

mbergkvist commented 4 years ago

See if you have musl-gcc on the build host.

$ musl-gcc

Command 'musl-gcc' not found, but can be installed with:

sudo apt install musl-tools
happysammy commented 3 years ago

same problem.

sarmst22 commented 3 years ago

@happysammy I tried out this solution and it fixed where I got stuck as I already had musl-cross installed;

https://github.com/FiloSottile/homebrew-musl-cross

If you encounter issues with a missing musl-gcc binary, the build system might be assuming the presence of the musl host compiler wrapper. That should be reported as an issue, but you might be able to workaround it by creating a symlink:

ln -s /usr/local/opt/musl-cross/bin/x86_64-linux-musl-gcc /usr/local/bin/musl-gcc

julianespinel commented 2 years ago

I documented another way to solve it here: https://stackoverflow.com/a/70628855/2420718

Kusou1 commented 2 years ago

is there any solution?

12932 commented 2 years ago

See if you have musl-gcc on the build host.

$ musl-gcc

Command 'musl-gcc' not found, but can be installed with:

sudo apt install musl-tools

And on Windows?

ivansanchez-oss commented 2 years ago

same problem on windows,is there any solution?

neuronetio commented 2 years ago

also clang must be installed :) sudo apt install clang

Sulaiman001 commented 2 years ago

The working solution for windows

  1. Install Visual Studio, make sure you select—.NET desktop development, Desktop development with C++, and Universal Windows Platform development.
  2. Show the installed toolchain rustup show.
  3. Then change and set the toolchain by running rustup default stable-x86_64-pc-windows-msvc. This is worked for me after weeks of not getting a working solution. I hope it work for someone else.
ivansanchez-oss commented 2 years ago

@Sulaiman001 https://github.com/briansmith/ring/issues/1488 here is the fix, TARGET_CC environment variable must be manually set.

Sulaiman001 commented 2 years ago

@Sulaiman001 briansmith/ring#1488 here is the fix, TARGET_CC environment variable must be manually set.

Thanks, this is for Mac though. The solution I posted is for windows.

leera-app commented 1 year ago

Try cargo add ring and fixed the issue.

ranjit41771 commented 1 year ago

Thanks @leera-app , This worked.