Fatal error libsecp256k1 include secp256k1 h file not found

Hi there, please note that this is an issue tracker reserved for bug reports and feature requests. For general questions please use the gitter channel or the Ethereum stack exchange at https://ethe...

Hi there,

please note that this is an issue tracker reserved for bug reports and feature requests.

For general questions please use the gitter channel or the Ethereum stack exchange at https://ethereum.stackexchange.com.

System information

geth: use the latest tag=> v1.8.15

NAME="Ubuntu"
VERSION="16.04.3 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.3 LTS"

Expected behaviour

Well I test the secpk256k1 using the go mod command, because of the fucking GFW, I want to build my project with the flag -mod=vendor

Actual behaviour

It failed with vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/curve.go:42:44: fatal error: libsecp256k1/include/secp256k1.h: No such file or directory.

Steps to reproduce the behaviour

This is my simple test code:

package main

import (
        "fmt"
        "github.com/ethereum/go-ethereum/common/hexutil"
        "github.com/ethereum/go-ethereum/crypto"
        "github.com/ethereum/go-ethereum/crypto/secp256k1"
        "log"
)

func main()  {
        bytes, err := hexutil.Decode("0x71b9732fa43b52d8c9085c053064b55dccc8785da7f12b3812787ee3def367ba0a8796dafb76fd5a146c226036092b7f5dd59feecb92776f7bb2cf2a48594ae201")
        if err != nil {
                log.Fatal(err)
        }
        pub, err := secp256k1.RecoverPubkey(crypto.Keccak256Hash([]byte("hello")).Bytes(), bytes)
        if err != nil {
                log.Fatal(err)
        }
        fmt.Println(hexutil.Encode(pub))
}

And this is my test step

> root@sanguohot:/opt# mkdir test
> root@sanguohot:/opt# cp ./medichain/test/secp256k1.test.go test/
> root@sanguohot:/opt# cd test/
> root@sanguohot:/opt/test# go mod init github.com/sanguohot/test
> go: creating new go.mod: module github.com/sanguohot/test
> root@sanguohot:/opt/test# go mod tidy && go mod vendor
> go: finding github.com/ethereum/go-ethereum/common/hexutil latest
> go: finding github.com/ethereum/go-ethereum/crypto latest
> go: finding github.com/ethereum/go-ethereum/crypto/secp256k1 latest
> go: finding github.com/ethereum/go-ethereum/common latest
> go: finding github.com/btcsuite/btcd/btcec latest
> go: finding github.com/btcsuite/btcd latest
> go: finding gopkg.in/check.v1 latest
> go: finding github.com/davecgh/go-spew/spew latest
> root@sanguohot:/opt/test# go build -mod=vendor secp256k1.test.go
> # github.com/ethereum/go-ethereum/crypto/secp256k1
> vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/curve.go:42:44: fatal error: 
> libsecp256k1/include/secp256k1.h: No such file or directory
> compilation terminated.

I have already raised an issue golang/go#27667
Any help would be greatly appreciated.

I get this error when running go vet in my project, with vendored dependencies.

$ go vet ./...
# <project path...>/vendor/github.com/ethereum/go-ethereum/crypto/secp256k1
vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/curve.go:42:10: fatal error: libsecp256k1/include/secp256k1.h: No such file or directory
 #include "libsecp256k1/include/secp256k1.h"

I thought that this was a dependency missing in the development environment, but when looking at the original project source, the include path is relative to the source file.

Why can the file not be found?

asked Aug 20, 2018 at 10:43

danielcooperxyz's user avatar

danielcooperxyzdanielcooperxyz

9601 gold badge15 silver badges28 bronze badges

Some dependency management tools for go do not vendor all code that is referenced by the project. This means that in some circumstances C code, that can be used in go files with cgo, are not included in the vendor directory.

I have encountered this issue twice with two separate vendoring tools, but there is work to support these use cases.

The simplest method I have found so far is to use govendor and then import the complete directory to ensure that all the required files are there. This is a very simple solution that ignores a lot of the complexity around including c dependencies in go projects, but fixes the issue whilst there is no permanent fix for the issue.

