[3.5 Release] Building by gcc-4.9.1 failed

Hi all,

I’ve got the following link error

FAILED: : && /usr/bin/c++ -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wnon-virtual-dtor -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O3 -Wl,–export-dynamic tools/opt/CMakeFiles/opt.dir/AnalysisWrappers.cpp.o tools/opt/CMakeFiles/opt.dir/BreakpointPrinter.cpp.o tools/opt/CMakeFiles/opt.dir/GraphPrinters.cpp.o tools/opt/CMakeFiles/opt.dir/NewPMDriver.cpp.o tools/opt/CMakeFiles/opt.dir/Passes.cpp.o tools/opt/CMakeFiles/opt.dir/PassPrinters.cpp.o tools/opt/CMakeFiles/opt.dir/PrintSCC.cpp.o tools/opt/CMakeFiles/opt.dir/opt.cpp.o -o bin/opt lib/libLLVMX86CodeGen.so lib/libLLVMX86AsmPrinter.so lib/libLLVMX86AsmParser.so lib/libLLVMX86Desc.so lib/libLLVMX86Info.so lib/libLLVMX86Disassembler.so lib/libLLVMNVPTXCodeGen.so lib/libLLVMNVPTXAsmPrinter.so lib/libLLVMNVPTXDesc.so lib/libLLVMNVPTXInfo.so lib/libLLVMAnalysis.so lib/libLLVMBitWriter.so lib/libLLVMCodeGen.so lib/libLLVMCore.so lib/libLLVMipa.so lib/libLLVMipo.so lib/libLLVMIRReader.so lib/libLLVMInstCombine.so lib/libLLVMInstrumentation.so lib/libLLVMMC.so lib/libLLVMObjCARCOpts.so lib/libLLVMScalarOpts.so lib/libLLVMSupport.so lib/libLLVMTarget.so lib/libLLVMTransformUtils.so lib/libLLVMVectorize.so lib/libLLVMX86AsmPrinter.so lib/libLLVMX86Utils.so lib/libLLVMObject.so lib/libLLVMX86Info.so lib/libLLVMNVPTXAsmPrinter.so lib/libLLVMAsmPrinter.so lib/libLLVMMCParser.so lib/libLLVMSelectionDAG.so lib/libLLVMCodeGen.so lib/libLLVMScalarOpts.so lib/libLLVMInstCombine.so lib/libLLVMAsmParser.so lib/libLLVMBitReader.so lib/libLLVMTransformUtils.so lib/libLLVMipa.so lib/libLLVMAnalysis.so lib/libLLVMTarget.so lib/libLLVMCore.so lib/libLLVMMC.so lib/libLLVMSupport.so -lrt -ldl -lcurses -lpthread -lz -Wl,-rpath,“$ORIGIN/…/lib” && :
tools/opt/CMakeFiles/opt.dir/opt.cpp.o: In function llvm::cl::list<llvm::PassInfo const*, bool, llvm::PassNameParser>::getExtraOptionNames(llvm::SmallVectorImpl<char const*>&)': opt.cpp:(.text._ZN4llvm2cl4listIPKNS_8PassInfoEbNS_14PassNameParserEE19getExtraOptionNamesERNS_15SmallVectorImplIPKcEE[_ZN4llvm2cl4listIPKNS_8PassInfoEbNS_14PassNameParserEE19getExtraOptionNamesERNS_15SmallVectorImplIPKcEE]+0x56): undefined reference to llvm::cl::parser<llvm::PassInfo const*>::getOption(unsigned int) const’
collect2: error: ld returned 1 exit status
[8/717] Linking CXX executable bin/bugpoint
FAILED: : && /usr/bin/c++ -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wnon-virtual-dtor -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O3 -Wl,–export-dynamic tools/bugpoint/CMakeFiles/bugpoint.dir/BugDriver.cpp.o tools/bugpoint/CMakeFiles/bugpoint.dir/CrashDebugger.cpp.o tools/bugpoint/CMakeFiles/bugpoint.dir/ExecutionDriver.cpp.o tools/bugpoint/CMakeFiles/bugpoint.dir/ExtractFunction.cpp.o tools/bugpoint/CMakeFiles/bugpoint.dir/FindBugs.cpp.o tools/bugpoint/CMakeFiles/bugpoint.dir/Miscompilation.cpp.o tools/bugpoint/CMakeFiles/bugpoint.dir/OptimizerDriver.cpp.o tools/bugpoint/CMakeFiles/bugpoint.dir/ToolRunner.cpp.o tools/bugpoint/CMakeFiles/bugpoint.dir/bugpoint.cpp.o -o bin/bugpoint lib/libLLVMAnalysis.so lib/libLLVMBitWriter.so lib/libLLVMCodeGen.so lib/libLLVMCore.so lib/libLLVMipa.so lib/libLLVMipo.so lib/libLLVMIRReader.so lib/libLLVMInstCombine.so lib/libLLVMInstrumentation.so lib/libLLVMLinker.so lib/libLLVMObjCARCOpts.so lib/libLLVMScalarOpts.so lib/libLLVMSupport.so lib/libLLVMTarget.so lib/libLLVMTransformUtils.so lib/libLLVMVectorize.so lib/libLLVMInstCombine.so lib/libLLVMAsmParser.so lib/libLLVMBitReader.so lib/libLLVMTransformUtils.so lib/libLLVMipa.so lib/libLLVMAnalysis.so lib/libLLVMTarget.so lib/libLLVMCore.so lib/libLLVMMC.so lib/libLLVMSupport.so -lrt -ldl -lcurses -lpthread -lz -Wl,-rpath,“$ORIGIN/…/lib” && :
tools/bugpoint/CMakeFiles/bugpoint.dir/bugpoint.cpp.o: In function llvm::cl::list<llvm::PassInfo const*, bool, llvm::PassNameParser>::getExtraOptionNames(llvm::SmallVectorImpl<char const*>&)': bugpoint.cpp:(.text._ZN4llvm2cl4listIPKNS_8PassInfoEbNS_14PassNameParserEE19getExtraOptionNamesERNS_15SmallVectorImplIPKcEE[_ZN4llvm2cl4listIPKNS_8PassInfoEbNS_14PassNameParserEE19getExtraOptionNamesERNS_15SmallVectorImplIPKcEE]+0x76): undefined reference to llvm::cl::parser<llvm::PassInfo const*>::getOption(unsigned int) const’
collect2: error: ld returned 1 exit status

