Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: could not compile secp256k1-sys due to previous error #146

Closed
bn185068 opened this issue Nov 3, 2021 · 4 comments
Closed

error: could not compile secp256k1-sys due to previous error #146

bn185068 opened this issue Nov 3, 2021 · 4 comments

Comments

@bn185068
Copy link

bn185068 commented Nov 3, 2021

Error occurred on Build a Plugin step of the guide here: https://learn.sapio-lang.org/ch01-01-installation.html

Specific error code: error: failed to build archive: section too large
macOS Big Sur 11.6
Output of uname -a:

Darwin WUSBN185068-8YO 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64

See below for full command output:

WUSBN185068-8YO:bn185068 treepay % wasm-pack build
[INFO]: 🎯  Checking for the Wasm target...
[INFO]: 🌀  Compiling to Wasm...
   Compiling secp256k1-sys v0.4.1
   Compiling serde_json v1.0.68
error: failed to build archive: section too large

The following warnings were emitted during compilation:

warning: depend/secp256k1/src/secp256k1.c:7:9: warning: 'SECP256K1_BUILD' macro redefined [-Wmacro-redefined]
warning: #define SECP256K1_BUILD
warning:         ^
warning: <command line>:1:9: note: previous definition is here
warning: #define SECP256K1_BUILD 1
warning:         ^
warning: In file included from depend/secp256k1/src/secp256k1.c:12:
warning: In file included from depend/secp256k1/src/assumptions.h:12:
warning: In file included from depend/secp256k1/src/util.h:16:
warning: wasm-sysroot/stdio.h:4:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_INT_SIZE = sizeof(int);
warning:                            ^
warning: wasm-sysroot/stdio.h:5:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_INT_ALIGN = alignof(int);
warning:                            ^
warning: wasm-sysroot/stdio.h:7:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_UNSIGNED_INT_SIZE = sizeof(unsigned int);
warning:                            ^
warning: wasm-sysroot/stdio.h:8:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_UNSIGNED_INT_ALIGN = alignof(unsigned int);
warning:                            ^
warning: wasm-sysroot/stdio.h:10:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_SIZE_T_SIZE = sizeof(size_t);
warning:                            ^
warning: wasm-sysroot/stdio.h:11:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_SIZE_T_ALIGN = alignof(size_t);
warning:                            ^
warning: wasm-sysroot/stdio.h:13:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_UNSIGNED_CHAR_SIZE = sizeof(unsigned char);
warning:                            ^
warning: wasm-sysroot/stdio.h:14:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_UNSIGNED_CHAR_ALIGN = alignof(unsigned char);
warning:                            ^
warning: wasm-sysroot/stdio.h:16:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_PTR_SIZE = sizeof(void*);
warning:                            ^
warning: wasm-sysroot/stdio.h:17:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_PTR_ALIGN = alignof(void*);
warning:                            ^
warning: In file included from depend/secp256k1/src/secp256k1.c:17:
warning: In file included from depend/secp256k1/src/ecmult_impl.h:16:
warning: In file included from depend/secp256k1/src/ecmult.h:12:
warning: depend/secp256k1/src/scratch.h:24:38: warning: unused function 'rustsecp256k1_v0_4_1_scratch_create' [-Wunused-function]
warning: static rustsecp256k1_v0_4_1_scratch* rustsecp256k1_v0_4_1_scratch_create(const rustsecp256k1_v0_4_1_callback* error_callback, size_t max_size);
warning:                                      ^
warning: depend/secp256k1/src/scratch.h:26:13: warning: unused function 'rustsecp256k1_v0_4_1_scratch_destroy' [-Wunused-function]
warning: static void rustsecp256k1_v0_4_1_scratch_destroy(const rustsecp256k1_v0_4_1_callback* error_callback, rustsecp256k1_v0_4_1_scratch* scratch);
warning:             ^
warning: In file included from depend/secp256k1/src/secp256k1.c:17:
warning: depend/secp256k1/src/ecmult_impl.h:1035:12: warning: unused function 'rustsecp256k1_v0_4_1_ecmult_multi_var' [-Wunused-function]
warning: static int rustsecp256k1_v0_4_1_ecmult_multi_var(const rustsecp256k1_v0_4_1_callback* error_callback, const rustsecp256k1_v0_4_1_ecmult_context *ctx, rustsecp256k1_v0_4_1_scratch *scratch, rustsecp256k1_v0_4_1_gej *r, const rustsecp256k1_v0_4_1_scalar *inp_g_sc, rustsecp256k1_v0_4_1_ecmult_multi_callback cb, void *cbdata, size_t n) {
warning:            ^
warning: depend/secp256k1/src/ecmult_impl.h:621:12: warning: unused function 'rustsecp256k1_v0_4_1_ecmult_strauss_batch_single' [-Wunused-function]
warning: static int rustsecp256k1_v0_4_1_ecmult_strauss_batch_single(const rustsecp256k1_v0_4_1_callback* error_callback, const rustsecp256k1_v0_4_1_ecmult_context *actx, rustsecp256k1_v0_4_1_scratch *scratch, rustsecp256k1_v0_4_1_gej *r, const rustsecp256k1_v0_4_1_scalar *inp_g_sc, rustsecp256k1_v0_4_1_ecmult_multi_callback cb, void *cbdata, size_t n) {
warning:            ^
warning: depend/secp256k1/src/ecmult_impl.h:863:15: warning: unused function 'rustsecp256k1_v0_4_1_pippenger_scratch_size' [-Wunused-function]
warning: static size_t rustsecp256k1_v0_4_1_pippenger_scratch_size(size_t n_points, int bucket_window) {
warning:               ^
warning: depend/secp256k1/src/ecmult_impl.h:944:12: warning: unused function 'rustsecp256k1_v0_4_1_ecmult_pippenger_batch_single' [-Wunused-function]
warning: static int rustsecp256k1_v0_4_1_ecmult_pippenger_batch_single(const rustsecp256k1_v0_4_1_callback* error_callback, const rustsecp256k1_v0_4_1_ecmult_context *actx, rustsecp256k1_v0_4_1_scratch *scratch, rustsecp256k1_v0_4_1_gej *r, const rustsecp256k1_v0_4_1_scalar *inp_g_sc, rustsecp256k1_v0_4_1_ecmult_multi_callback cb, void *cbdata, size_t n) {
warning:            ^
warning: 17 warnings generated.
warning: warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: archive library: /Users/BN185068/Projects/Bitcoin/sapio/plugin-example/target/wasm32-unknown-unknown/release/build/secp256k1-sys-64f6e92ae7a58219/out/libsecp256k1.a the table of contents is empty (no object file members in the library define global symbols)

error: could not compile `secp256k1-sys` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
Error: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit code: 101
  full command: "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"
@bnonni
Copy link

bnonni commented Nov 3, 2021

Found a solution. You can close this issue.

@JeremyRubin
Copy link
Collaborator

yay!

what was the fix?

@bnonni
Copy link

bnonni commented Nov 4, 2021

Yes, apologies, I should have explained. After many failed attempts with this error, I did the following:

brew install llvm
cargo clean
AR=/usr/local/opt/llvm/bin/llvm-ar CC=/usr/local/opt/llvm/bin/clang wasm-pack build

Not sure if its related, but I also installed secp256k1 via bitcoin-core here: git@github.com:bitcoin-core/secp256k1.git

Some combination of this seemed to resolve the error: failed to build archive: section too large referenced in rust-bitcoin/rust-secp256k1#283. I do not have an M1, but I think specifying AR and CC in the command instead of exporting to the env via zshrc or bashrc resolved this problem.

However, I'm now facing new errors, but those look to be with the rust code, so I'll open a new issue :)

@kevin-valerio
Copy link

export SKIP_WASM_BUILD=1 worked for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants