<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - undefined reference to `typeinfo for clang::ModuleLoader' if not compiled with -fno-rtti when linking"
href="https://bugs.llvm.org/show_bug.cgi?id=51900">51900</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>undefined reference to `typeinfo for clang::ModuleLoader' if not compiled with -fno-rtti when linking
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>12.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nickhuang99@hotmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>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
<a href="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">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</a>
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>