Here’s how I configured

cmake -G Ninja
-DCMAKE_INSTALL_PREFIX:PATH=/usr
-DCMAKE_BUILD_TYPE:STRING=“Release”
-DBUILD_SHARED_LIBS:BOOL=ON
-DLLVM_TARGETS_TO_BUILD:STRING=“X86;NVPTX”
-DLLVM_BINUTILS_INCDIR:PATH=/usr/include
-DLLVM_BUILD_RUNTIME:BOOL=ON
-DLLVM_BUILD_TESTS:BOOL=ON
-DLLVM_BUILD_TOOLS:BOOL=ON
-DLLVM_INCLUDE_TESTS:BOOL=ON
-DLLVM_INCLUDE_TOOLS:BOOL=ON
-DLLVM_ENABLE_CXX1Y:BOOL=OFF
-DLLVM_ENABLE_LIBCXX:BOOL=ON
-DLLVM_ENABLE_THREADS:BOOL=ON
-DLLVM_ENABLE_FFI:BOOL=ON
-DLLVM_ENABLE_ASSERTIONS:BOOL=ON
-DLLVM_ENABLE_WARNINGS:BOOL=ON
-DLLVM_ENABLE_WERROR:BOOL=OFF
-DLLVM_ENABLE_SPHINX:BOOL=ON
-DLLVM_ENABLE_TERMINFO:BOOL=ON
-DLLVM_ENABLE_ZLIB:BOOL=ON
-DCLANG_INCLUDE_TESTS:BOOL=ON
-DLIBCLANG_BUILD_STATIC:BOOL=OFF
-DCOMPILER_RT_BUILD_SHARED_ASAN:BOOL=ON
-DCOMPILER_RT_CAN_EXECUTE_TESTS:BOOL=ON
-DCOMPILER_RT_INCLUDE_TESTS:BOOL=ON
-DLIBCXX_ENABLE_ASSERTIONS:BOOL=ON
-DLIBCXX_ENABLE_PEDANTIC:BOOL=ON
-DLIBCXX_ENABLE_WERROR:BOOL=OFF
-DLIBCXX_ENABLE_SHARED:BOOL=ON
-DLIBCXX_ENABLE_CXX0X:BOOL=OFF
-DFFI_INCLUDE_DIR:PATH=pkg-config --variable=includedir libffi
-DFFI_LIBRARY_DIR:PATH=pkg-config --variable=libdir libffi
-DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python
…/llvm.src

Please note that clang from trunk works fine.

Thanks!

Ryuta Suzuki