spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.38k stars 3.07k forks source link

libsecp256k1 library found but it was built without required module (--enable-module-recovery) #6465

Open kenneth opened 4 years ago

kenneth commented 4 years ago
 ./run_electrum
E | ecc_fast | failed to load libsecp256k1: LibModuleMissing('libsecp256k1 library found but it was built without required module (--enable-module-recovery)')
Error: Failed to load libsecp256k1.
MsFloofie commented 4 years ago

Why did you close this without saying the fix?

SomberNight commented 4 years ago

Ok, so apparently this happens on debian 10, but not on e.g. ubuntu 20.04. I will have to look into this more, but I suppose the idea is that the libsecp256k1-0 package in debian 10 apt does not have the recovery module.

Workarounds for users, in order of increasing complexity:

  1. use AppImage instead, or
  2. if you run from git clone OR from tar.gz but WITHOUT installing with pip, then:
    $ contrib/make_libsecp256k1.sh
  3. if you pip install electrum; example for version 4.0.3:
    $ tar -xzvf Electrum-4.0.3.tar.gz
    $ ./Electrum-4.0.3/contrib/make_libsecp256k1.sh
    $ python3 -m pip show electrum
    [...]
    Location: /home/user/.local/lib/python3.8/site-packages
    [...]

    ^ look at "Location" line, and copy libsecp256k1.so.0 into electrum folder at Location, e.g.:

    $ cp Electrum-4.0.3/electrum/libsecp256k1.so.0 /home/user/.local/lib/python3.8/site-packages/electrum
nickfarrow commented 3 years ago

For anyone else having this issue, when compiling with ./Electrum-4.0.3/contrib/make_libsecp256k1.sh It spits out a library path like /home/nick/install/electrum-4.0.5/contrib/secp256k1/dist/lib Running as LD_LIBRARY_PATH=/home/nick/install/electrum-4.0.5/contrib/secp256k1/dist/lib electrum works for me.

ZenulAbidin commented 1 year ago

For anyone else having this issue, when compiling with ./Electrum-4.0.3/contrib/make_libsecp256k1.sh It spits out a library path like /home/nick/install/electrum-4.0.5/contrib/secp256k1/dist/lib Running as LD_LIBRARY_PATH=/home/nick/install/electrum-4.0.5/contrib/secp256k1/dist/lib electrum works for me.

@nickfarrow You can just add the path to /etc/ld.so.conf:

/home/nick/install/electrum-4.0.5/contrib/secp256k1/dist/lib

Run sudo ldconfig to update the system library paths, and make sure you don't remove the Electrum folder by accident.


@SomberNight What do you think about phasing out the module-recovery code in the long run?

SomberNight commented 1 year ago

What do you think about phasing out the module-recovery code in the long run?

Why? libsecp256k1 is a good library. The "recovery" module is optional in it, unfortunately, yes; but is that the sole reason you would want not to require it? Then we would need an alternative or at least a fallback implementation. In the past we used python-ecdsa for this. I would like to minimise crypto code we need to maintain. And libsecp256k1 is probably much more tested and more widely used.

Also, for taproot support we will need another optional module from libsecp256k1 ("schnorrsig"), and there is no alternative for that.

I think people running from source will just have to make sure to get libsecp with the needed extra modules included. In particular the distro packagers for libsecp256k1 should make the optional modules available either as part of the main package or as additional packages.