Как использовать gmpy2 в Heroku? - PullRequest
0 голосов
/ 27 апреля 2020

Я пытаюсь использовать gmpy2 как часть моих Python пакетов в Heroku, но у меня возникают проблемы с процессом сборки.

Я использую два разных пакета сборки: стандартный Python buildpack и APT (heroku-buildpack-apt), поэтому я могу установить зависимости для:

  • libmpfr-dev
  • libmp c -dev
  • libgmp- dev
  • libgmp3-dev

Это ошибка из журнала сборки:

Failed to build gmpy2
       Installing collected packages: base58, six, ecdsa, phe, mypy-extensions, eth-typing, toolz, cytoolz, eth-hash, eth-utils, py-ecc, pycparser, cffi, secp256k1, pybtc, gmpy2, dj-database-url, whitenoise, psycopg2, sqlparse, pytz, asgiref, Django, django-heroku, gunicorn, marshmallow, pyjwt, python-http-client, sendgrid
           Running setup.py install for gmpy2: started
           Running setup.py install for gmpy2: finished with status 'error'
           ERROR: Command errored out with exit status 1:
            command: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-wq_i37ub/gmpy2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-wq_i37ub/gmpy2/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-10c0m8d_/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.7m/gmpy2
                cwd: /tmp/pip-install-wq_i37ub/gmpy2/
           Complete output (36 lines):
           running install
           running build
           running build_py
           creating build
           creating build/lib.linux-x86_64-3.7
           creating build/lib.linux-x86_64-3.7/gmpy2
           copying gmpy2/__init__.py -> build/lib.linux-x86_64-3.7/gmpy2
           running egg_info
           writing gmpy2.egg-info/PKG-INFO
           writing dependency_links to gmpy2.egg-info/dependency_links.txt
           writing top-level names to gmpy2.egg-info/top_level.txt
           reading manifest file 'gmpy2.egg-info/SOURCES.txt'
           reading manifest template 'MANIFEST.in'
           writing manifest file 'gmpy2.egg-info/SOURCES.txt'
           copying gmpy2/__init__.pxd -> build/lib.linux-x86_64-3.7/gmpy2
           copying gmpy2/gmpy2.h -> build/lib.linux-x86_64-3.7/gmpy2
           copying gmpy2/gmpy2.pxd -> build/lib.linux-x86_64-3.7/gmpy2
           running build_ext
           building 'gmpy2.gmpy2' extension
           creating build/temp.linux-x86_64-3.7
           creating build/temp.linux-x86_64-3.7/src
           gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I./src -I/app/.heroku/python/include/python3.7m -c src/gmpy2.c -o build/temp.linux-x86_64-3.7/src/gmpy2.o -DSHARED=1
           gcc -pthread -shared build/temp.linux-x86_64-3.7/src/gmpy2.o -lmpc -lmpfr -lgmp -o build/lib.linux-x86_64-3.7/gmpy2/gmpy2.cpython-37m-x86_64-linux-gnu.so
           /usr/bin/ld: /tmp/build_6b1253f8d045f13d59ea51c89e3a8be6/.apt/usr/lib/x86_64-linux-gnu/libmpfr.a(exceptions.o): relocation R_X86_64_TPOFF32 against symbol `__gmpfr_emin' can not be used when making a shared object; recompile with -fPIC
           /usr/bin/ld: /tmp/build_6b1253f8d045f13d59ea51c89e3a8be6/.apt/usr/lib/x86_64-linux-gnu/libmpfr.a(exp.o): relocation R_X86_64_TPOFF32 against `previous_emax' can not be used when making a shared object; recompile with -fPIC
           /usr/bin/ld: /tmp/build_6b1253f8d045f13d59ea51c89e3a8be6/.apt/usr/lib/x86_64-linux-gnu/libmpfr.a(const_log2.o): relocation R_X86_64_TPOFF32 against symbol `__gmpfr_cache_const_log2' can not be used when making a shared object; recompile with -fPIC
           /usr/bin/ld: /tmp/build_6b1253f8d045f13d59ea51c89e3a8be6/.apt/usr/lib/x86_64-linux-gnu/libmpfr.a(const_pi.o): relocation R_X86_64_TPOFF32 against symbol `__gmpfr_cache_const_pi' can not be used when making a shared object; recompile with -fPIC
           /usr/bin/ld: /tmp/build_6b1253f8d045f13d59ea51c89e3a8be6/.apt/usr/lib/x86_64-linux-gnu/libmpfr.a(set_dfl_prec.o): relocation R_X86_64_TPOFF32 against symbol `__gmpfr_default_fp_bit_precision' can not be used when making a shared object; recompile with -fPIC
           /usr/bin/ld: /tmp/build_6b1253f8d045f13d59ea51c89e3a8be6/.apt/usr/lib/x86_64-linux-gnu/libmpfr.a(set_rnd.o): relocation R_X86_64_TPOFF32 against symbol `__gmpfr_default_rounding_mode' can not be used when making a shared object; recompile with -fPIC
           /usr/bin/ld: /tmp/build_6b1253f8d045f13d59ea51c89e3a8be6/.apt/usr/lib/x86_64-linux-gnu/libmpfr.a(const_euler.o): relocation R_X86_64_TPOFF32 against symbol `__gmpfr_cache_const_euler' can not be used when making a shared object; recompile with -fPIC
           /usr/bin/ld: /tmp/build_6b1253f8d045f13d59ea51c89e3a8be6/.apt/usr/lib/x86_64-linux-gnu/libmpfr.a(const_catalan.o): relocation R_X86_64_TPOFF32 against symbol `__gmpfr_cache_const_catalan' can not be used when making a shared object; recompile with -fPIC
           /usr/bin/ld: /tmp/build_6b1253f8d045f13d59ea51c89e3a8be6/.apt/usr/lib/x86_64-linux-gnu/libmpfr.a(bernoulli.o): relocation R_X86_64_TPOFF32 against `bernoulli_size' can not be used when making a shared object; recompile with -fPIC
           /usr/bin/ld: /tmp/build_6b1253f8d045f13d59ea51c89e3a8be6/.apt/usr/lib/x86_64-linux-gnu/libmpfr.a(pool.o): relocation R_X86_64_TPOFF32 against `n_alloc' can not be used when making a shared object; recompile with -fPIC
           /usr/bin/ld: final link failed: Nonrepresentable section on output
           collect2: error: ld returned 1 exit status
           error: command 'gcc' failed with exit status 1
           ----------------------------------------
       ERROR: Command errored out with exit status 1: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-wq_i37ub/gmpy2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-wq_i37ub/gmpy2/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-10c0m8d_/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.7m/gmpy2 Check the logs for full command output.
 !     Push rejected, failed to compile Python app.
 !     Push failed

На что мне обратить внимание? Могу ли я использовать флаги для команды g cc с этим buildpack-пакетом?

...