xJonathanLEI / starkware-crypto-rs

Rust FFI bindings for StarkWare's crypto-cpp library
Apache License 2.0
15 stars 2 forks source link

Unable to build with GCC 11 #11

Open gsnoff opened 2 years ago

gsnoff commented 2 years ago

OS: Debian GNU/Linux 12 bookworm (testing, amd64) GCC version: 11.3.0

error: failed to run custom build command for `starkware-crypto-sys v0.1.3`

Caused by:
  process didn't exit successfully: `[...]/target/debug/build/starkware-crypto-sys-3a366d1558176dff/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("x86_64-unknown-linux-gnu")
  HOST = Some("x86_64-unknown-linux-gnu")
  CXX_x86_64-unknown-linux-gnu = None
  CXX_x86_64_unknown_linux_gnu = None
  HOST_CXX = None
  CXX = None
  CXXFLAGS_x86_64-unknown-linux-gnu = None
  CXXFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CXXFLAGS = None
  CXXFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-static" "-I" "lib/starkware-crypto/src" "-Wall" "-Wextra" "-std=c++17" "-Werror" "-Wall" "-Wextra" "-fno-strict-aliasing" "-fPIC" "-o" "[...]/target/debug/build/starkware-crypto-sys-e7dc842a2c877560/out/lib/starkware-crypto/src/starkware/crypto/ecdsa.o" "-c" "lib/starkware-crypto/src/starkware/crypto/ecdsa.cc"
  running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-static" "-I" "lib/starkware-crypto/src" "-Wall" "-Wextra" "-std=c++17" "-Werror" "-Wall" "-Wextra" "-fno-strict-aliasing" "-fPIC" "-o" "[...]/target/debug/build/starkware-crypto-sys-e7dc842a2c877560/out/lib/starkware-crypto/src/starkware/algebra/prime_field_element.o" "-c" "lib/starkware-crypto/src/starkware/algebra/prime_field_element.cc"
  exit status: 0
  running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-static" "-I" "lib/starkware-crypto/src" "-Wall" "-Wextra" "-std=c++17" "-Werror" "-Wall" "-Wextra" "-fno-strict-aliasing" "-fPIC" "-o" "[...]/target/debug/build/starkware-crypto-sys-e7dc842a2c877560/out/lib/starkware-crypto/src/starkware/crypto/elliptic_curve_constants.o" "-c" "lib/starkware-crypto/src/starkware/crypto/elliptic_curve_constants.cc"
  exit status: 0
  running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-static" "-I" "lib/starkware-crypto/src" "-Wall" "-Wextra" "-std=c++17" "-Werror" "-Wall" "-Wextra" "-fno-strict-aliasing" "-fPIC" "-o" "[...]/target/debug/build/starkware-crypto-sys-e7dc842a2c877560/out/lib/starkware-crypto/src/starkware/crypto/ffi/ecdsa.o" "-c" "lib/starkware-crypto/src/starkware/crypto/ffi/ecdsa.cc"
  exit status: 0
  running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-static" "-I" "lib/starkware-crypto/src" "-Wall" "-Wextra" "-std=c++17" "-Werror" "-Wall" "-Wextra" "-fno-strict-aliasing" "-fPIC" "-o" "[...]/target/debug/build/starkware-crypto-sys-e7dc842a2c877560/out/lib/starkware-crypto/src/starkware/crypto/ffi/pedersen_hash.o" "-c" "lib/starkware-crypto/src/starkware/crypto/ffi/pedersen_hash.cc"
  exit status: 0
  running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-static" "-I" "lib/starkware-crypto/src" "-Wall" "-Wextra" "-std=c++17" "-Werror" "-Wall" "-Wextra" "-fno-strict-aliasing" "-fPIC" "-o" "[...]/target/debug/build/starkware-crypto-sys-e7dc842a2c877560/out/lib/starkware-crypto/src/starkware/crypto/ffi/utils.o" "-c" "lib/starkware-crypto/src/starkware/crypto/ffi/utils.cc"
  cargo:warning=In file included from lib/starkware-crypto/src/starkware/crypto/pedersen_hash.h:4,
  cargo:warning=                 from lib/starkware-crypto/src/starkware/crypto/ffi/utils.h:6,
  cargo:warning=                 from lib/starkware-crypto/src/starkware/crypto/ffi/utils.cc:4:
  cargo:warning=lib/starkware-crypto/src/third_party/gsl/gsl-lite.hpp: In instantiation of ‘constexpr gsl::span<T> gsl::span<T>::subspan(gsl::span<T>::index_type, gsl::span<T>::index_type) const [with T = gsl::byte; gsl::span<T>::index_type = long unsigned int]’:
  cargo:warning=lib/starkware-crypto/src/starkware/crypto/ffi/utils.cc:30:53:   required from here
  cargo:warning=lib/starkware-crypto/src/third_party/gsl/gsl-lite.hpp:1726:15: error: comparison of unsigned expression in ‘>= 0’ is always true [-Werror=type-limits]
  cargo:warning= 1726 |             0 <= offset && offset <= this->size() &&
  cargo:warning=      |             ~~^~~~~~~~~
  cargo:warning=lib/starkware-crypto/src/third_party/gsl/gsl-lite.hpp:579:50: note: in definition of macro ‘Expects’
  cargo:warning=  579 | # define Expects( x )  ::gsl::fail_fast_assert( (x) )
  cargo:warning=      |                                                  ^
  cargo:warning=lib/starkware-crypto/src/third_party/gsl/gsl-lite.hpp:1727:15: error: comparison of unsigned expression in ‘>= 0’ is always true [-Werror=type-limits]
  cargo:warning= 1727 |             0 <= count  && count + offset <= this->size() );
  cargo:warning=      |             ~~^~~~~~~~
  cargo:warning=lib/starkware-crypto/src/third_party/gsl/gsl-lite.hpp:579:50: note: in definition of macro ‘Expects’
  cargo:warning=  579 | # define Expects( x )  ::gsl::fail_fast_assert( (x) )
  cargo:warning=      |                                                  ^
  cargo:warning=cc1plus: all warnings being treated as errors
  exit status: 1
  running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-static" "-I" "lib/starkware-crypto/src" "-Wall" "-Wextra" "-std=c++17" "-Werror" "-Wall" "-Wextra" "-fno-strict-aliasing" "-fPIC" "-o" "[...]/target/debug/build/starkware-crypto-sys-e7dc842a2c877560/out/lib/starkware-crypto/src/starkware/crypto/pedersen_hash.o" "-c" "lib/starkware-crypto/src/starkware/crypto/pedersen_hash.cc"
  cargo:warning=In file included from lib/starkware-crypto/src/starkware/crypto/pedersen_hash.h:4,
  cargo:warning=                 from lib/starkware-crypto/src/starkware/crypto/pedersen_hash.cc:1:
  cargo:warning=lib/starkware-crypto/src/third_party/gsl/gsl-lite.hpp: In instantiation of ‘constexpr gsl::span<T> gsl::span<T>::subspan(gsl::span<T>::index_type) const [with T = const starkware::EcPoint<starkware::PrimeFieldElement>; gsl::span<T>::index_type = long unsigned int]’:
  cargo:warning=lib/starkware-crypto/src/starkware/crypto/pedersen_hash.cc:42:67:   required from here
  cargo:warning=lib/starkware-crypto/src/third_party/gsl/gsl-lite.hpp:1719:20: error: comparison of unsigned expression in ‘>= 0’ is always true [-Werror=type-limits]
  cargo:warning= 1719 |         Expects( 0 <= offset && offset <= this->size() );
  cargo:warning=      |                  ~~^~~~~~~~~
  cargo:warning=lib/starkware-crypto/src/third_party/gsl/gsl-lite.hpp:579:50: note: in definition of macro ‘Expects’
  cargo:warning=  579 | # define Expects( x )  ::gsl::fail_fast_assert( (x) )
  cargo:warning=      |                                                  ^
  cargo:warning=lib/starkware-crypto/src/third_party/gsl/gsl-lite.hpp: In instantiation of ‘constexpr gsl::span<T> gsl::span<T>::subspan(gsl::span<T>::index_type, gsl::span<T>::index_type) const [with T = const starkware::EcPoint<starkware::PrimeFieldElement>; gsl::span<T>::index_type = long unsigned int]’:
  cargo:warning=lib/starkware-crypto/src/starkware/crypto/pedersen_hash.cc:45:57:   required from here
  cargo:warning=lib/starkware-crypto/src/third_party/gsl/gsl-lite.hpp:1726:15: error: comparison of unsigned expression in ‘>= 0’ is always true [-Werror=type-limits]
  cargo:warning= 1726 |             0 <= offset && offset <= this->size() &&
  cargo:warning=      |             ~~^~~~~~~~~
  cargo:warning=lib/starkware-crypto/src/third_party/gsl/gsl-lite.hpp:579:50: note: in definition of macro ‘Expects’
  cargo:warning=  579 | # define Expects( x )  ::gsl::fail_fast_assert( (x) )
  cargo:warning=      |                                                  ^
  cargo:warning=lib/starkware-crypto/src/third_party/gsl/gsl-lite.hpp:1727:15: error: comparison of unsigned expression in ‘>= 0’ is always true [-Werror=type-limits]
  cargo:warning= 1727 |             0 <= count  && count + offset <= this->size() );
  cargo:warning=      |             ~~^~~~~~~~
  cargo:warning=lib/starkware-crypto/src/third_party/gsl/gsl-lite.hpp:579:50: note: in definition of macro ‘Expects’
  cargo:warning=  579 | # define Expects( x )  ::gsl::fail_fast_assert( (x) )
  cargo:warning=      |                                                  ^
  cargo:warning=cc1plus: all warnings being treated as errors
  exit status: 1
  exit status: 0

  --- stderr

  error occurred: Command "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-static" "-I" "lib/starkware-crypto/src" "-Wall" "-Wextra" "-std=c++17" "-Werror" "-Wall" "-Wextra" "-fno-strict-aliasing" "-fPIC" "-o" "[...]/openlimits-crypto-com/target/debug/build/starkware-crypto-sys-e7dc842a2c877560/out/lib/starkware-crypto/src/starkware/crypto/ffi/utils.o" "-c" "lib/starkware-crypto/src/starkware/crypto/ffi/utils.cc" with args "c++" did not execute successfully (status code exit status: 1).
xJonathanLEI commented 2 years ago

Hi @gsnoff, thanks for reporting the issue, but have you considered using the alternative as recommended here?

https://github.com/xJonathanLEI/starkware-crypto-rs#using-starknet-crypto-instead

starknet-crypto implements the exact same crypto primitives, except in pure Rust and is much faster.