<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 - Clang 9.0.0 rc1 Wrong generation of constexpr symbol causes bootstrapping to fail"
href="https://bugs.llvm.org/show_bug.cgi?id=42843">42843</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang 9.0.0 rc1 Wrong generation of constexpr symbol causes bootstrapping to fail
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>9.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ipvb@qq.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>I used Visual Studio 16.2 as the build environment for clang and downloaded the
pre-compiled <a href="http://prereleases.llvm.org/9.0.0/rc1/LLVM-9.0.0-rc1-win64.exe">http://prereleases.llvm.org/9.0.0/rc1/LLVM-9.0.0-rc1-win64.exe</a>
using 7z to extract to the appropriate directory. Then use it to build the llvm
release/9.x branch and get the following error:
lld-link: error: duplicate symbol: bool const std::_Is_integral<bool> in
utils\TableGen\CMakeFiles\llvm-tblgen.dir\AsmMatcherEmitter.cpp.obj and in
utils\TableGen\CMakeFiles\llvm-tblgen.dir\AsmWriterEmitter.cpp.obj
msvc version: 14.22.27905
I built llvm 9.0 successfully using clang-cl 8.0.1 + Visual Studio 16.2.
cmake args:
```bat
cmake -GNinja "F:/Clangbuilder/out/release_9.x/llvm" -DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_ASSERTIONS=OFF -DCMAKE_INSTALL_UCRT_LIBRARIES=ON
-DLLVM_TARGETS_TO_BUILD="X86;AArch64;ARM"
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="RISCV;WebAssembly"
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;lld;lldb;libcxx"
-DLLVM_FORCE_BUILD_RUNTIME=ON -DLIBCXX_ENABLE_SHARED=YES
-DLIBCXX_ENABLE_STATIC=YES -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO
-DLIBCXX_HAS_WIN32_THREAD_API=ON -DLIBCXX_STANDARD_VER="c++17"
-DCMAKE_INSTALL_PREFIX="F:/Clangbuilder/bin/utils/llvm"
-DLLDB_RELOCATABLE_PYTHON=1 -DLLDB_DISABLE_PYTHON=1
-DCMAKE_C_COMPILER="F:/Clangbuilder/bin/utils/LLVM-9.0.0-rc1-win64/bin/clang-cl.exe"
-DCMAKE_CXX_COMPILER="F:/Clangbuilder/bin/utils/LLVM-9.0.0-rc1-win64/bin/clang-cl.exe"
-DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.22 -m64 "
-DCMAKE_C_FLAGS="-fms-compatibility-version=19.22 -m64 " -DLLVM_ENABLE_LTO=Thin
-DCMAKE_LINKER="F:/Clangbuilder/bin/utils/LLVM-9.0.0-rc1-win64/bin/lld-link.exe"
-DCMAKE_AR="F:/Clangbuilder/bin/utils/LLVM-9.0.0-rc1-win64/bin/llvm-lib.exe"
-DCMAKE_RANLIB="F:/Clangbuilder/bin/utils/LLVM-9.0.0-rc1-win64/bin/llvm-ranlib.exe"
```
I found that this may be related to the fact that clang does not eliminate the
constexpr symbol.
Test two files
typea.cc:
```c++
#include <cstdio>
#include <type_traits>
bool typetest2() {
int n = 0;
return std::is_integral<int>::value;
}
int main() {
/* code */
return 0;
}
```
typeb.cc:
```c++
#include <type_traits>
bool typetest() {
int n = 0;
return std::is_integral<int>::value;
}
```
compile: clang-cl typea.cc typeb.cc -std:c++N
clang-cl 8.0.1 -std:c++14 and -std:c++17 build success, link success
clang-cl 9.0.0 rc1 -std:c++14 build success. link failed: error LNK2005
clang-cl 9.0.0 rc1 -std:c++17 build success. link success.</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>