[llvm-dev] Question on symbol lookup error (VersionTuple)

Lorenz Braun via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 10 02:46:32 PST 2020


Hi,

i am currently working on an out-of-source pass to manipulate CUDA 
applications. Because since CUDA 9.2 the launch mechanism has changed, i 
check the CUDA SDK version from within my module pass. My pass fails 
when i use opt to run it on IR code:
`symbol lookup error: /opt/cuda-flux/lib/libcuda_flux_pass.so: undefined 
symbol: _ZN4llvmlsERNS_11raw_ostreamERKNS_12VersionTupleE`

This error does not happen when i register my pass with clang. When 
looking up the symbol tables with nm it shows me that the symbol is not 
found (which i expected from the error i got):
```
$ nm --dynamic /opt/cuda-flux/lib/libcuda_flux_pass.so | grep 
_ZN4llvmlsERNS_11raw_ostreamERKNS_12VersionTupleE
                  U _ZN4llvmlsERNS_11raw_ostreamERKNS_12VersionTupleE
```

When making  the same lookup on the clang binary the symbol is found. 
However, it is not found when doing the lookup on the opt binary. Is 
this on purpose? If yes, what would be the best way to fix this? Linking 
the LLVMSupport lib does not really work because this will lead to 
command line option registered multiple times.

Here some additional info to give some context info:
- using llvm 10.0 tag from github
- cmake config:
     cmake -DLLVM_ENABLE_PROJECTS="clang;openmp" 
-DCMAKE_INSTALL_PREFIX=/opt/llvm-10.0 -DCMAKE_BUILD_TYPE=Release 
-DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_DOXYGEN=OFF 
-DLLVM_BUILD_DOCS=OFF -GNinja -DLLVM_INSTALL_BINUTILS_SYMLINKS=ON ../llvm

Best Regards
Lorenz


More information about the llvm-dev mailing list