James Courtier-Dutton
2013-Aug-25 14:55 UTC
[LLVMdev] Problems with class inheritance in LLVM
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? Kind Regards James -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130825/0b873f98/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: mem.cpp Type: text/x-c++src Size: 876 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130825/0b873f98/attachment.cpp>
Hi James,> Will I have to rebuild llvm with rtti enabled, or is there some other fix I > can do with standard llvm 3.2?Either that or compile your code with -fno-rtti as well, I believe. Getting the incomplete RTTI that would come from forcing the issue sounds like a recipe for disaster. Cheers. Tim.
Konstantin Tokarev
2013-Aug-25 15:45 UTC
[LLVMdev] Problems with class inheritance in LLVM
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