Skip to content

Clang 9.0.0 rc1 Wrong generation of constexpr symbol causes bootstrapping to fail #42188

@llvmbot

Description

@llvmbot
Bugzilla Link 42843
Resolution FIXED
Resolved on Sep 25, 2019 04:12
Version 9.0
OS Windows NT
Blocks #41819
Reporter LLVM Bugzilla Contributor
CC @zmodem,@zygoloid,@rnk,@StephanTLavavej

Extended Description

I used Visual Studio 16.2 as the build environment for clang and downloaded the pre-compiled http://prereleases.llvm.org/9.0.0/rc1/LLVM-9.0.0-rc1-win64.exe 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 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:

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:

#include <cstdio> #include <type_traits> bool typetest2() { int n = 0; return std::is_integral<int>::value; } int main() { /* code */ return 0; } 

typeb.cc:

#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclangClang issues not falling into any other category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions