building release_50 with gcc7.2.0 on MacOS: duplicate symbol llvm::DominatorTreeBase

This is release_50 branch of git, sha1: f1d5723be3f9456a6b16cdf687847ac2918846de
Using gcc 7.2.0 from homebrew.

$ CC=/usr/local/opt/gcc/bin/x86_64-apple-darwin16.7.0-gcc-7 CXX=/usr/local/opt/gcc/bin/x86_64-apple-darwin16.7.0-g+±7 cmake … -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/Users/andy/local/llvm5 -DCMAKE_PREFIX_PATH=/Users/andy/local/llvm5

$ make VERBOSE=1

[ 92%] Linking CXX executable …/…/bin/bugpoint
cd /Users/andy/Downloads/llvm-project/llvm/build/tools/bugpoint && /usr/local/Cellar/cmake/3.7.2/bin/cmake -E cmake_link_script CMakeFiles/bugpoint.dir/link.txt --verbose=1
/usr/local/opt/gcc/bin/x86_64-apple-darwin16.7.0-g+±7 -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -O3 -DNDEBUG -Wl,-search_paths_first -Wl,-headerpad_max_install_names -rdynamic CMakeFiles/bugpoint.dir/BugDriver.cpp.o CMakeFiles/bugpoint.dir/CrashDebugger.cpp.o CMakeFiles/bugpoint.dir/ExecutionDriver.cpp.o CMakeFiles/bugpoint.dir/ExtractFunction.cpp.o CMakeFiles/bugpoint.dir/FindBugs.cpp.o CMakeFiles/bugpoint.dir/Miscompilation.cpp.o CMakeFiles/bugpoint.dir/OptimizerDriver.cpp.o CMakeFiles/bugpoint.dir/ToolRunner.cpp.o CMakeFiles/bugpoint.dir/bugpoint.cpp.o -o …/…/bin/bugpoint -Wl,-rpath,@loader_path/…/lib …/…/lib/libLLVMAArch64CodeGen.a …/…/lib/libLLVMAArch64AsmPrinter.a …/…/lib/libLLVMAArch64AsmParser.a …/…/lib/libLLVMAArch64Desc.a …/…/lib/libLLVMAArch64Info.a …/…/lib/libLLVMAArch64Disassembler.a …/…/lib/libLLVMAArch64Info.a …/…/lib/libLLVMAArch64Utils.a …/…/lib/libLLVMAMDGPUCodeGen.a …/…/lib/libLLVMAMDGPUAsmPrinter.a …/…/lib/libLLVMAMDGPUAsmParser.a …/…/lib/libLLVMAMDGPUDesc.a …/…/lib/libLLVMAMDGPUInfo.a …/…/lib/libLLVMAMDGPUDisassembler.a …/…/lib/libLLVMAMDGPUInfo.a …/…/lib/libLLVMAMDGPUUtils.a …/…/lib/libLLVMARMCodeGen.a …/…/lib/libLLVMARMAsmPrinter.a …/…/lib/libLLVMARMAsmParser.a …/…/lib/libLLVMARMDesc.a …/…/lib/libLLVMARMInfo.a …/…/lib/libLLVMARMDisassembler.a …/…/lib/libLLVMARMInfo.a …/…/lib/libLLVMBPFCodeGen.a …/…/lib/libLLVMBPFAsmPrinter.a …/…/lib/libLLVMBPFDesc.a …/…/lib/libLLVMBPFInfo.a …/…/lib/libLLVMBPFDisassembler.a …/…/lib/libLLVMBPFInfo.a …/…/lib/libLLVMHexagonCodeGen.a …/…/lib/libLLVMHexagonAsmParser.a …/…/lib/libLLVMHexagonDesc.a …/…/lib/libLLVMHexagonInfo.a …/…/lib/libLLVMHexagonDisassembler.a …/…/lib/libLLVMHexagonInfo.a …/…/lib/libLLVMLanaiCodeGen.a …/…/lib/libLLVMLanaiAsmPrinter.a …/…/lib/libLLVMLanaiAsmParser.a …/…/lib/libLLVMLanaiDesc.a …/…/lib/libLLVMLanaiInfo.a …/…/lib/libLLVMLanaiDisassembler.a …/…/lib/libLLVMLanaiInfo.a …/…/lib/libLLVMMipsCodeGen.a …/…/lib/libLLVMMipsAsmPrinter.a …/…/lib/libLLVMMipsAsmParser.a …/…/lib/libLLVMMipsDesc.a …/…/lib/libLLVMMipsInfo.a …/…/lib/libLLVMMipsDisassembler.a …/…/lib/libLLVMMipsInfo.a …/…/lib/libLLVMMSP430CodeGen.a …/…/lib/libLLVMMSP430AsmPrinter.a …/…/lib/libLLVMMSP430Desc.a …/…/lib/libLLVMMSP430Info.a …/…/lib/libLLVMMSP430Info.a …/…/lib/libLLVMNVPTXCodeGen.a …/…/lib/libLLVMNVPTXAsmPrinter.a …/…/lib/libLLVMNVPTXDesc.a …/…/lib/libLLVMNVPTXInfo.a …/…/lib/libLLVMNVPTXInfo.a …/…/lib/libLLVMPowerPCCodeGen.a …/…/lib/libLLVMPowerPCAsmPrinter.a …/…/lib/libLLVMPowerPCAsmParser.a …/…/lib/libLLVMPowerPCDesc.a …/…/lib/libLLVMPowerPCInfo.a …/…/lib/libLLVMPowerPCDisassembler.a …/…/lib/libLLVMPowerPCInfo.a …/…/lib/libLLVMSparcCodeGen.a …/…/lib/libLLVMSparcAsmPrinter.a …/…/lib/libLLVMSparcAsmParser.a …/…/lib/libLLVMSparcDesc.a …/…/lib/libLLVMSparcInfo.a …/…/lib/libLLVMSparcDisassembler.a …/…/lib/libLLVMSparcInfo.a …/…/lib/libLLVMSystemZCodeGen.a …/…/lib/libLLVMSystemZAsmPrinter.a …/…/lib/libLLVMSystemZAsmParser.a …/…/lib/libLLVMSystemZDesc.a …/…/lib/libLLVMSystemZInfo.a …/…/lib/libLLVMSystemZDisassembler.a …/…/lib/libLLVMSystemZInfo.a …/…/lib/libLLVMX86CodeGen.a …/…/lib/libLLVMX86AsmPrinter.a …/…/lib/libLLVMX86AsmParser.a …/…/lib/libLLVMX86Desc.a …/…/lib/libLLVMX86Info.a …/…/lib/libLLVMX86Disassembler.a …/…/lib/libLLVMX86Info.a …/…/lib/libLLVMX86Utils.a …/…/lib/libLLVMXCoreCodeGen.a …/…/lib/libLLVMXCoreAsmPrinter.a …/…/lib/libLLVMXCoreDesc.a …/…/lib/libLLVMXCoreInfo.a …/…/lib/libLLVMXCoreDisassembler.a …/…/lib/libLLVMXCoreInfo.a …/…/lib/libLLVMAnalysis.a …/…/lib/libLLVMBitWriter.a …/…/lib/libLLVMCodeGen.a …/…/lib/libLLVMCore.a …/…/lib/libLLVMipo.a …/…/lib/libLLVMIRReader.a …/…/lib/libLLVMInstCombine.a …/…/lib/libLLVMInstrumentation.a …/…/lib/libLLVMLinker.a …/…/lib/libLLVMObjCARCOpts.a …/…/lib/libLLVMScalarOpts.a …/…/lib/libLLVMSupport.a …/…/lib/libLLVMTarget.a …/…/lib/libLLVMTransformUtils.a …/…/lib/libLLVMVectorize.a …/…/lib/libLLVMAArch64Desc.a …/…/lib/libLLVMAArch64AsmPrinter.a …/…/lib/libLLVMAArch64Info.a …/…/lib/libLLVMAArch64Utils.a …/…/lib/libLLVMAMDGPUDesc.a …/…/lib/libLLVMAMDGPUAsmPrinter.a …/…/lib/libLLVMAMDGPUInfo.a …/…/lib/libLLVMAMDGPUUtils.a …/…/lib/libLLVMARMDesc.a …/…/lib/libLLVMARMAsmPrinter.a …/…/lib/libLLVMARMInfo.a …/…/lib/libLLVMBPFAsmPrinter.a …/…/lib/libLLVMHexagonDesc.a …/…/lib/libLLVMHexagonInfo.a …/…/lib/libLLVMLanaiDesc.a …/…/lib/libLLVMLanaiAsmPrinter.a …/…/lib/libLLVMLanaiInfo.a …/…/lib/libLLVMMipsAsmPrinter.a …/…/lib/libLLVMMSP430AsmPrinter.a …/…/lib/libLLVMNVPTXAsmPrinter.a …/…/lib/libLLVMAsmParser.a …/…/lib/libLLVMPowerPCAsmPrinter.a …/…/lib/libLLVMSparcAsmPrinter.a …/…/lib/libLLVMSystemZDesc.a …/…/lib/libLLVMSystemZAsmPrinter.a …/…/lib/libLLVMSystemZInfo.a …/…/lib/libLLVMGlobalISel.a …/…/lib/libLLVMX86AsmPrinter.a …/…/lib/libLLVMX86Utils.a …/…/lib/libLLVMXCoreAsmPrinter.a …/…/lib/libLLVMAsmPrinter.a …/…/lib/libLLVMDebugInfoCodeView.a …/…/lib/libLLVMDebugInfoMSF.a …/…/lib/libLLVMSelectionDAG.a …/…/lib/libLLVMCodeGen.a …/…/lib/libLLVMBitWriter.a …/…/lib/libLLVMScalarOpts.a …/…/lib/libLLVMInstCombine.a …/…/lib/libLLVMTarget.a …/…/lib/libLLVMMCDisassembler.a …/…/lib/libLLVMTransformUtils.a …/…/lib/libLLVMAnalysis.a …/…/lib/libLLVMObject.a …/…/lib/libLLVMMCParser.a …/…/lib/libLLVMMC.a …/…/lib/libLLVMBitReader.a …/…/lib/libLLVMProfileData.a …/…/lib/libLLVMCore.a …/…/lib/libLLVMBinaryFormat.a …/…/lib/libLLVMSupport.a -lcurses -lz -lm …/…/lib/libLLVMDemangle.a

duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::releaseMemory() in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::verify() const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::getRoot() const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::reset() in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::getRoots() const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::updateDFSNumbers() const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::isPostDominator() const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::wipe() in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::getRootNode() in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::getRootNode() const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::DominatorTreeBase() in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::DominatorTreeBase() in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::dominates(llvm::DomTreeNodeBasellvm::BasicBlock const*, llvm::DomTreeNodeBasellvm::BasicBlock const*) const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::properlyDominates(llvm::DomTreeNodeBasellvm::BasicBlock const*, llvm::DomTreeNodeBasellvm::BasicBlock const*) const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::dominatedBySlowTreeWalk(llvm::DomTreeNodeBasellvm::BasicBlock const*, llvm::DomTreeNodeBasellvm::BasicBlock const*) const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::changeImmediateDominator(llvm::DomTreeNodeBasellvm::BasicBlock, llvm::DomTreeNodeBasellvm::BasicBlock) in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::dominates(llvm::BasicBlock const*, llvm::BasicBlock const*) const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::properlyDominates(llvm::BasicBlock const*, llvm::BasicBlock const*) const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::findNearestCommonDominator(llvm::BasicBlock const*, llvm::BasicBlock const*) const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::findNearestCommonDominator(llvm::BasicBlock*, llvm::BasicBlock*) const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::changeImmediateDominator(llvm::BasicBlock*, llvm::BasicBlock*) in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::addNewBlock(llvm::BasicBlock*, llvm::BasicBlock*) in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::insertEdge(llvm::BasicBlock*, llvm::BasicBlock*) in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::deleteEdge(llvm::BasicBlock*, llvm::BasicBlock*) in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::operator=(llvm::DominatorTreeBase<llvm::BasicBlock, true>&&) in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::DominatorTreeBase(llvm::DominatorTreeBase<llvm::BasicBlock, true>&&) in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::DominatorTreeBase(llvm::DominatorTreeBase<llvm::BasicBlock, true>&&) in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::compare(llvm::DominatorTreeBase<llvm::BasicBlock, true> const&) const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::operator const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::setNewRoot(llvm::BasicBlock*) in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::addRoot(llvm::BasicBlock*) in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::splitBlock(llvm::BasicBlock*) in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::getNode(llvm::BasicBlock*) const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::eraseNode(llvm::BasicBlock*) in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::isReachableFromEntry(llvm::BasicBlock const*) const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::print(llvm::raw_ostream&) const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::getDescendants(llvm::BasicBlock*, llvm::SmallVectorImplllvm::BasicBlock*&) const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::isReachableFromEntry(llvm::DomTreeNodeBasellvm::BasicBlock const*) const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
duplicate symbol llvm::DominatorTreeBase<llvm::BasicBlock, true>::isVirtualRoot(llvm::DomTreeNodeBasellvm::BasicBlock const*) const in:
…/…/lib/libLLVMAnalysis.a(PostDominators.cpp.o)
…/…/lib/libLLVMCore.a(Dominators.cpp.o)
ld: 39 duplicate symbols for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [bin/bugpoint] Error 1
make[1]: *** [tools/bugpoint/CMakeFiles/bugpoint.dir/all] Error 2
make: *** [all] Error 2

Could you try this patch? It’s already explicitly instantiated in llvm/lib/IR/Dominators.cpp.

diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp
index fc34e6388a5…2282401085d 100644
— a/lib/Analysis/PostDominators.cpp
+++ b/lib/Analysis/PostDominators.cpp
@@ -21,8 +21,6 @@ using namespace llvm;

#define DEBUG_TYPE “postdomtree”

-template class llvm::DominatorTreeBase<BasicBlock, true>; // PostDomTreeBase

LLVM built successfully with this patch. Thanks!

Great, thanks for verifying…