Legrandin / pycryptodome

A self-contained cryptographic library for Python
https://www.pycryptodome.org
Other
2.84k stars 503 forks source link

Import fails on Solaris 11.3 SPARC #26

Closed mavit closed 8 years ago

mavit commented 8 years ago

The installation seems to go okay:

> sudo pip install pycryptodome
You are using pip version 6.0.8, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pycryptodome
  Downloading pycryptodome-3.4.tar.gz (6.5MB)
    100% |################################| 6.5MB 23kB/s 
Installing collected packages: pycryptodome
  Running setup.py install for pycryptodome
    warning: no support for Intel AESNI instructions
    building 'Crypto.Hash._MD2' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/MD2.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/MD2.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Hash/_MD2.so
    building 'Crypto.Hash._MD4' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/MD4.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/MD4.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/MD4.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Hash/_MD4.so
    building 'Crypto.Hash._SHA256' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/SHA256.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/SHA256.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/SHA256.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Hash/_SHA256.so
    building 'Crypto.Hash._SHA224' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/SHA224.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/SHA224.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/SHA224.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Hash/_SHA224.so
    building 'Crypto.Hash._SHA384' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/SHA384.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/SHA384.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/SHA384.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Hash/_SHA384.so
    building 'Crypto.Hash._SHA512' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/SHA512.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/SHA512.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/SHA512.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Hash/_SHA512.so
    building 'Crypto.Hash._RIPEMD160' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/RIPEMD160.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/RIPEMD160.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/RIPEMD160.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Hash/_RIPEMD160.so
    building 'Crypto.Hash._keccak' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/keccak.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/keccak.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/keccak.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Hash/_keccak.so
    building 'Crypto.Hash._BLAKE2b' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/blake2b.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/blake2b.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/blake2b.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Hash/_BLAKE2b.so
    building 'Crypto.Hash._BLAKE2s' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/blake2s.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/blake2s.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/blake2s.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Hash/_BLAKE2s.so
    building 'Crypto.Cipher._raw_aes' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/AES.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/AES.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/AES.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Cipher/_raw_aes.so
    building 'Crypto.Cipher._raw_arc2' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/ARC2.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/ARC2.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/ARC2.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Cipher/_raw_arc2.so
    building 'Crypto.Cipher._raw_blowfish' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/Blowfish.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/Blowfish.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/Blowfish.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Cipher/_raw_blowfish.so
    building 'Crypto.Cipher._raw_cast' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/CAST.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/CAST.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/CAST.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Cipher/_raw_cast.so
    building 'Crypto.Cipher._raw_des' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -Isrc/libtom/ -I/usr/include/python2.7 -c src/DES.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/DES.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/DES.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Cipher/_raw_des.so
    building 'Crypto.Cipher._raw_des3' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -Isrc/libtom/ -I/usr/include/python2.7 -c src/DES3.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/DES3.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/DES3.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Cipher/_raw_des3.so
    building 'Crypto.Util._galois' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/galois.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/galois.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/galois.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Util/_galois.so
    building 'Crypto.Util._cpuid' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/cpuid.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/cpuid.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/cpuid.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Util/_cpuid.so
    building 'Crypto.Cipher._raw_ecb' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/raw_ecb.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/raw_ecb.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/raw_ecb.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Cipher/_raw_ecb.so
    building 'Crypto.Cipher._raw_cbc' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/raw_cbc.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/raw_cbc.o
    "src/raw_cbc.c", line 42: warning: zero or negative subscript
    "src/raw_cbc.c", line 81: warning: implicit function declaration: alloca
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/raw_cbc.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Cipher/_raw_cbc.so
    building 'Crypto.Cipher._raw_cfb' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/raw_cfb.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/raw_cfb.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/raw_cfb.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Cipher/_raw_cfb.so
    building 'Crypto.Cipher._raw_ofb' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/raw_ofb.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/raw_ofb.o
    "src/raw_ofb.c", line 48: warning: zero or negative subscript
    "src/raw_ofb.c", line 93: warning: implicit function declaration: alloca
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/raw_ofb.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Cipher/_raw_ofb.so
    building 'Crypto.Cipher._raw_ctr' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/raw_ctr.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/raw_ctr.o
    "src/raw_ctr.c", line 62: warning: zero or negative subscript
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/raw_ctr.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Cipher/_raw_ctr.so
    building 'Crypto.Cipher._raw_ocb' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/raw_ocb.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/raw_ocb.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/raw_ocb.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Cipher/_raw_ocb.so
    building 'Crypto.Cipher._ARC4' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/ARC4.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/ARC4.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/ARC4.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Cipher/_ARC4.so
    building 'Crypto.Cipher._Salsa20' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -Isrc/libtom/ -I/usr/include/python2.7 -c src/Salsa20.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/Salsa20.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/Salsa20.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Cipher/_Salsa20.so
    building 'Crypto.Cipher._chacha20' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/chacha20.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/chacha20.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/chacha20.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Cipher/_chacha20.so
    building 'Crypto.Util._strxor' extension
    cc -DNDEBUG -KPIC -DPIC -DLTC_NO_ASM -Isrc/ -I/usr/include/python2.7 -c src/strxor.c -o build/temp.solaris-2.11-sun4v.32bit-2.7/src/strxor.o
    cc -G build/temp.solaris-2.11-sun4v.32bit-2.7/src/strxor.o -L/usr/lib -lpython2.7 -o build/lib.solaris-2.11-sun4v.32bit-2.7/Crypto/Util/_strxor.so
