MagicStack/httptools

gcc (4.9 & 8.3) pip build issues

Closed this issue · 1 comments

pip install httptools with gcc-8.3 fails, with an error about unrecognized file formats when linking (see below). This is fair enough, maybe this recent version is unsupported.

Collecting httptools
  Downloading https://files.pythonhosted.org/packages/1b/03/215969db11abe8741e9c266a4cbe803a372bd86dd35fa0084c4df6d4bd00/httptools-0.0.13.tar.gz (104kB)
     |████████████████████████████████| 112kB 7.4MB/s 
Building wheels for collected packages: httptools
  Building wheel for httptools (setup.py) ... error
  ERROR: Complete output from command /home/matthew/.local/conda/envs/optimade/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-xrfgwi79/httptools/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/pip-wheel-8yjnvozz --python-tag cp36:
  ERROR: running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/httptools
  copying httptools/__init__.py -> build/lib.linux-x86_64-3.6/httptools
  creating build/lib.linux-x86_64-3.6/httptools/parser
  copying httptools/parser/errors.py -> build/lib.linux-x86_64-3.6/httptools/parser
  copying httptools/parser/__init__.py -> build/lib.linux-x86_64-3.6/httptools/parser
  running egg_info
  writing httptools.egg-info/PKG-INFO
  writing dependency_links to httptools.egg-info/dependency_links.txt
  writing top-level names to httptools.egg-info/top_level.txt
  reading manifest file 'httptools.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  writing manifest file 'httptools.egg-info/SOURCES.txt'
  copying httptools/parser/parser.c -> build/lib.linux-x86_64-3.6/httptools/parser
  running build_ext
  building 'httptools.parser.parser' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/httptools
  creating build/temp.linux-x86_64-3.6/httptools/parser
  creating build/temp.linux-x86_64-3.6/vendor
  creating build/temp.linux-x86_64-3.6/vendor/http-parser
  gcc -pthread -B /home/matthew/.local/conda/envs/optimade/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/matthew/.local/conda/envs/optimade/include/python3.6m -c httptools/parser/parser.c -o build/temp.linux-x86_64-3.6/httptools/parser/parser.o -O2
  gcc -pthread -B /home/matthew/.local/conda/envs/optimade/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/matthew/.local/conda/envs/optimade/include/python3.6m -c vendor/http-parser/http_parser.c -o build/temp.linux-x86_64-3.6/vendor/http-parser/http_parser.o -O2
  gcc -pthread -shared -B /home/matthew/.local/conda/envs/optimade/compiler_compat -L/home/matthew/.local/conda/envs/optimade/lib -Wl,-rpath=/home/matthew/.local/conda/envs/optimade/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/httptools/parser/parser.o build/temp.linux-x86_64-3.6/vendor/http-parser/http_parser.o -o build/lib.linux-x86_64-3.6/httptools/parser/parser.cpython-36m-x86_64-linux-gnu.so
  /home/matthew/.local/conda/envs/optimade/compiler_compat/ld: build/temp.linux-x86_64-3.6/httptools/parser/parser.o: unable to initialize decompress status for section .debug_info
  /home/matthew/.local/conda/envs/optimade/compiler_compat/ld: build/temp.linux-x86_64-3.6/httptools/parser/parser.o: unable to initialize decompress status for section .debug_info
  /home/matthew/.local/conda/envs/optimade/compiler_compat/ld: build/temp.linux-x86_64-3.6/httptools/parser/parser.o: unable to initialize decompress status for section .debug_info
  /home/matthew/.local/conda/envs/optimade/compiler_compat/ld: build/temp.linux-x86_64-3.6/httptools/parser/parser.o: unable to initialize decompress status for section .debug_info
  build/temp.linux-x86_64-3.6/httptools/parser/parser.o: file not recognized: file format not recognized
  collect2: error: ld returned 1 exit status
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for httptools
  Running setup.py clean for httptools
