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

Cross-compiling Linux->Windows fails with prebuilt NASM #524

Closed
davids-work opened this issue Sep 18, 2024 · 3 comments
Closed

Cross-compiling Linux->Windows fails with prebuilt NASM #524

davids-work opened this issue Sep 18, 2024 · 3 comments
Assignees
Labels
build problem Build failure

Comments

@davids-work
Copy link

davids-work commented Sep 18, 2024

Problem:

Cross-compiling from a Linux system to x86_64-pc-windows-gnu fails if the prebuilt-nasm feature is included, and a nasm compiler is not installed on the system:

--- stderr
  Copying platform assembly files from /home/davidsm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.21.1/aws-lc/generated-src/win-x86_64/crypto/ to /home/davidsm/repos/temp/aws-lc-bug/target/x86_64-pc-windows-gnu/release/build/aws-lc-sys-beb7399d9c5ede0d/out/build/aws-lc/crypto
  /bin/sh: line 1: /home/davidsm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.21.1/builder/prebuilt-nasm.bat: Permission denied
  /bin/sh: line 1: /home/davidsm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.21.1/builder/prebuilt-nasm.bat: Permission denied
  gmake[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:120: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-gcm-avx512.asm.obj] Error 126
  gmake[2]: *** Waiting for unfinished jobs....
  /bin/sh: line 1: /home/davidsm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.21.1/builder/prebuilt-nasm.bat: Permission denied
  /bin/sh: line 1: /home/davidsm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.21.1/builder/prebuilt-nasm.bat: Permission denied
  gmake[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:125: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-gcm-x86_64.asm.obj] Error 126
  gmake[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:130: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-xts-avx512.asm.obj] Error 126
  gmake[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:140: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/ghash-ssse3-x86_64.asm.obj] Error 126
  /bin/sh: line 1: /home/davidsm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.21.1/builder/prebuilt-nasm.bat: Permission denied
  gmake[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:145: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/ghash-x86_64.asm.obj] Error 126
  /bin/sh: line 1: /home/davidsm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.21.1/builder/prebuilt-nasm.bat: Permission denied
  gmake[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:135: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-x86_64.asm.obj] Error 126
  /bin/sh: line 1: /home/davidsm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.21.1/builder/prebuilt-nasm.bat: Permission denied
  gmake[2]: *** [aws-lc/crypto/CMakeFiles/crypto_objects.dir/build.make:3780: aws-lc/crypto/CMakeFiles/crypto_objects.dir/chacha/chacha-x86_64.asm.obj] Error 126
  gmake[2]: *** Waiting for unfinished jobs....
  /bin/sh: line 1: /home/davidsm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.21.1/builder/prebuilt-nasm.bat: Permission denied
  gmake[2]: *** [aws-lc/crypto/CMakeFiles/crypto_objects.dir/build.make:3785: aws-lc/crypto/CMakeFiles/crypto_objects.dir/cipher_extra/chacha20_poly1305_x86_64.asm.obj] Error 126
  gmake[1]: *** [CMakeFiles/Makefile2:204: aws-lc/crypto/CMakeFiles/crypto_objects.dir/all] Error 2
  gmake[1]: *** Waiting for unfinished jobs....
  gmake[1]: *** [CMakeFiles/Makefile2:258: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/all] Error 2
  gmake: *** [Makefile:136: all] Error 2
  thread 'main' panicked at /home/davidsm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.51/src/lib.rs:1100:5:

  command did not execute successfully, got: exit status: 2

It looks to me like it tries to execute a .bat file, which I guess won't work on Linux.

To reproduce:

  • Use the following Cargo.toml:
[package]
name = "aws-lc-bug"
version = "0.1.0"
edition = "2021"

[dependencies]
aws-lc-rs = { version = "1.9.0", default-features = false, features = ["aws-lc-sys", "prebuilt-nasm"] }
  • Make sure that nasm is not installed
  • Run cargo build --release --target x86_64-pc-windows-gnu. You'll need to install the appropriate toolchain via rustup or similar.

Relevant details

AWS-LC for Rust versions or commit: 1.9.0

System information: for linux, below info can be collected by running uname -srvmp

  • CPU architecture: x86_64
  • OS: Ubuntu 22.04
@justsmth justsmth self-assigned this Sep 18, 2024
@justsmth justsmth added the build problem Build failure label Sep 18, 2024
@kerosina
Copy link

I just got this error trying to cross compile too

@justsmth
Copy link
Contributor

Hello!

So, one quick solution for this is to install NASM:

sudo apt-get install nasm

This is how I've been doing it locally. I'm working on a patch so that won't be required.

@justsmth
Copy link
Contributor

justsmth commented Oct 3, 2024

I believe this issue is resolved with the release of aws-lc-sys v1.10.0. Please feel free to reopen if you're still experiencing this issue after upgrading. Thanks for helping us improve aws-lc-rs!

@justsmth justsmth closed this as completed Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build problem Build failure
Projects
None yet
Development

No branches or pull requests

3 participants