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

Cannot pip install fastecdsa on Ubuntu 16.10 #7

Closed
exarkun opened this issue Apr 13, 2017 · 4 comments
Closed

Cannot pip install fastecdsa on Ubuntu 16.10 #7

exarkun opened this issue Apr 13, 2017 · 4 comments

Comments

@exarkun
Copy link

exarkun commented Apr 13, 2017

$ 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
Copy link
Owner

Tried to replicate the issue:

  • Spun up a Ubuntu 16.10 VM (64bit Server edition)
  • $ apt install gcc python-dev libgmp3-dev
  • $ python --version --> Python 2.7.12+
  • $ gcc -v --> gcc version 6.2.0
  • $ apt install python-pip
  • $ pip --version --> pip 8.1.2
  • $ pip install fastedcdsa --> builds with no errors

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
Copy link
Author

exarkun commented Apr 14, 2017

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
Copy link
Owner

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
Copy link
Author

exarkun commented Apr 14, 2017

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

@exarkun exarkun closed this as completed Apr 14, 2017
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

2 participants