Hi everyone!
I am currently facing a problem I can't quite wrap my head around
when trying to run LLVM's new pass manager with NDK 25's prebuilt
host clang++ compiler on version 14.0.6.
A pass-plugin, let's call it libPlugin.so, gets built
using the toolchain's clang++ and gets compiled & linked
correctly. Obviously, many symbols in that library are undefined
since they should be resolved at runtime of the plugin.
When I am trying to use the plugin to compile some source to a
static library called libCustom.a (which is only used on
the host) I am using CMake which generates the following call:
/home/builder/android-home/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ < a few includes > -fPIC -Wall -Wpedantic -Wextra -Werror -fexceptions -g3 -gdwarf-4 -fvisibility=hidden -O1 -fexperimental-new-pass-manager -fpass-plugin=/home/builder/.local/lib/libPlugin.so -MD -MT lib/CMakeFiles/Custom.dir/libCustom.cpp.o -MF CMakeFiles/Custom.dir/libCustom.cpp.o.d -o CMakeFiles/Custom.dir/libCustom.cpp.o -c /builds/custom/lib/libCustom.cpp
But I get the following error
error: unable to load plugin '/home/builder/.local/lib/libPlugin.so': 'Could not load library '/home/builder/.local/lib/libPlugin.so': /home/builder/.local/lib/libPlugin.so: undefined symbol: _ZTVN4llvm14raw_os_ostreamE
before any linking occurs, meaning that flags like
-Wl,--allow-shlib-undefined don't really work here.
If I am setting CC and CXX to my "normal" compilers
(/usr/bin/clang and /usr/bin/clang++) everything works as expected
and I get libCustom.a built using the "new" pass manager.
Any help or ideas why this fails would be appreciated!
Greetings,
Philipp