[LLVMdev] Problems with class inheritance in LLVM

Konstantin Tokarev annulen at yandex.ru
Sun Aug 25 08:45:43 PDT 2013


25.08.2013, 19:29, "James Courtier-Dutton" <james.dutton at gmail.com>:
> Hi,
>
> I have a simple program example attached.
> All it does is try to derive a class from llvm::MemoryObject.
>
> Can anyone tell me why this fails to compile with this error message:
> clang -DHAVE_CONFIG_H -I. -I../src -I../include   -I../test -I/usr/include/llvm-c-3.2 -I/usr/include/llvm-3.2 -O0 -g3 -Wall  -O0 -Wall -g3 -MT mem.o -MD -MP -MF .deps/mem.Tpo -c -o mem.o mem.cpp
> mv -f .deps/mem.Tpo .deps/mem.Po
> /bin/bash ../libtool --tag=CXX   --mode=link clang -I../test -I/usr/include/llvm-c-3.2 -I/usr/include/llvm-3.2 -O0 -g3 -Wall  -O0 -Wall -g3 -export-dynamic -module -avoid-version -O0 -Wall   -o mem mem.o -L/usr/local/lib/beauty -lz -ldl -lLLVM-3.2 -L/usr/lib/llvm-3.2/lib -lstdc++
> libtool: link: clang -I../test -I/usr/include/llvm-c-3.2 -I/usr/include/llvm-3.2 -O0 -g3 -Wall -O0 -Wall -g3 -O0 -Wall -o mem mem.o -Wl,--export-dynamic  -L/usr/local/lib/beauty -lz -ldl -lLLVM-3.2 -L/usr/lib/llvm-3.2/lib -lstdc++
> mem.o:(.rodata+0x90): undefined reference to `typeinfo for llvm::MemoryObject'
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> make: *** [mem] Error 1
>
> Will I have to rebuild llvm with rtti enabled, or is there some other fix I can do with standard llvm 3.2?

You either need to rebuild llvm with rtti, or build your code with -fno-rtti

-- 
Regards,
Konstantin



More information about the llvm-dev mailing list