starkware-libs / crypto-cpp Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Is there a C + + demo. I can't get through the signature verification.
I tried cross compiling this library for Apple Silicon macs but it fails, probably due to incopatibility of gtest with this arch, here's the stacktrace:
-- The CXX compiler identification is AppleClang 12.0.0.1[200](https://github.com/software-mansion/starknet.py/runs/5290265396?check_suite_focus=true#step:9:200)0032
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The C compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode_12.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Python: /Users/runner/hostedtoolcache/Python/3.10.2/x64/bin/python3.10 (found version "3.10.2") found components: Interpreter
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/runner/work/starknet.py/starknet.py/crypto-cpp/build/Release
[ 2%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 4%] Linking CXX static library ../../../lib/libgtest.a
[ 4%] Built target gtest
[ 7%] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o
[ 9%] Linking CXX static library ../../../lib/libgmock.a
[ 9%] Built target gmock
[ 12%] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock_main.dir/src/gmock_main.cc.o
[ 14%] Linking CXX static library ../../../lib/libgmock_main.a
[ 14%] Built target gmock_main
[ 17%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[ 19%] Linking CXX static library ../../../lib/libgtest_main.a
[ 19%] Built target gtest_main
[ 21%] Building CXX object src/starkware/algebra/CMakeFiles/algebra.dir/prime_field_element.cc.o
[ 24%] Linking CXX static library libalgebra.a
[ 24%] Built target algebra
[ 26%] Building CXX object src/starkware/algebra/CMakeFiles/big_int_test.dir/big_int_test.cc.o
[ 29%] Linking CXX executable big_int_test
ld: warning: ignoring file ../../../lib/libgtest.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file ../../../lib/libgtest_main.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file ../../../lib/libgmock.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
"testing::AssertionResult::AssertionResult(testing::AssertionResult const&)", referenced from:
testing::AssertionResult testing::internal::CmpHelperOpFailure<starkware::BigInt<2ul>, starkware::BigInt<2ul> >(char const*, char const*, starkware::BigInt<2ul> const&, starkware::BigInt<2ul> const&, char const*) in big_int_test.cc.o
testing::AssertionResult testing::internal::PredicateFormatterFromMatcher<testing::PolymorphicMatcher<testing::internal::HasSubstrMatcher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::operator()<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in big_int_test.cc.o
"testing::AssertionFailure()", referenced from:
testing::AssertionResult testing::internal::CmpHelperOpFailure<starkware::BigInt<2ul>, starkware::BigInt<2ul> >(char const*, char const*, starkware::BigInt<2ul> const&, starkware::BigInt<2ul> const&, char const*) in big_int_test.cc.o
testing::AssertionResult testing::internal::PredicateFormatterFromMatcher<testing::PolymorphicMatcher<testing::internal::HasSubstrMatcher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::operator()<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in big_int_test.cc.o
"testing::AssertionSuccess()", referenced from:
starkware::(anonymous namespace)::BigInt_Random_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_Div_Test::TestBody() in big_int_test.cc.o
testing::AssertionResult testing::internal::PredicateFormatterFromMatcher<testing::PolymorphicMatcher<testing::internal::HasSubstrMatcher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::operator()<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_DivRandom_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_DivNoRemainder_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_NumLeadingZeros_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_MulMod_Test::TestBody() in big_int_test.cc.o
...
"testing::Test::SetUp()", referenced from:
vtable for starkware::(anonymous namespace)::BigInt_Random_Test in big_int_test.cc.o
vtable for starkware::(anonymous namespace)::BigInt_Div_Test in big_int_test.cc.o
vtable for starkware::(anonymous namespace)::BigInt_DivByZero_Test in big_int_test.cc.o
vtable for starkware::(anonymous namespace)::BigInt_DivRandom_Test in big_int_test.cc.o
vtable for starkware::(anonymous namespace)::BigInt_DivNoRemainder_Test in big_int_test.cc.o
vtable for starkware::(anonymous namespace)::BigInt_NumLeadingZeros_Test in big_int_test.cc.o
vtable for starkware::(anonymous namespace)::BigInt_Multiplication_Test in big_int_test.cc.o
...
"testing::Test::TearDown()", referenced from:
vtable for starkware::(anonymous namespace)::BigInt_Random_Test in big_int_test.cc.o
vtable for starkware::(anonymous namespace)::BigInt_Div_Test in big_int_test.cc.o
vtable for starkware::(anonymous namespace)::BigInt_DivByZero_Test in big_int_test.cc.o
vtable for starkware::(anonymous namespace)::BigInt_DivRandom_Test in big_int_test.cc.o
vtable for starkware::(anonymous namespace)::BigInt_DivNoRemainder_Test in big_int_test.cc.o
vtable for starkware::(anonymous namespace)::BigInt_NumLeadingZeros_Test in big_int_test.cc.o
vtable for starkware::(anonymous namespace)::BigInt_Multiplication_Test in big_int_test.cc.o
...
"testing::Test::Test()", referenced from:
testing::internal::TestFactoryImpl<starkware::(anonymous namespace)::BigInt_Random_Test>::CreateTest() in big_int_test.cc.o
testing::internal::TestFactoryImpl<starkware::(anonymous namespace)::BigInt_Div_Test>::CreateTest() in big_int_test.cc.o
testing::internal::TestFactoryImpl<starkware::(anonymous namespace)::BigInt_DivByZero_Test>::CreateTest() in big_int_test.cc.o
testing::internal::TestFactoryImpl<starkware::(anonymous namespace)::BigInt_DivRandom_Test>::CreateTest() in big_int_test.cc.o
testing::internal::TestFactoryImpl<starkware::(anonymous namespace)::BigInt_DivNoRemainder_Test>::CreateTest() in big_int_test.cc.o
testing::internal::TestFactoryImpl<starkware::(anonymous namespace)::BigInt_NumLeadingZeros_Test>::CreateTest() in big_int_test.cc.o
testing::internal::TestFactoryImpl<starkware::(anonymous namespace)::BigInt_Multiplication_Test>::CreateTest() in big_int_test.cc.o
...
"testing::Test::~Test()", referenced from:
starkware::(anonymous namespace)::BigInt_Random_Test::~BigInt_Random_Test() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_Random_Test::~BigInt_Random_Test() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_Div_Test::~BigInt_Div_Test() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_Div_Test::~BigInt_Div_Test() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_DivByZero_Test::~BigInt_DivByZero_Test() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_DivByZero_Test::~BigInt_DivByZero_Test() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_DivRandom_Test::~BigInt_DivRandom_Test() in big_int_test.cc.o
...
"testing::Message::Message()", referenced from:
starkware::(anonymous namespace)::BigInt_Random_Test::TestBody() in big_int_test.cc.o
testing::AssertionResult testing::internal::CmpHelperOpFailure<starkware::BigInt<2ul>, starkware::BigInt<2ul> >(char const*, char const*, starkware::BigInt<2ul> const&, starkware::BigInt<2ul> const&, char const*) in big_int_test.cc.o
testing::AssertionResult& testing::AssertionResult::operator<<<char [12]>(char const (&) [12]) in big_int_test.cc.o
testing::AssertionResult& testing::AssertionResult::operator<<<char const*>(char const* const&) in big_int_test.cc.o
testing::AssertionResult& testing::AssertionResult::operator<<<char [3]>(char const (&) [3]) in big_int_test.cc.o
testing::AssertionResult& testing::AssertionResult::operator<<<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_Div_Test::TestBody() in big_int_test.cc.o
...
"testing::internal::AlwaysTrue()", referenced from:
starkware::(anonymous namespace)::BigInt_DivByZero_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_InvMod_Zero_Test::TestBody() in big_int_test.cc.o
"testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)", referenced from:
starkware::(anonymous namespace)::BigInt_Random_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_Div_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_DivByZero_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_DivRandom_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_DivNoRemainder_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_NumLeadingZeros_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_MulMod_Test::TestBody() in big_int_test.cc.o
...
"testing::internal::AssertHelper::~AssertHelper()", referenced from:
starkware::(anonymous namespace)::BigInt_Random_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_Div_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_DivByZero_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_DivRandom_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_DivNoRemainder_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_NumLeadingZeros_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_MulMod_Test::TestBody() in big_int_test.cc.o
...
"testing::internal::GetTestTypeId()", referenced from:
__GLOBAL__sub_I_big_int_test.cc in big_int_test.cc.o
"testing::internal::PrintStringTo(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_ostream<char, std::__1::char_traits<char> >*)", referenced from:
bool testing::internal::MatchPrintAndExplain<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, testing::Matcher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&> const&, testing::MatchResultListener*) in big_int_test.cc.o
testing::PolymorphicMatcher<testing::internal::HasSubstrMatcher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::MonomorphicImpl<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>::DescribeTo(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const in big_int_test.cc.o
testing::PolymorphicMatcher<testing::internal::HasSubstrMatcher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::MonomorphicImpl<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>::DescribeNegationTo(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const in big_int_test.cc.o
"testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)", referenced from:
__GLOBAL__sub_I_big_int_test.cc in big_int_test.cc.o
"testing::internal::IsTrue(bool)", referenced from:
testing::internal::SuiteApiResolver<testing::Test>::GetSetUpCaseOrSuite(char const*, int) in big_int_test.cc.o
testing::internal::SuiteApiResolver<testing::Test>::GetTearDownCaseOrSuite(char const*, int) in big_int_test.cc.o
testing::AssertionResult testing::internal::PredicateFormatterFromMatcher<testing::PolymorphicMatcher<testing::internal::HasSubstrMatcher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::operator()<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in big_int_test.cc.o
testing::internal::MatcherBase<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>::DescribeTo(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const in big_int_test.cc.o
bool testing::internal::MatchPrintAndExplain<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, testing::Matcher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&> const&, testing::MatchResultListener*) in big_int_test.cc.o
testing::internal::MatcherBase<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>::DescribeNegationTo(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const in big_int_test.cc.o
"testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)", referenced from:
testing::internal::SuiteApiResolver<testing::Test>::GetSetUpCaseOrSuite(char const*, int) in big_int_test.cc.o
testing::internal::SuiteApiResolver<testing::Test>::GetTearDownCaseOrSuite(char const*, int) in big_int_test.cc.o
testing::AssertionResult testing::internal::PredicateFormatterFromMatcher<testing::PolymorphicMatcher<testing::internal::HasSubstrMatcher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::operator()<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in big_int_test.cc.o
testing::internal::MatcherBase<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>::DescribeTo(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const in big_int_test.cc.o
bool testing::internal::MatchPrintAndExplain<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, testing::Matcher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&> const&, testing::MatchResultListener*) in big_int_test.cc.o
testing::internal::MatcherBase<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>::DescribeNegationTo(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const in big_int_test.cc.o
"testing::internal::GTestLog::~GTestLog()", referenced from:
testing::internal::SuiteApiResolver<testing::Test>::GetSetUpCaseOrSuite(char const*, int) in big_int_test.cc.o
testing::internal::SuiteApiResolver<testing::Test>::GetTearDownCaseOrSuite(char const*, int) in big_int_test.cc.o
testing::AssertionResult testing::internal::PredicateFormatterFromMatcher<testing::PolymorphicMatcher<testing::internal::HasSubstrMatcher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::operator()<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in big_int_test.cc.o
testing::internal::MatcherBase<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>::DescribeTo(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const in big_int_test.cc.o
bool testing::internal::MatchPrintAndExplain<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, testing::Matcher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&> const&, testing::MatchResultListener*) in big_int_test.cc.o
testing::internal::MatcherBase<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>::DescribeNegationTo(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const in big_int_test.cc.o
"testing::internal::EqFailure(char const*, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)", referenced from:
testing::AssertionResult testing::internal::CmpHelperEQFailure<std::__1::pair<starkware::BigInt<2ul>, starkware::BigInt<2ul> >, std::__1::pair<starkware::BigInt<2ul>, starkware::BigInt<2ul> > >(char const*, char const*, std::__1::pair<starkware::BigInt<2ul>, starkware::BigInt<2ul> > const&, std::__1::pair<starkware::BigInt<2ul>, starkware::BigInt<2ul> > const&) in big_int_test.cc.o
testing::AssertionResult testing::internal::CmpHelperEQFailure<starkware::BigInt<4ul>, starkware::BigInt<4ul> >(char const*, char const*, starkware::BigInt<4ul> const&, starkware::BigInt<4ul> const&) in big_int_test.cc.o
testing::AssertionResult testing::internal::CmpHelperEQFailure<starkware::BigInt<4ul>, starkware::BigInt<1ul> >(char const*, char const*, starkware::BigInt<4ul> const&, starkware::BigInt<1ul> const&) in big_int_test.cc.o
testing::AssertionResult testing::internal::CmpHelperEQFailure<starkware::BigInt<2ul>, starkware::BigInt<1ul> >(char const*, char const*, starkware::BigInt<2ul> const&, starkware::BigInt<1ul> const&) in big_int_test.cc.o
"testing::Message::GetString() const", referenced from:
testing::AssertionResult testing::internal::CmpHelperOpFailure<starkware::BigInt<2ul>, starkware::BigInt<2ul> >(char const*, char const*, starkware::BigInt<2ul> const&, starkware::BigInt<2ul> const&, char const*) in big_int_test.cc.o
testing::AssertionResult& testing::AssertionResult::operator<<<char [12]>(char const (&) [12]) in big_int_test.cc.o
testing::AssertionResult& testing::AssertionResult::operator<<<char const*>(char const* const&) in big_int_test.cc.o
testing::AssertionResult& testing::AssertionResult::operator<<<char [3]>(char const (&) [3]) in big_int_test.cc.o
testing::AssertionResult& testing::AssertionResult::operator<<<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in big_int_test.cc.o
"testing::internal::AssertHelper::operator=(testing::Message const&) const", referenced from:
starkware::(anonymous namespace)::BigInt_Random_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_Div_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_DivByZero_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_DivRandom_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_DivNoRemainder_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_NumLeadingZeros_Test::TestBody() in big_int_test.cc.o
starkware::(anonymous namespace)::BigInt_MulMod_Test::TestBody() in big_int_test.cc.o
...
"typeinfo for testing::Test", referenced from:
typeinfo for starkware::(anonymous namespace)::BigInt_Random_Test in big_int_test.cc.o
typeinfo for starkware::(anonymous namespace)::BigInt_Div_Test in big_int_test.cc.o
typeinfo for starkware::(anonymous namespace)::BigInt_DivByZero_Test in big_int_test.cc.o
typeinfo for starkware::(anonymous namespace)::BigInt_DivRandom_Test in big_int_test.cc.o
typeinfo for starkware::(anonymous namespace)::BigInt_DivNoRemainder_Test in big_int_test.cc.o
typeinfo for starkware::(anonymous namespace)::BigInt_NumLeadingZeros_Test in big_int_test.cc.o
typeinfo for starkware::(anonymous namespace)::BigInt_Multiplication_Test in big_int_test.cc.o
...
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/starkware/algebra/big_int_test] Error 1
make[1]: *** [src/starkware/algebra/CMakeFiles/big_int_test.dir/all] Error 2
make: *** [all] Error 2
Is this library used to generate stark signatures?
I am trying to integrate the ecdsa
& pedersen_hash
function in custom c++ project. I cloned and built the project just fine.
After the built I have a few files in build/src/starkware/crypto/ffi
, 2 headers ecdsa.h
, pedersen_hash.h
and
libcrypto_c_exports.dylib
so I copied manually these files into a new directory and try to create a custom target in my cmake project
set(_STARK_CRYPTO_BASE_DIR /storage/developer/tools/stark)
set(STARK_CRYPTO_INCLUDE_DIR "${_STARK_CRYPTO_BASE_DIR}/include")
set(STARK_CRYPTO_LIBRARY "${_STARK_CRYPTO_BASE_DIR}/lib/libcrypto_c_exports.dylib")
message(${STARK_CRYPTO_LIBRARY})
add_library(stark::stark SHARED IMPORTED)
set_target_properties(
stark::stark
PROPERTIES
IMPORTED_LOCATION "${STARK_CRYPTO_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${STARK_CRYPTO_INCLUDE_DIR}"
)
but then when trying to build a sample cxx file
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <ecdsa.h>
TEST_CASE("test stark-crypto", "[single-file]") {
const auto private_key = "aaa";
const auto message_key = "bbb";
const auto k = "cc";
char out[251];
Sign(private_key, message_key, k, out);
}
I am getting error with undefined symbol.
Undefined symbols for architecture arm64:
"Sign(char const*, char const*, char const*, char*)", referenced from:
C_A_T_C_H_T_E_S_T_0() in demo.cxx.o
I tried to build the library with static/shared mode (with and without -fPIC) but no luck.
➜ ffi git:(master) ✗ nm -gU libcrypto_c_exports.dylib
0000000000003a14 T _GetPublicKey
0000000000002f00 T _Hash
0000000000003cc4 T _Sign
0000000000003b2c T _Verify
0000000000003eec T __ZN9starkware11DeserializeEN3gsl4spanIKNS0_4byteEEE
0000000000003e8c T __ZN9starkware11HandleErrorEPKcN3gsl4spanINS2_4byteEEE
00000000000121a8 T __ZN9starkware11VerifyEcdsaERKNS_7EcPointINS_17PrimeFieldElementEEERKS1_RKNSt3__14pairIS1_S1_EE
0000000000011380 T __ZN9starkware12GetPublicKeyERKNS_6BigIntILm4EEE
0000000000010dac T __ZN9starkware12PedersenHashERKNS_17PrimeFieldElementES2_
000000000000411c T __ZN9starkware14GetEcConstantsEv
0000000000016248 T __ZN9starkware17PrimeFieldElement13RandomElementEPNS_4PrngE
0000000000017b70 S __ZN9starkware17PrimeFieldElement19kMontgomeryRSquaredE
000000000002b8b0 S __ZN9starkware17PrimeFieldElement28kHalfMultiplicativeGroupSizeE
0000000000017b90 S __ZN9starkware17PrimeFieldElement8kModulusE
0000000000012d54 T __ZN9starkware21VerifyEcdsaPartialKeyERKNS_17PrimeFieldElementES2_RKNSt3__14pairIS0_S0_EE
0000000000003fe8 T __ZN9starkware9SerializeERKNS_6BigIntILm4EEEN3gsl4spanINS4_4byteEEE
0000000000011698 T __ZN9starkware9SignEcdsaERKNS_6BigIntILm4EEERKNS_17PrimeFieldElementES3_
0000000000016334 T __ZNK9starkware17PrimeFieldElement3PowERKNSt3__16vectorIbNS1_9allocatorIbEEEE
0000000000016460 T __ZNK9starkware17PrimeFieldElement3PowEy
0000000000016850 T __ZNK9starkware17PrimeFieldElement4SqrtEv
0000000000016678 T __ZNK9starkware17PrimeFieldElement8IsSquareEv
As listed in the title - i tried compiling the library on windows runner and it doesn't seem to work for me, some syntax errors are an issue. Stacktrace below:
2022-01-13T18:15:35.6342205Z Build started 1/13/2022 6:15:35 PM.
2022-01-13T18:15:35.9825767Z Project "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\ALL_BUILD.vcxproj" on node 1 (default targets).
2022-01-13T18:15:35.9828090Z Project "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\ALL_BUILD.vcxproj" (1) is building "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\ZERO_CHECK.vcxproj" (2) on node 1 (default targets).
2022-01-13T18:15:35.9835247Z PrepareForBuild:
2022-01-13T18:15:35.9836058Z Creating directory "x64\Debug\ZERO_CHECK\".
2022-01-13T18:15:35.9938410Z Creating directory "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\".
2022-01-13T18:15:35.9999507Z InitializeBuildStatus:
2022-01-13T18:15:36.0000765Z Creating "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
2022-01-13T18:15:36.1228924Z CustomBuild:
2022-01-13T18:15:36.1230165Z Checking Build System
2022-01-13T18:15:36.2341628Z FinalizeBuildStatus:
2022-01-13T18:15:36.2343016Z Deleting file "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
2022-01-13T18:15:36.2344895Z Touching "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
2022-01-13T18:15:36.2352155Z Done Building Project "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\ZERO_CHECK.vcxproj" (default targets).
2022-01-13T18:15:36.3763552Z Project "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\ALL_BUILD.vcxproj" (1) is building "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\crypto\ffi\js\js_test.vcxproj" (3) on node 1 (default targets).
2022-01-13T18:15:36.3766495Z Project "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\crypto\ffi\js\js_test.vcxproj" (3) is building "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\crypto\ffi\crypto_c_exports.vcxproj" (4) on node 1 (default targets).
2022-01-13T18:15:36.3769063Z Project "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\crypto\ffi\crypto_c_exports.vcxproj" (4) is building "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj" (5) on node 1 (default targets).
2022-01-13T18:15:36.3770686Z PrepareForBuild:
2022-01-13T18:15:36.3771366Z Creating directory "algebra.dir\Debug\".
2022-01-13T18:15:36.3785009Z Creating directory "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\Debug\".
2022-01-13T18:15:36.3786683Z Creating directory "algebra.dir\Debug\algebra.tlog\".
2022-01-13T18:15:36.3801309Z InitializeBuildStatus:
2022-01-13T18:15:36.3802513Z Creating "algebra.dir\Debug\algebra.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
2022-01-13T18:15:36.4228828Z CustomBuild:
2022-01-13T18:15:36.4230808Z Building Custom Rule D:/a/starknet.py/starknet.py/crypto-cpp/src/starkware/algebra/CMakeLists.txt
2022-01-13T18:15:36.5237727Z ClCompile:
2022-01-13T18:15:36.5240870Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\CL.exe /c /I"D:\a\starknet.py\starknet.py\crypto-cpp\src" /Zi /nologo /W3 /WX /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /std:c++17 /Fo"algebra.dir\Debug\\" /Fd"D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\Debug\algebra.pdb" /external:W3 /Gd /TP /errorReport:queue -g "D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware\algebra\prime_field_element.cc"
2022-01-13T18:15:36.6053945Z cl : command line warning D9002: ignoring unknown option '-g' [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:36.6055867Z prime_field_element.cc
2022-01-13T18:15:41.1409387Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/algebra/big_int.h(18,44): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.1716604Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/algebra/big_int.h(18,44): error C2737: 'starkware::__uint128_t': constexpr object must be initialized [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.1719041Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/algebra/big_int.h(18,25): error C2737: 'starkware::__uint128_t': constexpr object must be initialized [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.2125013Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/algebra/big_int.h(18,37): error C2146: syntax error: missing ';' before identifier 'Umul128' [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.2131837Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/algebra/big_int.h(18,69): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.2134116Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/algebra/big_int.h(19,22): error C2061: syntax error: identifier '__uint128_t' [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.2136741Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/algebra/big_int.h(20,1): warning C4508: 'starkware::Umul128': function should return a value; 'void' return type assumed [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.3345932Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/utils/math.h(24,15): error C3861: '__builtin_clzll': identifier not found [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.4101178Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/utils/math.h(21,25): error C3615: constexpr function 'starkware::Log2Floor' cannot result in a constant expression [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.4439982Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/utils/math.h(25): message : failure was caused by control reaching the end of a constexpr function [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.7106018Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware\algebra\prime_field_element.cc(9,32): error C2131: expression did not evaluate to a constant [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.7108539Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware\algebra\prime_field_element.cc(9,49): message : function violates 'constexpr' rules or has errors [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.7110943Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware\algebra\prime_field_element.cc(9,49): message : see usage of 'starkware::Log2Floor' [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.8122365Z Done Building Project "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj" (default targets) -- FAILED.
2022-01-13T18:15:41.8615558Z Done Building Project "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\crypto\ffi\crypto_c_exports.vcxproj" (default targets) -- FAILED.
2022-01-13T18:15:41.8620430Z Done Building Project "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\crypto\ffi\js\js_test.vcxproj" (default targets) -- FAILED.
2022-01-13T18:15:41.8636275Z Done Building Project "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\ALL_BUILD.vcxproj" (default targets) -- FAILED.
2022-01-13T18:15:41.8654208Z
2022-01-13T18:15:41.8655826Z Build FAILED.
2022-01-13T18:15:41.8691179Z
2022-01-13T18:15:41.8702752Z "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\ALL_BUILD.vcxproj" (default target) (1) ->
2022-01-13T18:15:41.8704363Z "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\crypto\ffi\js\js_test.vcxproj" (default target) (3) ->
2022-01-13T18:15:41.8706018Z "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\crypto\ffi\crypto_c_exports.vcxproj" (default target) (4) ->
2022-01-13T18:15:41.8707483Z "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj" (default target) (5) ->
2022-01-13T18:15:41.8708465Z (ClCompile target) ->
2022-01-13T18:15:41.8709572Z cl : command line warning D9002: ignoring unknown option '-g' [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.8711770Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/algebra/big_int.h(20,1): warning C4508: 'starkware::Umul128': function should return a value; 'void' return type assumed [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.8713144Z
2022-01-13T18:15:41.8713473Z
2022-01-13T18:15:41.8714290Z "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\ALL_BUILD.vcxproj" (default target) (1) ->
2022-01-13T18:15:41.8715910Z "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\crypto\ffi\js\js_test.vcxproj" (default target) (3) ->
2022-01-13T18:15:41.8717355Z "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\crypto\ffi\crypto_c_exports.vcxproj" (default target) (4) ->
2022-01-13T18:15:41.8718792Z "D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj" (default target) (5) ->
2022-01-13T18:15:41.8719747Z (ClCompile target) ->
2022-01-13T18:15:41.8721292Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/algebra/big_int.h(18,44): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.8723948Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/algebra/big_int.h(18,44): error C2737: 'starkware::__uint128_t': constexpr object must be initialized [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.8727349Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/algebra/big_int.h(18,25): error C2737: 'starkware::__uint128_t': constexpr object must be initialized [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.8730472Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/algebra/big_int.h(18,37): error C2146: syntax error: missing ';' before identifier 'Umul128' [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.8732989Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/algebra/big_int.h(18,69): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.8735757Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/algebra/big_int.h(19,22): error C2061: syntax error: identifier '__uint128_t' [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.8737996Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/utils/math.h(24,15): error C3861: '__builtin_clzll': identifier not found [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.8743027Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware/utils/math.h(21,25): error C3615: constexpr function 'starkware::Log2Floor' cannot result in a constant expression [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.8745820Z D:\a\starknet.py\starknet.py\crypto-cpp\src\starkware\algebra\prime_field_element.cc(9,32): error C2131: expression did not evaluate to a constant [D:\a\starknet.py\starknet.py\crypto-cpp\build\Release\src\starkware\algebra\algebra.vcxproj]
2022-01-13T18:15:41.8749717Z
2022-01-13T18:15:41.8750390Z 2 Warning(s)
2022-01-13T18:15:41.8750902Z 9 Error(s)
2022-01-13T18:15:41.8751262Z
2022-01-13T18:15:41.8751720Z Time Elapsed 00:00:06.23
Any help in getting this to pass would be appreciated. Note that i'm not c++ expert - just trying to precompile the library to include it in starknet.py
's wheels for windows
SignEcdsa takes couple seconds, any way to make it quicker?
Currently flags are set like
#cgo CFLAGS: -I.
#cgo LDFLAGS: -L./.. -lcrypto_c_exports -Wl,-rpath=./.
#include <stdlib.h>
#include "../ecdsa.h"
#include "../pedersen_hash.h"
This is giving error error while loading shared libraries: libcrypto_c_exports.so: cannot open shared object file: No such file or directoryexit status 127
Setting the flags like this resolves the issue
#cgo CFLAGS: -I ${SRCDIR}/../
#cgo LDFLAGS: -L${SRCDIR}/../ -lcrypto_c_exports -Wl,-rpath=${SRCDIR}/../
#include <stdlib.h>
#include "ecdsa.h"
#include "pedersen_hash.h"
When running the presumbit.sh
script, the test js_test
fails with error:
10/11 Test #10: js_test ..........................***Failed 0.35 sec
> [email protected] test /home/dev/repos/starkware/crypto-cpp/src/starkware/crypto/ffi/js
> mocha
Error: Cannot find module 'bn.js'
Require stack:
- /home/dev/repos/starkware/crypto-cpp/src/starkware/crypto/ffi/js/crypto.js
- /home/dev/repos/starkware/crypto-cpp/src/starkware/crypto/ffi/js/test/crypto_test.js
- /home/dev/repos/starkware/crypto-cpp/src/starkware/crypto/ffi/js/node_modules/mocha/lib/esm-utils.js
- /home/dev/repos/starkware/crypto-cpp/src/starkware/crypto/ffi/js/node_modules/mocha/lib/mocha.js
- /home/dev/repos/starkware/crypto-cpp/src/starkware/crypto/ffi/js/node_modules/mocha/lib/cli/one-and-dones.js
- /home/dev/repos/starkware/crypto-cpp/src/starkware/crypto/ffi/js/node_modules/mocha/lib/cli/options.js
- /home/dev/repos/starkware/crypto-cpp/src/starkware/crypto/ffi/js/node_modules/mocha/bin/mocha
How do I compile the library "crypto_c_exports"? It should be straightforward but it really isn't.
Yes, you can use the StarkEx library with Java! StarkEx is a protocol for scalable and secure off-chain computation. While the library might be initially designed with a specific language in mind, you can often use it with other languages, including Java, through various methods.
One common approach is to use a library or tool that facilitates interoperability between languages, such as Java's native interface (JNI) for calling functions written in other languages like C or C++. If the StarkEx library provides a C or C++ interface, you can create a Java wrapper using JNI to make the functionality accessible from Java.
Keep in mind that you may need to check the documentation of the StarkEx library for any specific recommendations or available interfaces for Java integration. Additionally, consider looking for community-supported wrappers or projects that provide Java bindings for the StarkEx library
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.