BLAKE3-team / BLAKE3

the official Rust and C implementations of the BLAKE3 cryptographic hash function
Apache License 2.0
5.22k stars 353 forks source link

error happens when cargo install b3sum #176

Open pangpu opened 3 years ago

pangpu commented 3 years ago

Hi , I am trying to install blake3

when executing "cargo install b3sum", an error happens and the log looks:

...
cargo:warning=c/blake3_avx512_x86-64_unix.S:2517: Error: operand type mismatch for `vpxord'
cargo:warning=c/blake3_avx512_x86-64_unix.S:2518: Error: operand type mismatch for `vprord'
cargo:warning=c/blake3_avx512_x86-64_unix.S:2521: Error: operand type mismatch for `vpxord'
cargo:warning=c/blake3_avx512_x86-64_unix.S:2522: Error: operand type mismatch for `vprord'
cargo:warning=c/blake3_avx512_x86-64_unix.S:2524: Error: operand type mismatch for `vpxord'
cargo:warning=c/blake3_avx512_x86-64_unix.S:2525: Error: operand type mismatch for `vprord'

error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-Wall" "-Wextra" "-std=c11" "-mavx512f" "-mavx512vl" "-o" "/tmp/cargo-install5M7wG7/release/build/blake3-40c61925e7999996/out/c/blake3_avx512_x86-64_unix.o" "-c" "c/blake3_avx512_x86-64_unix.S" with args "cc" did not execute successfully (status code exit code: 1).

Seems the compiler tries to use AVX512 feature in the compiling, while my CPU does not support AVX 512 (Intel Xeon E5 2680

sneves commented 3 years ago

What's the version of your C compiler and/or binutils?

oconnor663 commented 3 years ago

This function in build.rs should be detecting whether your compiler supports AVX-512 flags, and disabling our AVX-512 code if not. If you have time, could you help us figure out what it's doing in your case? I've pushed a branch called avx512_debug which fills that function with debug prints. Could you try building it with some commands like these, and tell us what you see:

git clone https://github.com/BLAKE3-team/BLAKE3
cd BLAKE3/b3sum
git checkout avx512_debug
cargo build
pangpu commented 3 years ago

What's the version of your C compiler and/or binutils?

Using gcc version 5.5.0

pangpu commented 3 years ago

This function in build.rs should be detecting whether your compiler supports AVX-512 flags, and disabling our AVX-512 code if not. If you have time, could you help us figure out what it's doing in your case? I've pushed a branch called avx512_debug which fills that function with debug prints. Could you try building it with some commands like these, and tell us what you see:

git clone https://github.com/BLAKE3-team/BLAKE3
cd BLAKE3/b3sum
git checkout avx512_debug
cargo build

Thanks I will try it later and report what happens

pangpu commented 3 years ago

This function in build.rs should be detecting whether your compiler supports AVX-512 flags, and disabling our AVX-512 code if not. If you have time, could you help us figure out what it's doing in your case? I've pushed a branch called avx512_debug which fills that function with debug prints. Could you try building it with some commands like these, and tell us what you see:

git clone https://github.com/BLAKE3-team/BLAKE3
cd BLAKE3/b3sum
git checkout avx512_debug
cargo build
 cargo:warning=c/blake3_avx512_x86-64_unix.S:2522: Error: operand type mismatch for `vprord'
  cargo:warning=c/blake3_avx512_x86-64_unix.S:2524: Error: operand type mismatch for `vpxord'
  cargo:warning=c/blake3_avx512_x86-64_unix.S:2525: Error: operand type mismatch for `vprord'
  exit code: 1

  --- stderr
  [build.rs:88] is_windows_msvc() = false
  [build.rs:95] build.is_flag_supported("-mavx512f") = Ok(
      true,
  )
  [build.rs:96] build.is_flag_supported("-mavx512vl") = Ok(
      true,
  )
  [build.rs:100] support_result = Ok(
      true,
  )
  [build.rs:101] YesAVX512 = YesAVX512

  error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-std=c11" "-mavx512f" "-mavx512vl" "-o" "/home/dell-07/blake3/BLAKE3-avx512_debug/target/debug/build/blake3-9eeb7062f782522d/out/c/blake3_avx512_x86-64_unix.o" "-c" "c/blake3_avx512_x86-64_unix.S" with args "cc" did not execute successfully (status code exit code: 1).
sneves commented 3 years ago

I'm almost certain that this is caused by an old binutils version. What's the output of as -v /dev/null?

sneves commented 3 years ago

This is what happens with binutils 2.24, which is from 2013 and (as far as I can tell) is used in Ubuntu 14.04:

$ ./binutils-2.24/gas/as-new --64 blake3_avx512_x86-64_unix.s 2>&1 | tail -3
blake3_avx512_x86-64_unix.S:2522: Error: operand type mismatch for `vprord'
blake3_avx512_x86-64_unix.S:2524: Error: operand type mismatch for `vpxord'
blake3_avx512_x86-64_unix.S:2525: Error: operand type mismatch for `vprord'

Binutils 2.24 happens to be the last version that did not support AVX-512 instructions.

pangpu commented 3 years ago

This is what happens with binutils 2.24, which is from 2013 and (as far as I can tell) is used in Ubuntu 14.04:

$ ./binutils-2.24/gas/as-new --64 blake3_avx512_x86-64_unix.s 2>&1 | tail -3
blake3_avx512_x86-64_unix.S:2522: Error: operand type mismatch for `vprord'
blake3_avx512_x86-64_unix.S:2524: Error: operand type mismatch for `vpxord'
blake3_avx512_x86-64_unix.S:2525: Error: operand type mismatch for `vprord'

Binutils 2.24 happens to be the last version that did not support AVX-512 instructions.

Yes, the compiling is done in Ubuntu 14.04. I will update the OS and try later.