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

libsecp256k1 dependency #31

Closed
PabloCastellano opened this issue May 25, 2014 · 11 comments
Closed

libsecp256k1 dependency #31

PabloCastellano opened this issue May 25, 2014 · 11 comments

Comments

@PabloCastellano
Copy link
Member

Long time since pulling and I have just found that I don't have this dependency (libsecp256k1) and have no idea about how to install it or where to get it.

Please document it :)

CXX utility/ec_keys.lo
utility/ec_keys.cpp:20:23: fatal error: secp256k1.h: No such file or directory
#include <secp256k1.h>
^
compilation terminated.

@genjix
Copy link
Contributor

genjix commented May 26, 2014

done

@genjix genjix closed this as completed May 26, 2014
@kevinejohn
Copy link

Where is this documented? I made this:

secp256k1 Instructions

$ git clone https://github.com/bitcoin/secp256k1
$ cd secp256k1
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

@PabloCastellano
Copy link
Member Author

@kevinejohn It's in the README file (develop branch only)

kazcw pushed a commit to kazcw/libbitcoin that referenced this issue Aug 9, 2014
@erm3nda
Copy link

erm3nda commented Apr 11, 2016

I've installed that as suggested, and now img getting:
error: ‘secp256k1_context_t’ does not name a type.

Suggestion?

@evoskuil
Copy link
Member

Detailed installation instructions are provided here:
https://github.com/libbitcoin/libbitcoin/blob/version2/install.sh

See specifically:
https://github.com/libbitcoin/libbitcoin/blob/version2/install.sh#L570

The secp256k1 library is currently a moving target, the interface changes without version changes. This is why we maintain and build from a fork.

@thracia91
Copy link

I am trying to build libbitcoin on Fedora 25 (I downloaded the install script from the "version2" fork) and receive this error:

checking for secp256k1... no
configure: error: Package requirements (libsecp256k1 >= 0.0.1) were not met:
No package 'libsecp256k1' found

These OpenSSL packages are installed:

openssl.x86_64 1:1.0.2j-3.fc25 @updates
openssl-devel.x86_64 1:1.0.2j-3.fc25 @updates
openssl-libs.i686 1:1.0.2j-3.fc25 @updates
openssl-libs.x86_64 1:1.0.2j-3.fc25 @updates

and this is the output from "openssl ecparam -list_curves":

secp256k1 : SECG curve over a 256 bit prime field
secp384r1 : NIST/SECG curve over a 384 bit prime field
secp521r1 : NIST/SECG curve over a 521 bit prime field
prime256v1: X9.62/SECG curve over a 256 bit prime field

In other words, secp256k1 is indeed installed and available on the system but the build script can't seem to find the library. Anyone have any idea how to solve this?

@narodnik
Copy link
Contributor

Does pkg-config --cflags --libs libsecp256k1 show anything?

@evoskuil
Copy link
Member

Libbitcoin does not use OpenSSL.

The install script (install.sh) always downloads and builds libsecp256k1 so it is hard to see how this could happen without preceding failures.

@thracia91
Copy link

thracia91 commented Jan 21, 2017

This is the output from pkg-config --cflags --libs libsecp256k1 :

Package libsecp256k1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsecp256k1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libsecp256k1' found

I also tried this, but not sure what to make of it:

[root@T430 eric]# whereis libsecp256k1.pc
libsecp256k1: /usr/local/lib/libsecp256k1.a /usr/local/lib/libsecp256k1.la /usr/local/lib/libsecp256k1.so

There are no messages ahead of "checking for secp..." that indicate any sort of failure or warning. I have pasted the entire script output below for reference:


Make jobs: 4
Make for system: Linux
Make with cc: 
Make with cxx: 
Make with stdlib: libstdc++
Build directory: build-libbitcoin
Prefix directory: 
  prefix: 
  with_boost: 
  with_pkgconfigdir: 
Initialized empty Git repository in /home/eric/build-libbitcoin/.git/

