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 when compiling with musig module enabled #141

Closed
devos50 opened this issue Aug 18, 2021 · 3 comments · Fixed by #142
Closed

Error when compiling with musig module enabled #141

devos50 opened this issue Aug 18, 2021 · 3 comments · Fixed by #142

Comments

@devos50
Copy link

devos50 commented Aug 18, 2021

I'm writing some CFFI Python bindings to the musig module and when doing so, I got the following error:

generating cffi module 'build/temp.macosx-11-x86_64-3.9/_libsecp256k1.c'
already up-to-date
building '_libsecp256k1' extension
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -DCFFI_ENABLE_RECOVERY -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -Ibuild/temp.macosx-11-x86_64-3.9/include -I/Users/martijndevos/Documents/coincurve/build/temp.macosx-11-x86_64-3.9/include -c build/temp.macosx-11-x86_64-3.9/_libsecp256k1.c -o build/temp.macosx-11-x86_64-3.9/build/temp.macosx-11-x86_64-3.9/_libsecp256k1.o
In file included from build/temp.macosx-11-x86_64-3.9/_libsecp256k1.c:574:
build/temp.macosx-11-x86_64-3.9/include/secp256k1_musig.h:244:178: error: '__nonnull__' attribute parameter 1 is out of bounds
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(5) SECP256K1_ARG_NONNULL(7) SECP256K1_ARG_NONNULL(8) SECP256K1_ARG_NONNULL(11);
                                                                                                                                                                                 ^                     ~~
build/temp.macosx-11-x86_64-3.9/include/secp256k1.h:167:54: note: expanded from macro 'SECP256K1_ARG_NONNULL'
#  define SECP256K1_ARG_NONNULL(_x)  __attribute__ ((__nonnull__(_x)))
                                                     ^           ~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1

The error seems to originate from this line. I'm not entirely sure, but I suspect that the SECP256K1_ARG_NONNULL(11) is wrong since the secp256k1_musig_session_init function only has ten parameters (given that they start counting parameter indices from 1). Changing this to SECP256K1_ARG_NONNULL(10) seems to fix the compilation issue, although I'm not sure if this is the proper fix.

@jonasnick
Copy link
Contributor

Thank you @devos50. Yes, this is the proper fix. Opened PR #142.

I'm writing some CFFI Python bindings to the musig module

Just so you're aware, the musig module will be replaced by a MuSig2 module (see #131).

@devos50
Copy link
Author

devos50 commented Aug 18, 2021

@jonasnick great, thanks!

Just so you're aware, the musig module will be replaced by a MuSig2 module (see #131).

I am aware of the MuSig2 code but I didn't know about the pending PR. I finished the Python bindings to the (old) MuSig implementation and they seem to work correctly, also see here. I'm currently working on the bindings to MuSig2 but they require me to rewrite a few bindings since a few function signatures have changed. 😀

@jonasnick
Copy link
Contributor

... and they may change again in the future, sorry 😬. But feel free to give me feedback on the API in the PR if you notice something.

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

Successfully merging a pull request may close this issue.

2 participants