jsonnet
jsonnet copied to clipboard
/usr/bin/ld: final link failed: nonrepresentable section on output
Hi, I'm getting the following problem when attempting to install the python package.
Steps to reproduce (Debian 10, Python 3.7.3, GCC 8.3.0):
$ mkdir jsonnet-example
$ cd jsonnet-example
$ virtualenv .ve -ppython3
$ . .ve/bin/activate
$ pip install jsonnet
Expected outcome: jsonnet is installed.
Actual outcome:
Collecting jsonnet
Using cached jsonnet-0.17.0.tar.gz (259 kB)
Building wheels for collected packages: jsonnet
Building wheel for jsonnet (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/liori/tmp/jsonnet-example/.ve/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4pywunq3/jsonnet_198a5ac379ed4217b07bacb3feb88e1d/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4pywunq3/jsonnet_198a5ac379ed4217b07bacb3feb88e1d/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-063a_skh
cwd: /tmp/pip-install-4pywunq3/jsonnet_198a5ac379ed4217b07bacb3feb88e1d/
Complete output (32 lines):
running bdist_wheel
running build
running build_ext
g++ -c -Iinclude -Ithird_party/md5 -Ithird_party/json core/desugarer.cpp -o core/desugarer.o
g++ -c -Iinclude -Ithird_party/md5 -Ithird_party/json core/formatter.cpp -o core/formatter.o
g++ -c -Iinclude -Ithird_party/md5 -Ithird_party/json core/libjsonnet.cpp -o core/libjsonnet.o
g++ -c -Iinclude -Ithird_party/md5 -Ithird_party/json core/lexer.cpp -o core/lexer.o
g++ -c -Iinclude -Ithird_party/md5 -Ithird_party/json core/parser.cpp -o core/parser.o
g++ -c -Iinclude -Ithird_party/md5 -Ithird_party/json core/pass.cpp -o core/pass.o
g++ -c -Iinclude -Ithird_party/md5 -Ithird_party/json core/static_analysis.cpp -o core/static_analysis.o
g++ -c -Iinclude -Ithird_party/md5 -Ithird_party/json core/string_utils.cpp -o core/string_utils.o
g++ -c -Iinclude -Ithird_party/md5 -Ithird_party/json core/vm.cpp -o core/vm.o
g++ -c -Iinclude -Ithird_party/md5 -Ithird_party/json third_party/md5/md5.cpp -o third_party/md5/md5.o
building '_jsonnet' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/python
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -march=native -Os -fomit-frame-pointer -mfpmath=sse -s -pipe -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json -I/usr/include/python3.7m -I/home/liori/tmp/jsonnet-example/.ve/include/python3.7m -c python/_jsonnet.c -o build/temp.linux-x86_64-3.7/python/_jsonnet.o
creating build/lib.linux-x86_64-3.7
x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,relro -march=native -Os -fomit-frame-pointer -mfpmath=sse -s -pipe -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.7/python/_jsonnet.o core/desugarer.o core/formatter.o core/libjsonnet.o core/lexer.o core/parser.o core/pass.o core/static_analysis.o core/string_utils.o core/vm.o third_party/md5/md5.o -o build/lib.linux-x86_64-3.7/_jsonnet.cpython-37m-x86_64-linux-gnu.so
/usr/bin/ld: core/desugarer.o: relocation R_X86_64_PC32 against symbol `_ZSt4cerr@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/formatter.o: relocation R_X86_64_PC32 against symbol `_ZSt4cerr@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/libjsonnet.o: relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/lexer.o: relocation R_X86_64_PC32 against symbol `_ZTI11StaticError' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/parser.o: relocation R_X86_64_PC32 against symbol `_ZTI11StaticError' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/pass.o: relocation R_X86_64_PC32 against symbol `_ZTI5Apply' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/static_analysis.o: relocation R_X86_64_PC32 against symbol `_ZSt4cerr@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/string_utils.o: relocation R_X86_64_PC32 against symbol `_ZSt4cerr@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/vm.o: relocation R_X86_64_PC32 against symbol `_ZSt4cerr@@GLIBCXX_3.4' 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 'x86_64-linux-gnu-g++' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for jsonnet
Running setup.py clean for jsonnet
Failed to build jsonnet
Installing collected packages: jsonnet
Running setup.py install for jsonnet ... error
ERROR: Command errored out with exit status 1:
command: /home/liori/tmp/jsonnet-example/.ve/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4pywunq3/jsonnet_198a5ac379ed4217b07bacb3feb88e1d/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4pywunq3/jsonnet_198a5ac379ed4217b07bacb3feb88e1d/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-t22pt1sx/install-record.txt --single-version-externally-managed --compile --install-headers /home/liori/tmp/jsonnet-example/.ve/include/site/python3.7/jsonnet
cwd: /tmp/pip-install-4pywunq3/jsonnet_198a5ac379ed4217b07bacb3feb88e1d/
Complete output (32 lines):
running install
running build
running build_ext
make: 'core/desugarer.o' is up to date.
make: 'core/formatter.o' is up to date.
make: 'core/libjsonnet.o' is up to date.
make: 'core/lexer.o' is up to date.
make: 'core/parser.o' is up to date.
make: 'core/pass.o' is up to date.
make: 'core/static_analysis.o' is up to date.
make: 'core/string_utils.o' is up to date.
make: 'core/vm.o' is up to date.
make: 'third_party/md5/md5.o' is up to date.
building '_jsonnet' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/python
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -march=native -Os -fomit-frame-pointer -mfpmath=sse -s -pipe -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json -I/usr/include/python3.7m -I/home/liori/tmp/jsonnet-example/.ve/include/python3.7m -c python/_jsonnet.c -o build/temp.linux-x86_64-3.7/python/_jsonnet.o
creating build/lib.linux-x86_64-3.7
x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,relro -march=native -Os -fomit-frame-pointer -mfpmath=sse -s -pipe -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.7/python/_jsonnet.o core/desugarer.o core/formatter.o core/libjsonnet.o core/lexer.o core/parser.o core/pass.o core/static_analysis.o core/string_utils.o core/vm.o third_party/md5/md5.o -o build/lib.linux-x86_64-3.7/_jsonnet.cpython-37m-x86_64-linux-gnu.so
/usr/bin/ld: core/desugarer.o: relocation R_X86_64_PC32 against symbol `_ZSt4cerr@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/formatter.o: relocation R_X86_64_PC32 against symbol `_ZSt4cerr@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/libjsonnet.o: relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/lexer.o: relocation R_X86_64_PC32 against symbol `_ZTI11StaticError' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/parser.o: relocation R_X86_64_PC32 against symbol `_ZTI11StaticError' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/pass.o: relocation R_X86_64_PC32 against symbol `_ZTI5Apply' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/static_analysis.o: relocation R_X86_64_PC32 against symbol `_ZSt4cerr@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/string_utils.o: relocation R_X86_64_PC32 against symbol `_ZSt4cerr@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: core/vm.o: relocation R_X86_64_PC32 against symbol `_ZSt4cerr@@GLIBCXX_3.4' 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 'x86_64-linux-gnu-g++' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/liori/tmp/jsonnet-example/.ve/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4pywunq3/jsonnet_198a5ac379ed4217b07bacb3feb88e1d/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4pywunq3/jsonnet_198a5ac379ed4217b07bacb3feb88e1d/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-t22pt1sx/install-record.txt --single-version-externally-managed --compile --install-headers /home/liori/tmp/jsonnet-example/.ve/include/site/python3.7/jsonnet Check the logs for full command output.
Thanks for reporting. I wasn't able to reproduce your issue yet.
Do you have some global configuration that might affect the build? The part of the log where it says that "something.o" is up to date is a bit weird. Could it perhaps be building it in a dirty directory?
BTW you might try using gojsonnet package which is designed to be a much faster drop-in replacement. Unfortunately it brings the Go runtime, which causes some problems with multiprocessing (fork() not followed by execve() leading to deadlocks). If you're not going to depend on that, it should be strictly better.
Thank you for your response! I've found a workaround: CXXFLAGS=-fPIC pip install jsonnet. This is enough for me.
I am not aware of any global configuration that would be relevant. Regarding the dirty directory question, I've just assumed it is reusing the directory from the Building wheels step, but I admit I don't really know whether this is supposed to happen.
I'm sure I have no other installation of a Python jsonnet library anywhere in my system, verified via find / -mount -iname '*jsonnet*'.
jsonnet is deep in my dependency chains, so I'm not really at liberty to switch to gojsonnet.