question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

relocation R_X86_64_PC32 against symbol `_ZTVN4llvm11raw_ostreamE@@LLVM_7' can not be used

See original GitHub issue

Hi, trying to build llvmlite 0.27.1rc1 this build break came up:

++  -shared -I/usr/lib/llvm-7/include -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti -g -flto assembly.cpp bitcode.cpp core.cpp initfini.cpp module.cpp value.cpp executionengine.cpp transforms.cpp passmanagers.cpp targets.cpp dylib.cpp linker.cpp object_file.cpp -o libllvmlite.so -Wl,-z,relro -L/usr/lib/llvm-7/lib -flto -Wl,--exclude-libs=ALL -lLLVM-7
transforms.cpp:10:32: warning: 'unwrap' violates the C++ One Definition Rule  [-Wodr]
     inline PassManagerBuilder *unwrap(LLVMPassManagerBuilderRef P) {
                                ^
executionengine.cpp:53:27: note: return value type mismatch
     inline TargetMachine *unwrap(LLVMTargetMachineRef P) {
                           ^
/usr/lib/llvm-7/include/llvm/Target/TargetMachine.h:59:7: note: type name 'llvm::TargetMachine' should match type name 'llvm::PassManagerBuilder'
 class TargetMachine {
       ^
/usr/lib/llvm-7/include/llvm/Transforms/IPO/PassManagerBuilder.h:59:7: note: the incompatible type is defined here
 class PassManagerBuilder {
       ^
executionengine.cpp:53:27: note: 'unwrap' was previously declared here
     inline TargetMachine *unwrap(LLVMTargetMachineRef P) {
                           ^
executionengine.cpp:53:27: note: code may be misoptimized unless -fno-strict-aliasing is used
/usr/bin/ld: /tmp/ccmWo70g.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol `_ZTVN4llvm11raw_ostreamE@@LLVM_7' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile.linux:22: libllvmlite.so] Error 1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
aguinetcommented, Jan 2, 2019

One workaround to do this is to compile llvmlite by forcing the usage of -fPIC:

CXX="g++ -fPIC" pip install llvmlite

