[llvm-bugs] [Bug 51900] New: undefined reference to `typeinfo for clang::ModuleLoader' if not compiled with -fno-rtti when linking

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 18 07:30:34 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51900

            Bug ID: 51900
           Summary: undefined reference to `typeinfo for
                    clang::ModuleLoader' if not compiled with -fno-rtti
                    when linking
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nickhuang99 at hotmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

This happens when linking llvm12.01 prebuilt library of x86_64_ubuntu16.04. If
compiling flag doesn't have "-fno-rtti", then linking following simple code
will give error of undefined reference to `typeinfo for clang::ModuleLoader'

#include "clang/Lex/ModuleLoader.h"
clang::TrivialModuleLoader modLoader;
int main(){}


steps to reproduce:
1. Download llvm 12.01 prebuilt binary for ubuntu16.04 
https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/clang+llvm-12.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz

2. In Ubuntu18.04 compile above code with include path and library path
pointing to downloaded prebuilt library:

g++ -I ${LLVM_ROOT}/include/ test.cpp -L ${LLVM_ROOT}/lib/ -lclangLex
-lclangBasic -lLLVMMC -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader
-lLLVMBinaryFormat -lLLVMSupport -pthread

3. If flag "-fno-rtti" is added, then all is fine.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210918/8cf9296e/attachment-0001.html>


More information about the llvm-bugs mailing list