Successfully installed pycryptodome-3.4

But:

> python
Python 2.7.9 (default, Aug 19 2015, 20:12:04) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from Crypto.Cipher import AES as AES
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/Crypto/Cipher/__init__.py", line 79, in <module>
    from Crypto.Cipher._mode_cbc import _create_cbc_cipher
  File "/usr/lib/python2.7/site-packages/Crypto/Cipher/_mode_cbc.py", line 57, in <module>
    """
  File "/usr/lib/python2.7/site-packages/Crypto/Util/_raw_api.py", line 168, in load_pycryptodome_raw_lib
    raise OSError("Cannot load native module '%s'" % name)
OSError: Cannot load native module 'Crypto.Cipher._raw_cbc'

After commenting out the try/except in load_pycryptodome_raw_lib:

> python
Python 2.7.9 (default, Aug 19 2015, 20:12:04) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from Crypto.Cipher import AES
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/Crypto/Cipher/__init__.py", line 79, in <module>
    from Crypto.Cipher._mode_cbc import _create_cbc_cipher
  File "/usr/lib/python2.7/site-packages/Crypto/Cipher/_mode_cbc.py", line 57, in <module>
    """
  File "/usr/lib/python2.7/site-packages/Crypto/Util/_raw_api.py", line 165, in load_pycryptodome_raw_lib
    return load_lib(pycryptodome_filename(dir_comps, basename + ext), cdecl)
  File "/usr/lib/python2.7/site-packages/Crypto/Util/_raw_api.py", line 51, in load_lib
    lib = ffi.dlopen(name)
  File "/usr/lib/python2.7/vendor-packages/cffi/api.py", line 119, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File "/usr/lib/python2.7/vendor-packages/cffi/api.py", line 412, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
  File "/usr/lib/python2.7/vendor-packages/cffi/api.py", line 401, in _load_backend_lib
    return backend.load_library(name, flags)
OSError: cannot load library /usr/lib/python2.7/site-packages/Crypto/Util/../Cipher/_raw_cbc.so: ld.so.1: isapython2.7: fatal: relocation error: file /usr/lib/python2.7/site-packages/Crypto/Util/../Cipher/_raw_cbc.so: symbol alloca: referenced symbol not found
Legrandin commented 8 years ago

Could you please try again using branch alloca?

mavit commented 8 years ago

That does the trick. Thanks!

Legrandin commented 8 years ago

Thanks for checking this so quickly. I moved this fix to master.