go-ethereum schnorr sig libsecp256k1 –enable-module-schnorrsig

I want to use Schnorr Sign() from go-ethereum/crypto/secp256k1

To compile optional modules (such as Schnorr signatures), you need to run ./configure with additional flags (such as –enable-module-schnorrsig)

source

sudo apt-cache search autoreconf
sudo apt install dh-autoreconf
./autogen.sh
./configure --enable-module-schnorrsig

Didn’t worked for me, so I had to download the latest libsecp256k1 and place it into github.com/ethereum/go-ethereum@v1.15.5/crypto/secp256k1/libsecp256k1/

./configure --enable-module-schnorrsig
make
make check
sudo make install

And, it worked!

PASS: noverify_tests
PASS: tests
PASS: exhaustive_tests
============================================================================
Testsuite summary for libsecp256k1 0.6.0
============================================================================
# TOTAL: 3
# PASS:  3
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================

make  install-am
make[1]: Entering directory '~/go/pkg/mod/github.com/ethereum/go-ethereum@v1.15.5/crypto/secp256k1/libsecp256k1'
make[2]: Entering directory '~/go/pkg/mod/github.com/ethereum/go-ethereum@v1.15.5/crypto/secp256k1/libsecp256k1'
 /usr/bin/mkdir -p '/usr/local/lib'
 /bin/bash ./libtool   --mode=install /usr/bin/install -c   libsecp256k1.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libsecp256k1.so.5.0.0 /usr/local/lib/libsecp256k1.so.5.0.0
libtool: install: (cd /usr/local/lib && { ln -s -f libsecp256k1.so.5.0.0 libsecp256k1.so.5 || { rm -f libsecp256k1.so.5 && ln -s libsecp256k1.so.5.0.0 libsecp256k1.so.5; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libsecp256k1.so.5.0.0 libsecp256k1.so || { rm -f libsecp256k1.so && ln -s libsecp256k1.so.5.0.0 libsecp256k1.so; }; })
libtool: install: /usr/bin/install -c .libs/libsecp256k1.lai /usr/local/lib/libsecp256k1.la
libtool: install: /usr/bin/install -c .libs/libsecp256k1.a /usr/local/lib/libsecp256k1.a
libtool: install: chmod 644 /usr/local/lib/libsecp256k1.a
libtool: install: ranlib /usr/local/lib/libsecp256k1.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 /usr/bin/mkdir -p '/usr/local/include'
 /usr/bin/install -c -m 644 include/secp256k1.h include/secp256k1_preallocated.h include/secp256k1_ecdh.h include/secp256k1_extrakeys.h include/secp256k1_schnorrsig.h include/secp256k1_musig.h include/secp256k1_ellswift.h '/usr/local/include'
 /usr/bin/mkdir -p '/usr/local/lib/pkgconfig'
 /usr/bin/install -c -m 644 libsecp256k1.pc '/usr/local/lib/pkgconfig'
make[2]: Leaving directory '~/go/pkg/mod/github.com/ethereum/go-ethereum@v1.15.5/crypto/secp256k1/libsecp256k1'
make[1]: Leaving directory '~/go/pkg/mod/github.com/ethereum/go-ethereum@v1.15.5/crypto/secp256k1/libsecp256k1'

However, I still get invalid: signature is invalid when I try to use secp256k1.Sign() in my code and I don’t understand what to do next to make this thing work. Should I link against installed libraries in a given directory as suggested, or update the go-ethereum/crypto/secp256k1 package itself somehow?

Another idea I had is to remove go-ethereum, clean and then go install it again with the @latest

Any suggestions appreciated.