Failed to build httptools
Installing collected packages: httptools
  Running setup.py install for httptools ... error
    ERROR: Complete output from command /home/matthew/.local/conda/envs/optimade/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-xrfgwi79/httptools/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-_hgd3hzc/install-record.txt --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/httptools
    copying httptools/__init__.py -> build/lib.linux-x86_64-3.6/httptools
    creating build/lib.linux-x86_64-3.6/httptools/parser
    copying httptools/parser/errors.py -> build/lib.linux-x86_64-3.6/httptools/parser
    copying httptools/parser/__init__.py -> build/lib.linux-x86_64-3.6/httptools/parser
    running egg_info
    writing httptools.egg-info/PKG-INFO
    writing dependency_links to httptools.egg-info/dependency_links.txt
    writing top-level names to httptools.egg-info/top_level.txt
    reading manifest file 'httptools.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'httptools.egg-info/SOURCES.txt'
    copying httptools/parser/parser.c -> build/lib.linux-x86_64-3.6/httptools/parser
    running build_ext
    building 'httptools.parser.parser' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/httptools
    creating build/temp.linux-x86_64-3.6/httptools/parser
    creating build/temp.linux-x86_64-3.6/vendor
    creating build/temp.linux-x86_64-3.6/vendor/http-parser
    gcc -pthread -B /home/matthew/.local/conda/envs/optimade/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/matthew/.local/conda/envs/optimade/include/python3.6m -c httptools/parser/parser.c -o build/temp.linux-x86_64-3.6/httptools/parser/parser.o -O2
    gcc -pthread -B /home/matthew/.local/conda/envs/optimade/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/matthew/.local/conda/envs/optimade/include/python3.6m -c vendor/http-parser/http_parser.c -o build/temp.linux-x86_64-3.6/vendor/http-parser/http_parser.o -O2
    gcc -pthread -shared -B /home/matthew/.local/conda/envs/optimade/compiler_compat -L/home/matthew/.local/conda/envs/optimade/lib -Wl,-rpath=/home/matthew/.local/conda/envs/optimade/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/httptools/parser/parser.o build/temp.linux-x86_64-3.6/vendor/http-parser/http_parser.o -o build/lib.linux-x86_64-3.6/httptools/parser/parser.cpython-36m-x86_64-linux-gnu.so
    /home/matthew/.local/conda/envs/optimade/compiler_compat/ld: build/temp.linux-x86_64-3.6/httptools/parser/parser.o: unable to initialize decompress status for section .debug_info
    /home/matthew/.local/conda/envs/optimade/compiler_compat/ld: build/temp.linux-x86_64-3.6/httptools/parser/parser.o: unable to initialize decompress status for section .debug_info
    /home/matthew/.local/conda/envs/optimade/compiler_compat/ld: build/temp.linux-x86_64-3.6/httptools/parser/parser.o: unable to initialize decompress status for section .debug_info
    /home/matthew/.local/conda/envs/optimade/compiler_compat/ld: build/temp.linux-x86_64-3.6/httptools/parser/parser.o: unable to initialize decompress status for section .debug_info
    build/temp.linux-x86_64-3.6/httptools/parser/parser.o: file not recognized: file format not recognized
    collect2: error: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command "/home/matthew/.local/conda/envs/optimade/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-xrfgwi79/httptools/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-_hgd3hzc/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-xrfgwi79/httptools/

I tried again with gcc-4.9 (CC=gcc-4.9 CXX=gcc-4.9), and I receive a different error about a missing library (libmpfr.so.4; I have libmpfr.so.6). Symlinking libmpfr.so.6 to libmpfr.so.4 gets me back to the same error as gcc-8.3:

$ CC=gcc-4.9 CXX=gcc-4.9 pip --no-cache-dir install httptools
Collecting httptools
  Downloading https://files.pythonhosted.org/packages/1b/03/215969db11abe8741e9c266a4cbe803a372bd86dd35fa0084c4df6d4bd00/httptools-0.0.13.tar.gz (104kB)
     |████████████████████████████████| 112kB 7.5MB/s 
