AntonKueltz / fastecdsa

Python library for fast elliptic curve crypto
https://pypi.python.org/pypi/fastecdsa
The Unlicense
264 stars 77 forks source link

Cannot `pip install fastecdsa` on Ubuntu 16.10 #7

Closed exarkun closed 7 years ago

exarkun commented 7 years ago
$ pip install fastecdsa
Collecting fastecdsa
  Using cached fastecdsa-1.4.2.tar.gz
Building wheels for collected packages: fastecdsa
  Running setup.py bdist_wheel for fastecdsa ... error
  Complete output from command /home/exarkun/Environments/blockstack/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-s9DeNL/fastecdsa/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmptYsju2pip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/fastecdsa
  copying fastecdsa/__init__.py -> build/lib.linux-x86_64-2.7/fastecdsa
  copying fastecdsa/test.py -> build/lib.linux-x86_64-2.7/fastecdsa
  copying fastecdsa/keys.py -> build/lib.linux-x86_64-2.7/fastecdsa
  copying fastecdsa/curve.py -> build/lib.linux-x86_64-2.7/fastecdsa
  copying fastecdsa/ecdsa.py -> build/lib.linux-x86_64-2.7/fastecdsa
  copying fastecdsa/util.py -> build/lib.linux-x86_64-2.7/fastecdsa
  copying fastecdsa/point.py -> build/lib.linux-x86_64-2.7/fastecdsa
  warning: build_py: byte-compiling is disabled, skipping.

  running build_ext
  building 'fastecdsa.curvemath' extension
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/src
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-lMBuS3/python2.7-2.7.12=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Isrc/ -I/usr/include/python2.7 -c src/curveMath.c -o build/temp.linux-x86_64-2.7/src/curveMath.o -O2
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-lMBuS3/python2.7-2.7.12=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Isrc/ -I/usr/include/python2.7 -c src/curve.c -o build/temp.linux-x86_64-2.7/src/curve.o -O2
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-lMBuS3/python2.7-2.7.12=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Isrc/ -I/usr/include/python2.7 -c src/point.c -o build/temp.linux-x86_64-2.7/src/point.o -O2
  x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-lMBuS3/python2.7-2.7.12=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate
-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-lMBuS3/python2.7-2.7.12=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/curveMath.o build/temp.linux-x86_64-2.7/src/curve.o build/temp.linux-x86_64-2.7/src/point.o -lgmp -o build/lib.linux-x86_64-2.7/fastecdsa/curvemath.so
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(lt20-get_str.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(realloc.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(lt43-set_str.o): relocation R_X86_64_32 against symbol `__gmp_digit_value_tab' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(sizeinbase.o): relocation R_X86_64_32S against symbol `__gmpn_bases' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(lt88-get_str.o): relocation R_X86_64_32S against symbol `__gmpn_bases' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(lt89-set_str.o): relocation R_X86_64_32S against symbol `__gmpn_bases' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(lt99-tdiv_qr.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(mu_div_qr.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(assert.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(memory.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(mul_fft.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(lt98-gcdext.o): relocation R_X86_64_32 against symbol `__gmpn_gcdext_hook' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(gcd_subdiv_step.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(gcdext_lehmer.o): relocation R_X86_64_32 against symbol `__gmpn_gcdext_hook' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(sbpi1_divappr_q.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(hgcd_step.o): relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(bdiv_q.o): relocation R_X86_64_32S against symbol `__gmp_binvert_limb_table' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(binvert.o): relocation R_X86_64_32S against symbol `__gmp_binvert_limb_table' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgmp.a(lt5-clears.o): relocation R_X86_64_PC32 against symbol `__gmp_free_func' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: final link failed: Bad value
  collect2: error: ld returned 1 exit status
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for fastecdsa
AntonKueltz commented 7 years ago

Tried to replicate the issue:

I'd check to make sure you didn't custom install GMP in some non-standard way. Maybe also try updating GCC, I've seen some issues with specific GCC versions spitting out the bug you have above.

exarkun commented 7 years ago

Hmmm, weird. I have libgmp10 and libgmpv4-dev and I can't convince apt to install libgmp3-dev. I suppose that could be the problem but I'm really confused about what's going on and why libgmp3-dev appears to be unavailable.

$ sudo apt-get install libgmp3-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libgmp3-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libgmp3-dev' has no installation candidate

So I suppose this is a problem with my Ubuntu install and not a problem with fastecdsa itself.

AntonKueltz commented 7 years ago

You might need to $ apt remove libgmpv4-dev before installing libgmp3-dev but I was also able to build this package against the libgmpv4-dev package.

exarkun commented 7 years ago

I finally managed to get libgmp3-dev installed and the build succeeded. Thanks.