confidential-containers / td-shim

Confidential Containers Shim Firmware
Other
97 stars 53 forks source link

Can't build latest `main` on Ubuntu 23.10 #721

Closed dimakuv closed 4 months ago

dimakuv commented 4 months ago

Using current main commit: 7b7a87388a20a525126b5b9b95a003921b0c90e1

Followed the README to prepare the env:

$ history
...
   87  git clone https://github.com/confidential-containers/td-shim.git
   88  cd td-shim/
   89  ls
   90  cargo install cargo-xbuild
   91  export CC=clang
   92  export AR=llvm-ar
   93  export CC_x86_64_unknown_none=clang
   94  export AR_x86_64_unknown_none=llvm-ar
   95  git submodule update --init --recursive
   96  ./sh_script/preparation.sh
   97  cargo image --release

Error and log:

$ cargo image --release                                                                                                                                            
Compiling proc-macro2 v1.0.76
...
$ cargo xbuild -p td-shim --target x86_64-unknown-none --no-default-features --features main,tdx --profile release
WARNING: There is no root package to read the cargo-xbuild config from.
   Compiling compiler_builtins v0.1.103
...
   Compiling ring v0.17.6 (/home/dimakuv/td-shim/library/ring)
error: failed to run custom build command for `ring v0.17.6 (/home/dimakuv/td-shim/library/ring)`

Caused by:
  process didn't exit successfully: `/home/dimakuv/td-shim/target/debug/build/ring-816658965ceafa7e/build-script-build` (exit status: 1)
  --- stdout
...
  --- stderr
  running "perl" "crypto/chacha/asm/chacha-x86_64.pl" "elf" "/home/dimakuv/td-shim/target/debug/build/ring-3fcdb517459fcb0a/out/chacha-x86_64-elf.S"
  running "perl" "crypto/fipsmodule/aes/asm/aesni-x86_64.pl" "elf" "/home/dimakuv/td-shim/target/debug/build/ring-3fcdb517459fcb0a/out/aesni-x86_64-elf.S"
  running "perl" "crypto/fipsmodule/aes/asm/vpaes-x86_64.pl" "elf" "/home/dimakuv/td-shim/target/debug/build/ring-3fcdb517459fcb0a/out/vpaes-x86_64-elf.S"
  running "perl" "crypto/fipsmodule/bn/asm/x86_64-mont.pl" "elf" "/home/dimakuv/td-shim/target/debug/build/ring-3fcdb517459fcb0a/out/x86_64-mont-elf.S"
  running "perl" "crypto/fipsmodule/bn/asm/x86_64-mont5.pl" "elf" "/home/dimakuv/td-shim/target/debug/build/ring-3fcdb517459fcb0a/out/x86_64-mont5-elf.S"
  running "perl" "crypto/fipsmodule/ec/asm/p256-x86_64-asm.pl" "elf" "/home/dimakuv/td-shim/target/debug/build/ring-3fcdb517459fcb0a/out/p256-x86_64-asm-elf.S"
  running "perl" "crypto/fipsmodule/modes/asm/aesni-gcm-x86_64.pl" "elf" "/home/dimakuv/td-shim/target/debug/build/ring-3fcdb517459fcb0a/out/aesni-gcm-x86_64-elf.S"
  running "perl" "crypto/fipsmodule/modes/asm/ghash-x86_64.pl" "elf" "/home/dimakuv/td-shim/target/debug/build/ring-3fcdb517459fcb0a/out/ghash-x86_64-elf.S"
  running "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl" "elf" "/home/dimakuv/td-shim/target/debug/build/ring-3fcdb517459fcb0a/out/sha512-x86_64-elf.S"
  running "perl" "crypto/cipher_extra/asm/chacha20_poly1305_x86_64.pl" "elf" "/home/dimakuv/td-shim/target/debug/build/ring-3fcdb517459fcb0a/out/chacha20_poly1305_x86_64-elf.S"
  running "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl" "elf" "/home/dimakuv/td-shim/target/debug/build/ring-3fcdb517459fcb0a/out/sha256-x86_64-elf.S"

  error occurred: Failed to find tool. Is `` installed?

warning: build failed, waiting for other jobs to finish...
[ERROR]: command exited with non-zero code `cargo run -p td-shim-tools --bin td-shim-strip-info -- --target x86_64-unknown-none -n td-shim`: 101

Is this something known? I assume I did something stupid, but can't understand what.

dimakuv commented 4 months ago

Ah, this was a stupid mistake on my side. Looking at the last command in the STDOUT log, it becomes obvious that smth is wrong with llvm-ar:

$ llvm-ar
Command 'llvm-ar' not found, but can be installed with:
sudo apt install llvm

$ sudo apt install llvm
...

# now build works