go get github.com/kardianos/govendor
govendor init
govendor add +e
# Remove the directory that is missing the c dependencies
rm -rf ./vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/
# Add the file and include all files
# https://github.com/kardianos/govendor/issues/247
govendor add github.com/ethereum/go-ethereum/crypto/secp256k1/^

answered Aug 20, 2018 at 10:43

danielcooperxyz's user avatar

danielcooperxyzdanielcooperxyz

9601 gold badge15 silver badges28 bronze badges

1

In Gopkg.toml you can add

[prune]
  go-tests = true
  unused-packages = true
  non-go = true

  [[prune.project]]
    name = "github.com/ethereum/go-ethereum"
    non-go = false
    unused-packages = false

answered Mar 7, 2019 at 4:50

truongnm's user avatar

truongnmtruongnm

2,1712 gold badges30 silver badges47 bronze badges

Recommend Projects

  • React photo

    React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo

    Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo

    Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo

    TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo

    Django

    The Web framework for perfectionists with deadlines.

  • Laravel photo

    Laravel

    A PHP framework for web artisans

  • D3 photo

    D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Visualization

    Some thing interesting about visualization, use data art

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo

    Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo

    Microsoft

    Open source projects and samples from Microsoft.

  • Google photo

    Google

    Google ❤️ Open Source for everyone.

  • Alibaba photo

    Alibaba

    Alibaba Open Source for everyone

  • D3 photo

    D3

    Data-Driven Documents codes.

  • Tencent photo

    Tencent

    China tencent open source team.

Не получается запустить биткойн-кошелек Electrum
От сюда
https://electrum.org/#download
и отсюда
https://askubuntu.ru/questions/182702/kak-ustanovit-bitkojn-koshelek-electrum

почитал как установить кошелек Electrum, выполнил

# apt-get install libsecp256k1_0
$ wget https://download.electrum.org/4.0.9/Electrum-4.0.9.tar.gz.asc
$ wget https://download.electrum.org/4.0.9/Electrum-4.0.9.tar.gz
$ pip install Electrum-4.0.9.tar.gz
все поставилось, все норм! Но когда пытаюсь его запустить то он ругается

$ 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.

Что не хватает для счастья? Как мне запустить этот кошелек на Альт P9?


Записан


apt-get install libsecp256k1-devel


Записан

Андрей Черепанов (cas@)