********************** ICU build not enabled **********************


********************** Boost build not enabled **********************


********************** Download libbitcoin/secp256k1/version4 **********************

Cloning into 'secp256k1'...
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'build-aux/m4'.
libtoolize: copying file 'build-aux/m4/libtool.m4'
libtoolize: copying file 'build-aux/m4/ltoptions.m4'
libtoolize: copying file 'build-aux/m4/ltsugar.m4'
libtoolize: copying file 'build-aux/m4/ltversion.m4'
libtoolize: copying file 'build-aux/m4/lt~obsolete.m4'
configure.ac:10: installing 'build-aux/compile'
configure.ac:5: installing 'build-aux/config.guess'
configure.ac:5: installing 'build-aux/config.sub'
configure.ac:9: installing 'build-aux/install-sh'
configure.ac:9: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
configure: --disable-tests --enable-module-recovery
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to print strings... printf
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether make supports nested variables... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for ar... /usr/bin/ar
checking for ranlib... /usr/bin/ranlib
checking for strip... /usr/bin/strip
checking for gcc... gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking how to run the C preprocessor... gcc -E
checking for gcc option to accept ISO C89... (cached) none needed
checking if gcc supports -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings... yes
checking if gcc supports -fvisibility=hidden... yes
checking for __int128... yes
checking for __builtin_expect... yes
checking for x86_64 assembly availability... yes
checking gmp.h usability... no
checking gmp.h presence... no
checking for gmp.h... no
checking whether byte ordering is bigendian... no
configure: Using assembly optimizations: x86_64
configure: Using field implementation: 64bit
configure: Using bignum implementation: no
configure: Using scalar implementation: 64bit
configure: Using endomorphism optimizations: no
configure: Building ECDSA pubkey recovery module: yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libsecp256k1.pc
config.status: creating src/libsecp256k1-config.h
config.status: executing depfiles commands
config.status: executing libtool commands
gcc -I. -g -O2 -Wall -Wextra -Wno-unused-function -c src/gen_context.c -o gen_context.o
gcc gen_context.o -o gen_context
./gen_context
  CC       src/libsecp256k1_la-secp256k1.lo
  CCLD     libsecp256k1.la
make[1]: Entering directory '/home/eric/build-libbitcoin/secp256k1'
 /usr/bin/mkdir -p '/usr/local/lib'
 /bin/sh ./libtool   --mode=install /usr/bin/install -c   libsecp256k1.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libsecp256k1.so.0.0.0 /usr/local/lib/libsecp256k1.so.0.0.0
