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

Build on debian 9 with OpenSSL 1.1.0f #24

Open
harajuko opened this issue Dec 11, 2017 · 4 comments
Open

Build on debian 9 with OpenSSL 1.1.0f #24

harajuko opened this issue Dec 11, 2017 · 4 comments

Comments

@harajuko
Copy link

Follow the error output , during compile with openssl-1.1.0f

user@hermes:/Projects/deb_dist/secp256k1-0.13.2$ dpkg-buildpackage
dpkg-buildpackage: info: source package secp256k1
dpkg-buildpackage: info: source version 0.13.2-1
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Ludvig Broberg [email protected]
dpkg-buildpackage: info: host architecture amd64
dpkg-source --before-build secp256k1-0.13.2
fakeroot debian/rules clean
dh clean --with python2,python3 --buildsystem=pybuild
dh_testdir -O--buildsystem=pybuild
dh_auto_clean -O--buildsystem=pybuild
I: pybuild base:184: python2.7 setup.py clean
0.29
Using bundled libsecp256k1
running clean
removing '/home/user/Projects/deb_dist/secp256k1-0.13.2/.pybuild/pythonX.Y_2.7/build' (and everything under it)
'build/bdist.linux-amd64' does not exist -- can't clean it
'build/scripts-2.7' does not exist -- can't clean it
I: pybuild base:184: python3.5 setup.py clean
0.29
Using bundled libsecp256k1
running clean
removing '/home/user/Projects/deb_dist/secp256k1-0.13.2/.pybuild/pythonX.Y_3.5/build' (and everything under it)
'build/bdist.linux-amd64' does not exist -- can't clean it
'build/scripts-3.5' does not exist -- can't clean it
dh_clean -O--buildsystem=pybuild
dpkg-source -b secp256k1-0.13.2
dpkg-source: info: using source format '3.0 (quilt)'
dpkg-source: info: building secp256k1 using existing ./secp256k1_0.13.2.orig.tar.gz
dpkg-source: info: building secp256k1 in secp256k1_0.13.2-1.debian.tar.xz
dpkg-source: info: building secp256k1 in secp256k1_0.13.2-1.dsc
debian/rules build
dh build --with python2,python3 --buildsystem=pybuild
dh_testdir -O--buildsystem=pybuild
dh_update_autotools_config -O--buildsystem=pybuild
dh_auto_configure -O--buildsystem=pybuild
I: pybuild base:184: python2.7 setup.py config
0.29
Using bundled libsecp256k1
running config
I: pybuild base:184: python3.5 setup.py config
0.29
Using bundled libsecp256k1
running config
dh_auto_build -O--buildsystem=pybuild
I: pybuild base:184: /usr/bin/python setup.py build
0.29
Using bundled libsecp256k1
running build
running build_py
creating /home/user/Projects/deb_dist/secp256k1-0.13.2/.pybuild/pythonX.Y_2.7/build/secp256k1
copying secp256k1/main.py -> /home/user/Projects/deb_dist/secp256k1-0.13.2/.pybuild/pythonX.Y_2.7/build/secp256k1
copying secp256k1/init.py -> /home/user/Projects/deb_dist/secp256k1-0.13.2/.pybuild/pythonX.Y_2.7/build/secp256k1
running build_clib
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'
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-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... /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... none
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /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-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-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... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt 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... yes
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 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... no
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) none
checking how to run the C preprocessor... gcc -E
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... none
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 native compiler: gcc... ok
checking for x86_64 assembly availability... yes
checking for CRYPTO... yes
checking for main in -lcrypto... yes
checking for EC functions in libcrypto... yes
checking for javac... /usr/bin/javac
checking symlink for /usr/bin/javac... /etc/alternatives/javac
checking symlink for /etc/alternatives/javac... /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
checking jni headers... /usr/lib/jvm/java-8-openjdk-amd64/include
configure: WARNING: jni headers/dependencies not found. jni support disabled
checking whether byte ordering is bigendian... no
configure: Using static precomputation: yes
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 ECDH module: no
configure: Building Schnorr signatures module: no
configure: Building ECDSA pubkey recovery module: yes
configure: Using jni: no
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
make[1]: Entering directory '/home/user/Projects/deb_dist/secp256k1-0.13.2/build/temp.linux-amd64-2.7'
CC src/libsecp256k1_la-secp256k1.lo
In file included from /home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/secp256k1.c:14:0:
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h: In function ‘secp256k1_ecmult_context_clone’:
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:186:9: warning: implicit declaration of function ‘memcpy’ [-Wimplicit-function-declaration]
memcpy(dst->pre_g, src->pre_g, size);
^~~~~~
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:186:9: warning: incompatible implicit declaration of built-in function ‘memcpy’
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:186:9: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h: In function ‘secp256k1_ecmult_wnaf’:
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:230:5: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
memset(wnaf, 0, len * sizeof(wnaf[0]));
^~~~~~
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:230:5: warning: incompatible implicit declaration of built-in function ‘memset’
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:230:5: note: include ‘<string.h>’ or provide a declaration of ‘memset’
CCLD libsecp256k1.la
/usr/bin/ar: u' modifier ignored since D' is the default (see `U')
CC src/tests-tests.o
In file included from /home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/secp256k1.c:14:0,
from /home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/tests.c:16:
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h: In function ‘secp256k1_ecmult_context_clone’:
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:186:9: warning: implicit declaration of function ‘memcpy’ [-Wimplicit-function-declaration]
memcpy(dst->pre_g, src->pre_g, size);
^~~~~~
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:186:9: warning: incompatible implicit declaration of built-in function ‘memcpy’
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:186:9: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h: In function ‘secp256k1_ecmult_wnaf’:
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:230:5: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
memset(wnaf, 0, len * sizeof(wnaf[0]));
^~~~~~
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:230:5: warning: incompatible implicit declaration of built-in function ‘memset’
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:230:5: note: include ‘<string.h>’ or provide a declaration of ‘memset’
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/tests.c: In function ‘test_ecdsa_der_parse’:
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/tests.c:3702:52: error: dereferencing pointer to incomplete type ‘ECDSA_SIG {aka struct ECDSA_SIG_st}’
valid_openssl = !BN_is_negative(sig_openssl->r) && !BN_is_negative(sig_openssl->s) && BN_num_bits(sig_openssl->r) > 0 && BN_num_bits(sig_openssl->r) <= 256 && BN_num_bits(sig_openssl->s) > 0 && BN_num_bits(sig_openssl->s) <= 256;
^~
Makefile:1049: recipe for target 'src/tests-tests.o' failed
make[1]: *** [src/tests-tests.o] Error 1
make[1]: Leaving directory '/home/user/Projects/deb_dist/secp256k1-0.13.2/build/temp.linux-amd64-2.7'
Traceback (most recent call last):
File "setup.py", line 295, in
"Topic :: Security :: Cryptography"
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
self.run_command(cmd_name)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setup.py", line 217, in run
subprocess.check_call(["make"], cwd=build_temp)
File "/usr/lib/python2.7/subprocess.py", line 186, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make']' returned non-zero exit status 2
E: pybuild pybuild:283: build: plugin distutils failed with: exit code=1: /usr/bin/python setup.py build
dh_auto_build: pybuild --build -i python{version} -p 2.7 returned exit code 13
debian/rules:7: recipe for target 'build' failed
make: *** [build] Error 25
dpkg-buildpackage: error: debian/rules build gave error exit status 2

@hackaugusto
Copy link

I have the same problem with gcc (GCC) 7.2.1 20171128.

The secp256k1 latest master is compiling, the hardcoded in the setup.py does not.

Master commit: c95f6f1360a87bba61622cbaa0eb714c241a5d90
Setup.py commit: c5b32e16c4d2560ce829caf88a413fc06fd83d09

@xjia1
Copy link

xjia1 commented May 24, 2018

Doesn't install out of the box on Ubuntu 18.04 LTS. Same error

    /tmp/pip-build-6zlpmcob/secp256k1/libsecp256k1/src/tests.c:3702:52: error: dereferencing pointer to incomplete type ‘ECDSA_SIG {aka struct ECDSA_SIG_st}’
             valid_openssl = !BN_is_negative(sig_openssl->r) && !BN_is_negative(sig_openssl->s) && BN_num_bits(sig_openssl->r) > 0 && BN_num_bits(sig_openssl->r) <= 256 && BN_num_bits(sig_openssl->s) > 0 && BN_num_bits(sig_openssl->s) <= 256;
                                                        ^~
    Makefile:1049: recipe for target 'src/tests-tests.o' failed

Update on 06/14/2018: See my comment below for a workaround.

@xjia1
Copy link

xjia1 commented Jun 15, 2018

Update:

After a closer look at this project's README file

Using a system installed libsecp256k1
If the library is already installed it should usually be automatically detected and used

So I tried

$ sudo apt install libsecp256k1-dev
$ sudo -H pip3 install secp256k1
Collecting secp256k1
...
Building wheels for collected packages: secp256k1
  Running setup.py bdist_wheel for secp256k1 ... done
  Stored in directory: /root/.cache/pip/wheels/5b/8a/64/eb837f345fec657b8cedc6e765971f9552b6f4aa641b06eb7a
Successfully built secp256k1
Installing collected packages: secp256k1
Successfully installed secp256k1-0.13.2

Apparently the compilation error has been fixed upstream in bitcoin-core/secp256k1@d333521

@hackaugusto The upstream fix was merged in Feb, which explains why you encountered the error.

@auuunya
Copy link

auuunya commented Sep 21, 2020

Update:

After a closer look at this project's README file

Using a system installed libsecp256k1
If the library is already installed it should usually be automatically detected and used

So I tried

$ sudo apt install libsecp256k1-dev
$ sudo -H pip3 install secp256k1
Collecting secp256k1
...
Building wheels for collected packages: secp256k1
  Running setup.py bdist_wheel for secp256k1 ... done
  Stored in directory: /root/.cache/pip/wheels/5b/8a/64/eb837f345fec657b8cedc6e765971f9552b6f4aa641b06eb7a
Successfully built secp256k1
Installing collected packages: secp256k1
Successfully installed secp256k1-0.13.2

Apparently the compilation error has been fixed upstream in bitcoin-core/secp256k1@d333521

@hackaugusto The upstream fix was merged in Feb, which explains why you encountered the error.

3q

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

4 participants