nabla-c0d3 / nassl

Experimental OpenSSL wrapper for Python 3.8+ and SSLyze.
GNU Affero General Public License v3.0
39 stars 35 forks source link

Can't build C extension #37

Closed jsf9k closed 6 years ago

jsf9k commented 6 years ago

I'm running python 3.6.4 on Arch Linux, and I can't build the C extension:

 $ git clone git@github.com:nabla-c0d3/nassl.git
Cloning into 'nassl'...
remote: Counting objects: 2770, done.
remote: Compressing objects: 100% (107/107), done.
remote: Total 2770 (delta 39), reused 99 (delta 15), pack-reused 2643
Receiving objects: 100% (2770/2770), 2.31 MiB | 293.00 KiB/s, done.
Resolving deltas: 100% (1739/1739), done.
$ cd nassl/
$ pyenv version
3.6.4 (set by /home/jeremy_frasier/nassl/.python-version)
$ pip install -r requirements.txt
Ignoring typing: markers 'python_version < "3.5"' don't match your environment
Ignoring enum34: markers 'python_version < "3.4"' don't match your environment
$ python setup.py build_ext -i
running build_ext
building 'nassl._nassl_legacy' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/nassl
creating build/temp.linux-x86_64-3.6/nassl/_nassl
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DLEGACY_OPENSSL=1 -Ibin/openssl-legacy/include -Inassl/_nassl -I/home/jeremy_frasier/.pyenv/versions/3.6.4/include/python3.6m -c nassl/_nassl/nassl.c -o build/temp.linux-x86_64-3.6/nassl/_nassl/nassl.o -Wall
<snip>
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DLEGACY_OPENSSL=1 -Ibin/openssl-legacy/include -Inassl/_nassl -I/home/jeremy_frasier/.pyenv/versions/3.6.4/include/python3.6m -c nassl/_nassl/python_utils.c -o build/temp.linux-x86_64-3.6/nassl/_nassl/python_utils.o -Wall
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/nassl
gcc -pthread -shared -L/home/jeremy_frasier/.pyenv/versions/3.6.4/lib -L/home/jeremy_frasier/.pyenv/versions/3.6.4/lib build/temp.linux-x86_64-3.6/nassl/_nassl/nassl.o build/temp.linux-x86_64-3.6/nassl/_nassl/nassl_SSL_CTX.o build/temp.linux-x86_64-3.6/nassl/_nassl/nassl_SSL.o build/temp.linux-x86_64-3.6/nassl/_nassl/nassl_X509.o build/temp.linux-x86_64-3.6/nassl/_nassl/nassl_errors.o build/temp.linux-x86_64-3.6/nassl/_nassl/nassl_BIO.o build/temp.linux-x86_64-3.6/nassl/_nassl/nassl_X509_EXTENSION.o build/temp.linux-x86_64-3.6/nassl/_nassl/nassl_X509_NAME_ENTRY.o build/temp.linux-x86_64-3.6/nassl/_nassl/nassl_SSL_SESSION.o build/temp.linux-x86_64-3.6/nassl/_nassl/openssl_utils.o build/temp.linux-x86_64-3.6/nassl/_nassl/nassl_OCSP_RESPONSE.o build/temp.linux-x86_64-3.6/nassl/_nassl/python_utils.o bin/openssl-legacy/linux64/libssl.a bin/openssl-legacy/linux64/libcrypto.a bin/zlib/linux64/libz.a -o build/lib.linux-x86_64-3.6/nassl/_nassl_legacy.cpython-36m-x86_64-linux-gnu.so -Wl,-z,noexecstack
/bin/ld:bin/openssl-legacy/linux64/libssl.a: file format not recognized; treating as linker script
/bin/ld:bin/openssl-legacy/linux64/libssl.a:1: syntax error
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

I have this issue on Arch, Alpine, and even in a Ubuntu 16.04 Docker image. Could something be wrong with the version of bin/openssl-legacy/linux64/libssl.a in the repository? I also noticed this, which may indicate the problem:

$ file /usr/lib/libz.a
/usr/lib/libz.a: current ar archive
$ file bin/openssl-legacy/linux64/libssl.a 
bin/openssl-legacy/linux64/libssl.a: ASCII text
nabla-c0d3 commented 6 years ago

The ASCII text error makes me think that you need to install Git LFS

jsf9k commented 6 years ago

You're right, that was my issue. Thank you very much, @nabla-c0d3!