libtool: install: (cd /usr/local/lib && { ln -s -f libsecp256k1.so.0.0.0 libsecp256k1.so.0 || { rm -f libsecp256k1.so.0 && ln -s libsecp256k1.so.0.0.0 libsecp256k1.so.0; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libsecp256k1.so.0.0.0 libsecp256k1.so || { rm -f libsecp256k1.so && ln -s libsecp256k1.so.0.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: /usr/bin/ranlib /usr/local/lib/libsecp256k1.a
libtool: finish: PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/eric/.local/bin:/home/eric/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_recovery.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[1]: Leaving directory '/home/eric/build-libbitcoin/secp256k1'

********************** Download libbitcoin/libbitcoin/version2 **********************

Cloning into 'libbitcoin'...
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
configure.ac:34: installing 'build-aux/ar-lib'
configure.ac:34: installing 'build-aux/compile'
configure.ac:37: installing 'build-aux/config.guess'
configure.ac:37: installing 'build-aux/config.sub'
configure.ac:28: installing 'build-aux/install-sh'
configure.ac:28: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
configure: 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking dependency style of g++... (cached) gcc3
checking whether make supports nested variables... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking whether g++ supports C++11 features by default... yes
checking --with-pkgconfigdir option... ${exec_prefix}/lib/pkgconfig
checking --with-tests option... yes
checking --with-examples option... yes
checking --with-icu option... no
checking --enable-ndebug option... yes
checking --enable-testnet option... no
checking for boostlib >= 1.55.0... yes
configure: boost_CPPFLAGS : -I/usr/include
configure: boost_LDFLAGS : -L/usr/lib64
checking whether the Boost::Chrono library is available... yes
checking for exit in -lboost_chrono... yes
configure: boost_chrono_LIBS : -lboost_chrono
checking whether the Boost::Date_Time library is available... yes
checking for exit in -lboost_date_time... yes
configure: boost_date_time_LIBS : -lboost_date_time
checking whether the Boost::Filesystem library is available... yes
checking for exit in -lboost_filesystem... yes
configure: boost_filesystem_LIBS : -lboost_filesystem
checking whether the Boost::Locale library is available... yes
checking for exit in -lboost_locale... yes
configure: boost_locale_LIBS : -lboost_locale
checking whether the Boost::Program_Options library is available... yes
checking for exit in -lboost_program_options... yes
configure: boost_program_options_LIBS : -lboost_program_options
checking whether the Boost::Regex library is available... yes
checking for exit in -lboost_regex... yes
configure: boost_regex_LIBS : -lboost_regex
checking whether the Boost::System library is available... yes
checking for exit in -lboost_system... yes
configure: boost_system_LIBS : -lboost_system
checking whether the Boost::Thread library is available... yes
checking for exit in -lboost_thread... yes
configure: boost_thread_LIBS : -lboost_thread
checking whether the Boost::Unit_Test_Framework library is available... yes
configure: boost_unit_test_framework_LIBS : -lboost_unit_test_framework
checking if compiler needs -Werror to reject unknown flags... no
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
configure: pthread_CPPFLAGS : 
configure: pthread_LIBS : 
checking for clock_gettime in -lrt... yes
configure: rt_LIBS : -lrt
checking for dlopen in -ldl... yes
configure: dl_LIBS : -ldl
checking for secp256k1... no
configure: error: Package requirements (libsecp256k1 >= 0.0.1) were not met:

No package 'libsecp256k1' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables secp256k1_CFLAGS
and secp256k1_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

@evoskuil
Copy link
Member

This indicates that the correct library was built and installed into /usr/local/lib/ by the installer:

make[1]: Entering directory '/home/eric/build-libbitcoin/secp256k1'
 /usr/bin/mkdir -p '/usr/local/lib'
 /bin/sh ./libtool   --mode=install /usr/bin/install -c   libsecp256k1.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libsecp256k1.so.0.0.0 /usr/local/lib/libsecp256k1.so.0.0.0
libtool: install: (cd /usr/local/lib && { ln -s -f libsecp256k1.so.0.0.0 libsecp256k1.so.0 || { rm -f libsecp256k1.so.0 && ln -s libsecp256k1.so.0.0.0 libsecp256k1.so.0; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libsecp256k1.so.0.0.0 libsecp256k1.so || { rm -f libsecp256k1.so && ln -s libsecp256k1.so.0.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: /usr/bin/ranlib /usr/local/lib/libsecp256k1.a

This indicates that headers were published and it was registered with package config in the same directory:

 /usr/bin/mkdir -p '/usr/local/include'
 /usr/bin/install -c -m 644 include/secp256k1.h include/secp256k1_recovery.h '/usr/local/include'
 /usr/bin/mkdir -p '/usr/local/lib/pkgconfig'
 /usr/bin/install -c -m 644 libsecp256k1.pc '/usr/local/lib/pkgconfig'

This indicates that the system package config path is not set to include /usr/local/lib/:

Perhaps you should add the directory containing `libsecp256k1.pc'
to the PKG_CONFIG_PATH environment variable

That is not typical. You can either follow the advice in the message above or use the --prefix installer option.

@thracia91
Copy link

thracia91 commented Jan 22, 2017

Thanks! Build was successful using --prefix=/usr/local/lib/.

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

7 participants