You might not see this on Ubuntu machines because -fPIC and -pie are set by default (https://wiki.ubuntu.com/SecurityTeam/PIE).

I guess this needs to be fixed in llvmlite’s setup.py somehow!

0reactions
astrojuanlucommented, May 16, 2019

I am getting a similar error again using llvmdev from the numba channel:

(poliastro37) juanlu@centauri ~ $ llvm-config --prefix
/home/juanlu/.miniconda36/envs/poliastro37
(poliastro37) juanlu@centauri ~ $ llvm-config --version
8.0.0
(poliastro37) juanlu@centauri ~ $ llvm-config --cflags
-I/home/juanlu/.miniconda36/envs/poliastro37/include  -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
(poliastro37) juanlu@centauri ~ $ pip install git+https://github.com/numba/llvmlite.git -v
Created temporary directory: /tmp/pip-ephem-wheel-cache-bu3u1ijz
Created temporary directory: /tmp/pip-req-tracker-w5byulge
Created requirements tracker '/tmp/pip-req-tracker-w5byulge'
Created temporary directory: /tmp/pip-install-yglj_8tf
Collecting git+https://github.com/numba/llvmlite.git
  Created temporary directory: /tmp/pip-req-build-0pq_sw9v
  Cloning https://github.com/numba/llvmlite.git to /tmp/pip-req-build-0pq_sw9v
  Running command git clone -q https://github.com/numba/llvmlite.git /tmp/pip-req-build-0pq_sw9v
  Added git+https://github.com/numba/llvmlite.git to build tracker '/tmp/pip-req-tracker-w5byulge'
    Running setup.py (path:/tmp/pip-req-build-0pq_sw9v/setup.py) egg_info for package from git+https://github.com/numba/llvmlite.git
    Running command python setup.py egg_info
    running egg_info
    creating pip-egg-info/llvmlite.egg-info
    writing pip-egg-info/llvmlite.egg-info/PKG-INFO
    writing dependency_links to pip-egg-info/llvmlite.egg-info/dependency_links.txt
    writing top-level names to pip-egg-info/llvmlite.egg-info/top_level.txt
    writing manifest file 'pip-egg-info/llvmlite.egg-info/SOURCES.txt'
    reading manifest file 'pip-egg-info/llvmlite.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    /home/juanlu/.miniconda36/envs/poliastro37/lib/python3.7/site-packages/setuptools/dist.py:472: UserWarning: Normalizing '0.29.0dev0+30.g1038ba6' to '0.29.0.dev0+30.g1038ba6'
      normalized_version,
    warning: no previously-included files matching 'CMakeCache.txt' found anywhere in distribution
    writing manifest file 'pip-egg-info/llvmlite.egg-info/SOURCES.txt'
  Source in /tmp/pip-req-build-0pq_sw9v has version 0.29.0.dev0+30.g1038ba6, which satisfies requirement llvmlite==0.29.0.dev0+30.g1038ba6 from git+https://github.com/numba/llvmlite.git
  Removed llvmlite==0.29.0.dev0+30.g1038ba6 from git+https://github.com/numba/llvmlite.git from build tracker '/tmp/pip-req-tracker-w5byulge'
Building wheels for collected packages: llvmlite
  Created temporary directory: /tmp/pip-wheel-cc71osvt
  Building wheel for llvmlite (setup.py) ...   Destination directory: /tmp/pip-wheel-cc71osvt
  Running command /home/juanlu/.miniconda36/envs/poliastro37/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-req-build-0pq_sw9v/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-cc71osvt --python-tag cp37
  /home/juanlu/.miniconda36/envs/poliastro37/lib/python3.7/site-packages/setuptools/dist.py:472: UserWarning: Normalizing '0.29.0dev0+30.g1038ba6' to '0.29.0.dev0+30.g1038ba6'
    normalized_version,
  running bdist_wheel
  /home/juanlu/.miniconda36/envs/poliastro37/bin/python /tmp/pip-req-build-0pq_sw9v/ffi/build.py
  LLVM version... # static-libstdc++ avoids runtime dependencies on a
  # particular libstdc++ version.
  g++  -shared -I/home/juanlu/.miniconda36/envs/poliastro37/include -std=c++17 -fno-exceptions -fno-rtti -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti -g -DHAVE_SVML -flto assembly.cpp bitcode.cpp core.cpp initfini.cpp module.cpp value.cpp executionengine.cpp transforms.cpp passmanagers.cpp targets.cpp dylib.cpp linker.cpp object_file.cpp -o libllvmlite.so  -L/home/juanlu/.miniconda36/envs/poliastro37/lib -flto -Wl,--exclude-libs=ALL -lLLVMFuzzMutate -lLLVMCoverage -lLLVMDlltoolDriver -lLLVMOrcJIT -lLLVMMCA -lLLVMWindowsManifest -lLLVMTextAPI -lLLVMMCJIT -lLLVMCoroutines -lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMMIRParser -lLLVMTableGen -lLLVMIntelJITEvents -lLLVMDebugInfoDWARF -lLLVMXRay -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyDesc -lLLVMWebAssemblyAsmPrinter -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMAMDGPUDisassembler -lLLVMMCDisassembler -lLLVMAMDGPUCodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMAsmPrinter -lLLVMAMDGPUAsmParser -lLLVMAMDGPUDesc -lLLVMAMDGPUInfo -lLLVMAMDGPUAsmPrinter -lLLVMAMDGPUUtils -lLLVMObjectYAML -lLLVMOptRemarks -lLLVMLibDriver -lLLVMOption -lLLVMLineEditor -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle -lz -lrt -ldl -lpthread -lm
  /usr/bin/ld: /tmp/cc2piJCD.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol `_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: final link failed: Bad value
  collect2: error: ld returned 1 exit status
  Makefile.linux:20: recipe for target 'libllvmlite.so' failed
  make: *** [libllvmlite.so] Error 1
  8.0.0

  SVML detected
  Traceback (most recent call last):
    File "/tmp/pip-req-build-0pq_sw9v/ffi/build.py", line 168, in <module>
      main()
    File "/tmp/pip-req-build-0pq_sw9v/ffi/build.py", line 158, in main
      main_posix('linux', '.so')
    File "/tmp/pip-req-build-0pq_sw9v/ffi/build.py", line 150, in main_posix
      subprocess.check_call(['make', '-f', makefile])
    File "/home/juanlu/.miniconda36/envs/poliastro37/lib/python3.7/subprocess.py", line 347, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['make', '-f', 'Makefile.linux']' returned non-zero exit status 2.
  error: command '/home/juanlu/.miniconda36/envs/poliastro37/bin/python' failed with exit status 1
error
  ERROR: Failed building wheel for llvmlite
[...]
Read more comments on GitHub >

github_iconTop Results From Across the Web

error: lib.a: relocation R_X86_64_PC32 against symbol ...
a: relocation R_X86_64_PC32 against symbol `...' can not be used when making a shared object; recompile with -fPIC [duplicate] · Ask Question.
Read more >
ERROR:: Relocation R_X86_64_PC32 against symbol ...
ERROR:: Relocation R_X86_64_PC32 against symbol `_ZN6GlobalD1Ev' can not be used when making a shared object. #12.
Read more >
relocation R_X86_64_32S against `.rodata' can not be used ...
relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; ... /usr/local/lib/libgflags.a: could not read symbols: Bad value.
Read more >
Final Order Changing Parenting Plan: No Objection to Moving ...
I want the court to permit the move and to enter my proposed parenting plan. What forms do I use? Form. Title. Download....
Read more >
UrbanBound: Employee Relocation Management Software
Give employees the relocation support they need with UrbanBound. Our relocation management software provides a better relocation experience and controls ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found