Skip to content
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

Error on cargo build --release #1346

Open
fivebanger opened this issue Sep 20, 2024 · 8 comments
Open

Error on cargo build --release #1346

fivebanger opened this issue Sep 20, 2024 · 8 comments

Comments

@fivebanger
Copy link
Contributor

I'm getting a build error on cargo build --release, running Linux Mint 20.3 (based on Ubuntu 20.04 LTS, still supported). What I did so far:

sudo apt-get update
sudo apt-get upgrade

$ rustup update stable
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.81.0 (eeb90cda1 2024-09-04)

info: checking for self-update

$ rustc --version
rustc 1.81.0 (eeb90cda1 2024-09-04)
$ cargo --version
cargo 1.81.0 (2dbb1af80 2024-08-20)

$ git clone https://github.com/librespot-org/librespot

Building result in following error:

cargo build --release

...

error: failed to run custom build command for `aws-lc-sys v0.21.1`

Caused by:
  process didn't exit successfully: `/home/martin/librespot/librespot-dev/librespot/target/release/build/aws-lc-sys-7936ae7f1dab2471/build-script-main` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=AWS_LC_SYS_NO_PREFIX
  cargo:rerun-if-env-changed=AWS_LC_SYS_INTERNAL_BINDGEN
  cargo:rerun-if-env-changed=AWS_LC_SYS_EXTERNAL_BINDGEN
  cargo:rerun-if-env-changed=AWS_LC_SYS_NO_ASM
  cargo:rerun-if-env-changed=AWS_LC_SYS_CFLAGS
  cargo:rerun-if-env-changed=AWS_LC_SYS_PREBUILT_NASM
  cargo:rerun-if-env-changed=AWS_LC_SYS_C_STD
  cargo:rustc-cfg=x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=AWS_LC_SYS_CMAKE_BUILDER
  cargo:rerun-if-env-changed=AWS_LC_SYS_STATIC
  default_for Target: 'x86_64-unknown-linux-gnu'
  cargo:rerun-if-env-changed=CARGO_FEATURE_SSL
  default_for Target: 'x86_64-unknown-linux-gnu'
  cargo:rerun-if-env-changed=CARGO_FEATURE_SSL
  cargo:root=/home/martin/librespot/librespot-dev/librespot/target/release/build/aws-lc-sys-a9f24552134098bb/out
  default_for Target: 'x86_64-unknown-linux-gnu'
  HOST = Some(x86_64-unknown-linux-gnu)
  TARGET = Some(x86_64-unknown-linux-gnu)
  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=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  RUSTC_WRAPPER = None
  OUT_DIR = Some(/home/martin/librespot/librespot-dev/librespot/target/release/build/aws-lc-sys-a9f24552134098bb/out)
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some(fxsr,sse,sse2)
  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=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  OPT_LEVEL = Some(3)
  TARGET = Some(x86_64-unknown-linux-gnu)
  OUT_DIR = Some(/home/martin/librespot/librespot-dev/librespot/target/release/build/aws-lc-sys-a9f24552134098bb/out)
  HOST = Some(x86_64-unknown-linux-gnu)
  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=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  RUSTC_WRAPPER = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some(false)
  CARGO_CFG_TARGET_FEATURE = Some(fxsr,sse,sse2)
  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=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None

  --- stderr
  thread 'main' panicked at /home/martin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.21.1/builder/cc_builder.rs:277:13:
  ### COMPILER BUG DETECTED ###
  Your compiler (cc) is not supported due to a memcmp related bug reported in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189. We strongly recommend against using this compiler. 
  EXECUTED: true
  ERROR: 
  OUTPUT: 

  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

I'm not facing any build issues for a version older than 3rd of Sept. Next update for me was 7th of Sept. Since 7th of Sept. I cannot build HEAD of dev anymore. Some commit between 3rd and 7th seems to cause this issue.

Any help welcome.

@fivebanger
Copy link
Contributor Author

It seems that my used gcc version is to old.

gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0

I found some advice to use a newer version of gcc, so I did:

sudo apt remove gcc
sudo apt install gcc-10

Running cargo build leads now to error: linker cc not found. The suggested solution to this issue was to run

sudo apt install build-essential

like also mentioned in the COMPILING.md here.

Now I end up with the original error (see first post). I can see that build-essentials has installed gcc-9 again.

I tried to just remove gcc-9, also does not work. The error on cargo build is now:

  --- stderr
  thread 'main' panicked at /home/martin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.21.1/builder/cc_builder.rs:258:9:
  COMPILER: "cc"ARGS: ["-O3", "-ffunction-sections", "-fdata-sections", "-fPIC", "-m64", "-Wall", "-Wextra", "/home/martin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.21.1/aws-lc/tests/compiler_features_tests/memcmp_invalid_stripped_check.c", "-Wno-unused-parameter", "-o", "/home/martin/librespot/librespot-dev/librespot/target/release/build/aws-lc-sys-a9f24552134098bb/out/memcmp_invalid_stripped_check"]EXECUTED: falseERROR: OUTPUT: Failed to compile memcmp_invalid_stripped_check

@fivebanger
Copy link
Contributor Author

fivebanger commented Sep 20, 2024

What has fixed the issue for me:

sudo apt remove gcc-9
sudo apt install gcc-10

I missed cargo clean before starting a new build which seems to be important. Otherwise build fails with error.

Maybe it's worth to mention a min. version for gcc in the COMPILING.md?

@kingosticks
Copy link
Contributor

kingosticks commented Sep 20, 2024

Maybe it's worth to mention a min. version for gcc in the COMPILING.md?

I don't think this is realistic. This new gcc requirement comes from a dependency. Downstream projects can't be expected to track this kind of thing. I think if you're building the latest code, you're likely going to need a reasonably recent version of common dev tools like gcc. Ubuntu 20.04 might still be "supported" by Canoncial, but it's two LTS releases behind now and contains software from 4.5 years ago. I think it's fair to say that building latest software isn't what old Ubuntu LTS releases are for.

@fivebanger
Copy link
Contributor Author

Ok. The issue is solved for me at the moment. Regarding "best practice": Who is responsible for closing an issue? The OP? Or should this stay open in case someone else stumbles over the same (whereas can still be found in closed issues)?

@kingosticks
Copy link
Contributor

If there's no further action or tracking required then leaving it open isn't necessary and anyone can close. It can easily be reopened later if required. Google will likely bring anyone else here with the same problem, and the workaround should be clear to them.

@kingosticks
Copy link
Contributor

kingosticks commented Sep 21, 2024

I guess the one thing remaining for me here is why it's dragging this dependency in. I thought that aws-lc package was related to nasm support, and surely that's behind a non-default feature flag...

@kingosticks
Copy link
Contributor

kingosticks commented Sep 21, 2024

Cancel thah. I see it's being brought in by hyper's TLS library that's used by core. So it's required.

@kingosticks
Copy link
Contributor

I think they fixed this in aws-lc-sys v0.21.2 aws/aws-lc-rs#520

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants