A per title.
Details
Details
- Reviewers
schancel freetrader - Group Reviewers
Restricted Project - Commits
- rSTAGING700f3bd6ca19: Add cmake build for libsecp256k1
rABC700f3bd6ca19: Add cmake build for libsecp256k1
mkdir build && cd build cmake -GNinja .. ninja
Check that the library is built properly.
Diff Detail
Diff Detail
- Repository
- rABC Bitcoin ABC
- Branch
- buildcmakesecp256k1
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 1353 Build 1353: arc lint + arc unit
Event Timeline
Comment Actions
Failed for me:
[14/21] Building C object src/secp256k1/CMakeFiles/exhaustive_tests.dir/src/tests_exhaustive.c.o FAILED: src/secp256k1/CMakeFiles/exhaustive_tests.dir/src/tests_exhaustive.c.o ccache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DHAVE_LIBGMP -DHAVE___INT128 -DSECP256K1_BUILD -DUSE_FIELD_5X52 -DUSE_FIELD_INV_BUILTIN -DUSE_NUM_GMP -DUSE_SCALAR_4X64 -DUSE_SCALAR_INV_BUILTIN -DVERIFY -I../src/secp256k1/. -I../src/secp256k1/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -MD -MT src/secp256k1/CMakeFiles/exhaustive_tests.dir/src/tests_exhaustive.c.o -MF src/secp256k1/CMakeFiles/exhaustive_tests.dir/src/tests_exhaustive.c.o.d -o src/secp256k1/CMakeFiles/exhaustive_tests.dir/src/tests_exhaustive.c.o -c ../src/secp256k1/src/tests_exhaustive.c In file included from ../src/secp256k1/src/tests_exhaustive.c:25: In file included from ../src/secp256k1/src/group.h:10: In file included from ../src/secp256k1/src/num.h:17: ../src/secp256k1/src/num_gmp.h:10:10: fatal error: 'gmp.h' file not found #include <gmp.h> ^~~~~~~ 1 error generated. [19/21] Building C object src/secp256k1/CMakeFiles/secp256k1_tests.dir/src/tests.c.o FAILED: src/secp256k1/CMakeFiles/secp256k1_tests.dir/src/tests.c.o ccache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DHAVE_LIBGMP -DHAVE___INT128 -DUSE_FIELD_5X52 -DUSE_FIELD_INV_BUILTIN -DUSE_NUM_GMP -DUSE_SCALAR_4X64 -DUSE_SCALAR_INV_BUILTIN -DVERIFY -I../src/secp256k1/. -I../src/secp256k1/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -MD -MT src/secp256k1/CMakeFiles/secp256k1_tests.dir/src/tests.c.o -MF src/secp256k1/CMakeFiles/secp256k1_tests.dir/src/tests.c.o.d -o src/secp256k1/CMakeFiles/secp256k1_tests.dir/src/tests.c.o -c ../src/secp256k1/src/tests.c In file included from ../src/secp256k1/src/tests.c:17: In file included from ../src/secp256k1/src/secp256k1.c:10: In file included from ../src/secp256k1/src/num_impl.h:14: In file included from ../src/secp256k1/src/num.h:17: ../src/secp256k1/src/num_gmp.h:10:10: fatal error: 'gmp.h' file not found #include <gmp.h> ^~~~~~~ 1 error generated. ninja: build stopped: subcommand failed.
Comment Actions
Not sure if there is a better way to do this, but this fixed the problem for me:
diff --git a/src/secp256k1/CMakeLists.txt b/src/secp256k1/CMakeLists.txt index 56263cebe..f3a1bcfad 100644 --- a/src/secp256k1/CMakeLists.txt +++ b/src/secp256k1/CMakeLists.txt @@ -59,6 +59,14 @@ if(SECP256K1_BUILD_TEST) add_test(NAME secp256k1_tests COMMAND secp256k1_tests) target_link_libraries(secp256k1_tests secp256k1) target_compile_definitions(secp256k1_tests PUBLIC VERIFY) + if(GMP_INCLUDE_DIR AND GMP_LIBRARIES) + target_compile_definitions(secp256k1_tests PUBLIC HAVE_LIBGMP) + target_compile_definitions(secp256k1_tests PUBLIC USE_NUM_GMP) + target_include_directories(secp256k1_tests PRIVATE ${GMP_INCLUDE_DIR}) + target_link_libraries(secp256k1_tests ${GMP_LIBRARIES}) + else() + target_compile_definitions(secp256k1_tests PUBLIC USE_NUM_NONE) + endif() add_executable(exhaustive_tests src/tests_exhaustive.c) add_test(NAME exhaustive_tests COMMAND exhaustive_tests) @@ -67,6 +75,14 @@ if(SECP256K1_BUILD_TEST) # This should not be enabled at the same time as coverage is. # TODO: support coverage. target_compile_definitions(exhaustive_tests PUBLIC VERIFY) + if(GMP_INCLUDE_DIR AND GMP_LIBRARIES) + target_compile_definitions(exhaustive_tests PUBLIC HAVE_LIBGMP) + target_compile_definitions(exhaustive_tests PUBLIC USE_NUM_GMP) + target_include_directories(exhaustive_tests PRIVATE ${GMP_INCLUDE_DIR}) + target_link_libraries(exhaustive_tests ${GMP_LIBRARIES}) + else() + target_compile_definitions(exhaustive_tests PUBLIC USE_NUM_NONE) + endif() endif(SECP256K1_BUILD_TEST) # TODO: emult static precomputation
This comment was removed by schancel.