Building wheels for collected packages: httptools
  Building wheel for httptools (setup.py) ... error
  ERROR: Complete output from command /home/matthew/.local/conda/envs/optimade/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-bso7iy81/httptools/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/pip-wheel-pvaohfeg --python-tag cp36:
  ERROR: running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/httptools
  copying httptools/__init__.py -> build/lib.linux-x86_64-3.6/httptools
  creating build/lib.linux-x86_64-3.6/httptools/parser
  copying httptools/parser/errors.py -> build/lib.linux-x86_64-3.6/httptools/parser
  copying httptools/parser/__init__.py -> build/lib.linux-x86_64-3.6/httptools/parser
  running egg_info
  writing httptools.egg-info/PKG-INFO
  writing dependency_links to httptools.egg-info/dependency_links.txt
  writing top-level names to httptools.egg-info/top_level.txt
  reading manifest file 'httptools.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  writing manifest file 'httptools.egg-info/SOURCES.txt'
  copying httptools/parser/parser.c -> build/lib.linux-x86_64-3.6/httptools/parser
  running build_ext
  building 'httptools.parser.parser' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/httptools
  creating build/temp.linux-x86_64-3.6/httptools/parser
  creating build/temp.linux-x86_64-3.6/vendor
  creating build/temp.linux-x86_64-3.6/vendor/http-parser
  gcc-4.9 -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/matthew/.local/conda/envs/optimade/include/python3.6m -c httptools/parser/parser.c -o build/temp.linux-x86_64-3.6/httptools/parser/parser.o -O2
  /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory
  error: command 'gcc-4.9' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for httptools
  Running setup.py clean for httptools
Failed to build httptools
Installing collected packages: httptools
  Running setup.py install for httptools ... error
    ERROR: Complete output from command /home/matthew/.local/conda/envs/optimade/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-bso7iy81/httptools/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-t5796_ix/install-record.txt --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/httptools
    copying httptools/__init__.py -> build/lib.linux-x86_64-3.6/httptools
    creating build/lib.linux-x86_64-3.6/httptools/parser
    copying httptools/parser/errors.py -> build/lib.linux-x86_64-3.6/httptools/parser
    copying httptools/parser/__init__.py -> build/lib.linux-x86_64-3.6/httptools/parser
    running egg_info
    writing httptools.egg-info/PKG-INFO
    writing dependency_links to httptools.egg-info/dependency_links.txt
    writing top-level names to httptools.egg-info/top_level.txt
    reading manifest file 'httptools.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'httptools.egg-info/SOURCES.txt'
    copying httptools/parser/parser.c -> build/lib.linux-x86_64-3.6/httptools/parser
    running build_ext
    building 'httptools.parser.parser' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/httptools
    creating build/temp.linux-x86_64-3.6/httptools/parser
    creating build/temp.linux-x86_64-3.6/vendor
    creating build/temp.linux-x86_64-3.6/vendor/http-parser
    gcc-4.9 -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/matthew/.local/conda/envs/optimade/include/python3.6m -c httptools/parser/parser.c -o build/temp.linux-x86_64-3.6/httptools/parser/parser.o -O2
    /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory
    error: command 'gcc-4.9' failed with exit status 1
    ----------------------------------------
ERROR: Command "/home/matthew/.local/conda/envs/optimade/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-bso7iy81/httptools/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-t5796_ix/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-bso7iy81/httptools/

Notice that the third call to the C compiler is to `gcc`, not `gcc-4.9` as set by my environment variables. Running `CC=clang CXX=clang pip --no-cache-dir install httptools` works fine. As GCC is the only compiler guaranteed to be installed in almost every Linux distro, do you know how this could be rectified? Thanks.

After some further investigation, the bug goes all the way down to binutils and ELF in their current state on Arch Linux: https://bbs.archlinux.org/viewtopic.php?id=242682