Этот пакет уже оказывается был установлен. Не полгечало ((

# apt-get install libsecp256k1-devel
Чтение списков пакетов... Завершено
Построение дерева зависимостей... Завершено
Последняя версия libsecp256k1-devel уже установлена.
0 будет обновлено, 0 новых установлено, 0 пакетов будет удалено и 175 не будет обновлено.
$ 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.


Записан


Этот пакет уже оказывается был установлен. Не полгечало ((
# apt-get install libsecp256k1-devel
Чтение списков пакетов... Завершено
Построение дерева зависимостей... Завершено
Последняя версия libsecp256k1-devel уже установлена.
0 будет обновлено, 0 новых установлено, 0 пакетов будет удалено и 175 не будет обновлено.
$ 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.

Надо писать разработчикам этого программного обеспечения.


Записан

Андрей Черепанов (cas@)


Я получаю эту ошибку при запуске go vet в моем проекте с зависимостями от поставщиков.

$ go vet ./...
# <project path...>/vendor/github.com/ethereum/go-ethereum/crypto/secp256k1
vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/curve.go:42:10: fatal error: libsecp256k1/include/secp256k1.h: No such file or directory
 #include "libsecp256k1/include/secp256k1.h"

Я думал, что эта зависимость отсутствует в среде разработки, но, глядя на исходный источник проекта, путь включения указывается относительно исходного файла.

Почему не удается найти файл?

2 ответа

Лучший ответ

Некоторые инструменты управления зависимостями для go не поставляют весь код, на который ссылается проект. Это означает, что в некоторых случаях код C, который можно использовать в файлах go с cgo, не включается в каталог vendor.

Я дважды сталкивался с этой проблемой с двумя отдельными инструментами для поставщиков, но есть работа по поддержке этих вариантов использования .

Самый простой способ, который я нашел до сих пор, — использовать govendor, а затем импортировать весь каталог, чтобы убедиться, что все необходимые файлы есть. Это очень простое решение, которое игнорирует большую часть сложности, связанной с включением зависимостей c в проекты go, но устраняет проблему, хотя окончательного решения проблемы нет.

go get github.com/kardianos/govendor
govendor init
govendor add +e
# Remove the directory that is missing the c dependencies
rm -rf ./vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/
# Add the file and include all files
# https://github.com/kardianos/govendor/issues/247
govendor add github.com/ethereum/go-ethereum/crypto/secp256k1/^


2

danielcooperxyz
28 Янв 2019 в 10:42

В Gopkg.toml вы можете добавить

[prune]
  go-tests = true
  unused-packages = true
  non-go = true

  [[prune.project]]
    name = "github.com/ethereum/go-ethereum"
    non-go = false
    unused-packages = false


1

truongnm
7 Мар 2019 в 04:50

hi al.
I am trying to install this lib but got failed on Mac Catalina
this is error log i got. Can you take a look.

2019-12-28T15:35:26,718 Collecting secp256k1
2019-12-28T15:35:26,718   Created temporary directory: /private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-unpack-8b97l6sg
2019-12-28T15:35:26,782   Using cached https://files.pythonhosted.org/packages/52/62/d7bf3829e126e517e253d2e22a63511c54bbaac34d7ddea316cde040fc49/secp256k1-0.13.2.tar.gz
2019-12-28T15:35:26,842   Added secp256k1 from https://files.pythonhosted.org/packages/52/62/d7bf3829e126e517e253d2e22a63511c54bbaac34d7ddea316cde040fc49/secp256k1-0.13.2.tar.gz#sha256=a3b43e02d321c09eafa769a6fc2c156f555cab3a7db62175ef2fd21e16cdf20c to build tracker '/private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-req-tracker-andiakrd'
2019-12-28T15:35:26,847     Running setup.py (path:/private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-install-asprpmg1/secp256k1/setup.py) egg_info for package secp256k1
2019-12-28T15:35:26,847     Running command python setup.py egg_info
2019-12-28T15:35:27,126     0.29.2
2019-12-28T15:35:27,147     WARNING: The wheel package is not available.
2019-12-28T15:35:28,680       ERROR: Command errored out with exit status 1:
2019-12-28T15:35:28,681        command: /Users/antory/.pyenv/versions/3.6.9/envs/p36env/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-wheel-y2eg77wj/pytest-runner/setup.py'"'"'; __file__='"'"'/private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-wheel-y2eg77wj/pytest-runner/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-wheel-cwga1twi
2019-12-28T15:35:28,681            cwd: /private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-wheel-y2eg77wj/pytest-runner/
2019-12-28T15:35:28,681       Complete output (7 lines):
2019-12-28T15:35:28,681       WARNING: The wheel package is not available.
2019-12-28T15:35:28,681       usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
2019-12-28T15:35:28,681          or: setup.py --help [cmd1 cmd2 ...]
2019-12-28T15:35:28,681          or: setup.py --help-commands
2019-12-28T15:35:28,681          or: setup.py cmd --help

2019-12-28T15:35:28,681       error: invalid command 'bdist_wheel'
2019-12-28T15:35:28,681       ----------------------------------------
2019-12-28T15:35:28,681       ERROR: Failed building wheel for pytest-runner
2019-12-28T15:35:28,903     ERROR: Failed to build one or more wheels
2019-12-28T15:35:28,948     Traceback (most recent call last):
2019-12-28T15:35:28,948       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
2019-12-28T15:35:28,949         subprocess.check_call(cmd)
2019-12-28T15:35:28,949       File "/Users/antory/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 311, in check_call
2019-12-28T15:35:28,949         raise CalledProcessError(retcode, cmd)
2019-12-28T15:35:28,949     subprocess.CalledProcessError: Command '['/Users/antory/.pyenv/versions/3.6.9/envs/p36env/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/tmpkysqesjx', '--quiet', 'pytest-runner==2.6.2']' returned non-zero exit status 1.

2019-12-28T15:35:28,949     During handling of the above exception, another exception occurred:

2019-12-28T15:35:28,949     Traceback (most recent call last):
2019-12-28T15:35:28,949       File "<string>", line 1, in <module>
2019-12-28T15:35:28,949       File "/private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-install-asprpmg1/secp256k1/setup.py", line 295, in <module>
2019-12-28T15:35:28,949         "Topic :: Security :: Cryptography"
2019-12-28T15:35:28,949       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup
2019-12-28T15:35:28,949         _install_setup_requires(attrs)
2019-12-28T15:35:28,949       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
2019-12-28T15:35:28,949         dist.fetch_build_eggs(dist.setup_requires)
2019-12-28T15:35:28,950       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/setuptools/dist.py", line 721, in fetch_build_eggs
2019-12-28T15:35:28,950         replace_conflicting=True,
2019-12-28T15:35:28,950       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 782, in resolve
2019-12-28T15:35:28,950         replace_conflicting=replace_conflicting
2019-12-28T15:35:28,950       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1065, in best_match
2019-12-28T15:35:28,950         return self.obtain(req, installer)
2019-12-28T15:35:28,950       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1077, in obtain
2019-12-28T15:35:28,950         return installer(requirement)
2019-12-28T15:35:28,950       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/setuptools/dist.py", line 777, in fetch_build_egg
2019-12-28T15:35:28,950         return fetch_build_egg(self, req)
2019-12-28T15:35:28,950       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
2019-12-28T15:35:28,950         raise DistutilsError(str(e))
2019-12-28T15:35:28,950     distutils.errors.DistutilsError: Command '['/Users/antory/.pyenv/versions/3.6.9/envs/p36env/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/tmpkysqesjx', '--quiet', 'pytest-runner==2.6.2']' returned non-zero exit status 1.
2019-12-28T15:35:28,969 Cleaning up...
2019-12-28T15:35:28,970   Removing source in /private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-install-asprpmg1/secp256k1
2019-12-28T15:35:28,983 Removed secp256k1 from https://files.pythonhosted.org/packages/52/62/d7bf3829e126e517e253d2e22a63511c54bbaac34d7ddea316cde040fc49/secp256k1-0.13.2.tar.gz#sha256=a3b43e02d321c09eafa769a6fc2c156f555cab3a7db62175ef2fd21e16cdf20c from build tracker '/private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-req-tracker-andiakrd'
2019-12-28T15:35:28,983 Removed build tracker '/private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-req-tracker-andiakrd'
2019-12-28T15:35:28,983 ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
2019-12-28T15:35:28,983 Exception information:
2019-12-28T15:35:28,983 Traceback (most recent call last):
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 153, in _main
2019-12-28T15:35:28,983     status = self.run(options, args)
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 382, in run
2019-12-28T15:35:28,983     resolver.resolve(requirement_set)
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 201, in resolve
2019-12-28T15:35:28,983     self._resolve_one(requirement_set, req)
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 365, in _resolve_one
2019-12-28T15:35:28,983     abstract_dist = self._get_abstract_dist_for(req_to_install)
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 313, in _get_abstract_dist_for
2019-12-28T15:35:28,983     req, self.session, self.finder, self.require_hashes
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 224, in prepare_linked_requirement
2019-12-28T15:35:28,983     req, self.req_tracker, finder, self.build_isolation,
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 49, in _get_prepared_distribution
2019-12-28T15:35:28,983     abstract_dist.prepare_distribution_metadata(finder, build_isolation)
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/distributions/source/legacy.py", line 39, in prepare_distribution_metadata
2019-12-28T15:35:28,983     self.req.prepare_metadata()
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 563, in prepare_metadata
2019-12-28T15:35:28,983     self.metadata_directory = metadata_generator(self)
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/operations/generate_metadata.py", line 124, in _generate_metadata_legacy
2019-12-28T15:35:28,983     command_desc='python setup.py egg_info',
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/utils/subprocess.py", line 242, in call_subprocess
2019-12-28T15:35:28,983     raise InstallationError(exc_msg)
2019-12-28T15:35:28,983 pip._internal.exceptions.InstallationError: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Fatal error libpq fe h no such file or directory
  • Fatal error libguile h no such file or directory
  • Fatal error libelf h no such file or directory
  • Fatal error lber h no such file or directory
  • Fatal error l1101 invalid object module

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии