Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

building on ubuntu 16.04 #101

Closed
regehr opened this issue Jul 12, 2016 · 20 comments
Closed

building on ubuntu 16.04 #101

regehr opened this issue Jul 12, 2016 · 20 comments
Assignees

Comments

@regehr
Copy link
Member

regehr commented Jul 12, 2016

on ubuntu 16.04 I can build a working C-Reduce using clang++ as the C++ compiler, but it won't build using the default C++ compiler, gcc-5.3.1

libtool: link: g++ -I/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include -fPIC -fvisibility-inlines-hidden -std=c++11 -ffunction-sections -fdata-sections -DNDEBUG -fno-exceptions -fno-rtti -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti -fno-exceptions -g -O3 -fno-strict-aliasing -Wall -Wextra -Wno-long-long -Wno-unused-parameter -Wno-missing-field-initializers -o clang_delta clang_delta-AggregateToScalar.o clang_delta-BinOpSimplification.o clang_delta-CallExprToValue.o clang_delta-ClangDelta.o clang_delta-ClassTemplateToClass.o clang_delta-CombineGlobalVarDecl.o clang_delta-CombineLocalVarDecl.o clang_delta-CopyPropagation.o clang_delta-EmptyStructToInt.o clang_delta-InstantiateTemplateParam.o clang_delta-InstantiateTemplateTypeParamToInt.o clang_delta-LiftAssignmentExpr.o clang_delta-LocalToGlobal.o clang_delta-MoveFunctionBody.o clang_delta-MoveGlobalVar.o clang_delta-ParamToGlobal.o clang_delta-ParamToLocal.o clang_delta-ReduceArrayDim.o clang_delta-ReduceArraySize.o clang_delta-ReduceClassTemplateParameter.o clang_delta-ReducePointerLevel.o clang_delta-ReducePointerPairs.o clang_delta-RemoveAddrTaken.o clang_delta-RemoveArray.o clang_delta-RemoveBaseClass.o clang_delta-RemoveCtorInitializer.o clang_delta-RemoveEnumMemberValue.o clang_delta-RemoveNamespace.o clang_delta-RemoveNestedFunction.o clang_delta-RemovePointer.o clang_delta-RemoveTrivialBaseTemplate.o clang_delta-RemoveUnresolvedBase.o clang_delta-RemoveUnusedEnumMember.o clang_delta-RemoveUnusedFunction.o clang_delta-RemoveUnusedOuterClass.o clang_delta-RemoveUnusedStructField.o clang_delta-RemoveUnusedVar.o clang_delta-RenameCXXMethod.o clang_delta-RenameClass.o clang_delta-RenameFun.o clang_delta-RenameParam.o clang_delta-RenameVar.o clang_delta-ReplaceArrayAccessWithIndex.o clang_delta-ReplaceArrayIndexVar.o clang_delta-ReplaceCallExpr.o clang_delta-ReplaceClassWithBaseTemplateSpec.o clang_delta-ReplaceDependentName.o clang_delta-ReplaceDependentTypedef.o clang_delta-ReplaceDerivedClass.o clang_delta-ReplaceFunctionDefWithDecl.o clang_delta-ReplaceOneLevelTypedefType.o clang_delta-ReplaceSimpleTypedef.o clang_delta-ReplaceUndefinedFunction.o clang_delta-ReturnVoid.o clang_delta-RewriteUtils.o clang_delta-SimpleInliner.o clang_delta-SimplifyCallExpr.o clang_delta-SimplifyCommaExpr.o clang_delta-SimplifyDependentTypedef.o clang_delta-SimplifyIf.o clang_delta-SimplifyNestedClass.o clang_delta-SimplifyRecursiveTemplateInstantiation.o clang_delta-SimplifyStruct.o clang_delta-SimplifyStructUnionDecl.o clang_delta-TemplateArgToInt.o clang_delta-TemplateNonTypeArgToInt.o clang_delta-Transformation.o clang_delta-TransformationManager.o clang_delta-UnifyFunctionDecl.o clang_delta-UnionToStruct.o clang_delta-git_version.o  -lclangStaticAnalyzerFrontend -lclangStaticAnalyzerCheckers -lclangStaticAnalyzerCore -lclangFrontendTool -lclangFrontend -lclangDriver -lclangSerialization -lclangCodeGen -lclangParse -lclangSema -lclangAnalysis -lclangRewriteFrontend -lclangRewrite -lclangAST -lclangBasic -lclangEdit -lclangLex -lLLVMLTO -lLLVMObjCARCOpts -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoDWARF -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMBPFCodeGen -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMBPFAsmPrinter -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAMDGPUCodeGen -lLLVMAMDGPUAsmParser -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMAMDGPUInfo -lLLVMAMDGPUAsmPrinter -lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMMIRParser -lLLVMLibDriver -lLLVMOption -lLLVMTableGen -lLLVMLineEditor -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMPasses -lLLVMipo -lLLVMVectorize -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMDebugInfoCodeView -lLLVMInterpreter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMInstrumentation -lLLVMProfileData -lLLVMBitWriter -lLLVMOrcJIT -lLLVMTransformUtils -lLLVMExecutionEngine -lLLVMTarget -lLLVMAnalysis -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMMC -lLLVMCore -lLLVMSupport -lrt -ldl -lpthread -lm -L/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/lib
clang_delta-AggregateToScalar.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
clang_delta-InstantiateTemplateParam.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
clang_delta-LocalToGlobal.o: In function `LocalToGlobal::setNewName(clang::FunctionDecl*, clang::VarDecl const*)':
/home/regehr/creduce/build/clang_delta/../../clang_delta/LocalToGlobal.cpp:173: undefined reference to `clang::DeclarationNameInfo::getAsString[abi:cxx11]() const'
clang_delta-LocalToGlobal.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
clang_delta-MoveGlobalVar.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
clang_delta-ParamToGlobal.o: In function `ParamToGlobal::getNewName[abi:cxx11](clang::FunctionDecl*, clang::ParmVarDecl const*)':
/home/regehr/creduce/build/clang_delta/../../clang_delta/ParamToGlobal.cpp:72: undefined reference to `clang::DeclarationNameInfo::getAsString[abi:cxx11]() const'
clang_delta-ParamToGlobal.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
clang_delta-ParamToGlobal.o: In function `clang::QualType::getAsString[abi:cxx11](clang::SplitQualType)':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Type.h:905: undefined reference to `clang::QualType::getAsString[abi:cxx11](clang::Type const*, clang::Qualifiers)'
clang_delta-ParamToGlobal.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
clang_delta-ParamToLocal.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
clang_delta-ParamToLocal.o: In function `clang::QualType::getAsString[abi:cxx11](clang::SplitQualType)':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Type.h:905: undefined reference to `clang::QualType::getAsString[abi:cxx11](clang::Type const*, clang::Qualifiers)'
clang_delta-ParamToLocal.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
clang_delta-ReducePointerLevel.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
clang_delta-RemoveBaseClass.o: In function `RemoveBaseClass::copyBaseClassDecls()':
/home/regehr/creduce/build/clang_delta/../../clang_delta/RemoveBaseClass.cpp:217: undefined reference to `clang::Rewriter::getRewrittenText[abi:cxx11](clang::SourceRange) const'
clang_delta-RemoveBaseClass.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
clang_delta-RemoveBaseClass.o:/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: more undefined references to `clang::DeclarationName::getAsString[abi:cxx11]() const' follow
clang_delta-ReplaceArrayAccessWithIndex.o: In function `clang::QualType::getAsString[abi:cxx11](clang::SplitQualType)':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Type.h:905: undefined reference to `clang::QualType::getAsString[abi:cxx11](clang::Type const*, clang::Qualifiers)'
clang_delta-ReplaceCallExpr.o: In function `clang::QualType::getAsString[abi:cxx11](clang::SplitQualType)':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Type.h:905: undefined reference to `clang::QualType::getAsString[abi:cxx11](clang::Type const*, clang::Qualifiers)'
clang_delta-ReplaceCallExpr.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
clang_delta-ReplaceDependentTypedef.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
clang_delta-ReplaceDerivedClass.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
clang_delta-ReplaceDerivedClass.o:/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: more undefined references to `clang::DeclarationName::getAsString[abi:cxx11]() const' follow
clang_delta-TemplateNonTypeArgToInt.o: In function `llvm::APSInt::toString[abi:cxx11](unsigned int) const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/llvm/ADT/APSInt.h:71: undefined reference to `llvm::APInt::toString[abi:cxx11](unsigned int, bool) const'
clang_delta-TemplateNonTypeArgToInt.o: In function `clang::QualType::getAsString[abi:cxx11](clang::SplitQualType)':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Type.h:905: undefined reference to `clang::QualType::getAsString[abi:cxx11](clang::Type const*, clang::Qualifiers)'
clang_delta-TemplateNonTypeArgToInt.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
clang_delta-Transformation.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
clang_delta-Transformation.o: In function `llvm::APSInt::toString[abi:cxx11](unsigned int) const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/llvm/ADT/APSInt.h:71: undefined reference to `llvm::APInt::toString[abi:cxx11](unsigned int, bool) const'
clang_delta-Transformation.o: In function `clang::NamedDecl::getNameAsString[abi:cxx11]() const':
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
/home/regehr/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Decl.h:184: undefined reference to `clang::DeclarationName::getAsString[abi:cxx11]() const'
collect2: error: ld returned 1 exit status
Makefile:759: recipe for target 'clang_delta' failed
make[2]: *** [clang_delta] Error 1
make[2]: Leaving directory '/home/regehr/creduce/build/clang_delta'
Makefile:443: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/regehr/creduce/build'
Makefile:375: recipe for target 'all' failed
make: *** [all] Error 2
@eeide
Copy link
Member

eeide commented Jul 12, 2016

John Regehr notifications@github.com writes:

on ubuntu 16.04 I can build a working C-Reduce using clang++ as the C++
compiler, but it won't build using the default C++ compiler, gcc-5.3.1

I had a similar problem with GCC 5 a while ago:
http://www.flux.utah.edu/listarchives/creduce-dev/msg00271.html

Let me dig up the response...


Eric Eide eeide@cs.utah.edu . University of Utah School of Computing
http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX

@regehr
Copy link
Member Author

regehr commented Aug 2, 2016

Doesn't work when linking against LLVM 3.8.1 either. Let's make sure to include a note about this in our install file before doing another release.

@regehr
Copy link
Member Author

regehr commented Aug 2, 2016

Nor can I build C-Reduce's llvm-svn-compatible branch on Ubuntu 16.04 using the default gcc. Argh.

@chenyang78
Copy link
Member

Might relate to the issue discussed here:

https://www.bountysource.com/issues/29193004-link-errors-on-debian-sid

@eeide
Copy link
Member

eeide commented Aug 3, 2016

I am experimenting with this now.

The current C-Reduce (87f9674) builds and runs for me with:

  • Ubuntu 16.04 LTS
  • the current LLVM 3.8.0 binaries from apt (http://apt.llvm.org/)
  • GCC 5.4.0 (g++ (Ubuntu 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609)

The process of installing the binaries from apt updated GCC.

@regehr
Copy link
Member Author

regehr commented Aug 3, 2016

Eric maybe you could also confirm that C-Reduce fails to build using the binary clang+llvm distributed at llvm.org?

@regehr
Copy link
Member Author

regehr commented Aug 3, 2016

I installed clang-3.8 using apt and now I get this:

regehr@ulam:~/creduce/build$ cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/share/llvm-3.8/cmake/LLVMConfig.cmake:178 (include):
  include could not find load file:

    /usr/share/llvm/cmake/LLVMExports.cmake
Call Stack (most recent call first):
  CMakeLists.txt:26 (find_package)


CMake Error at /usr/share/llvm-3.8/cmake/LLVMConfig.cmake:181 (include):
  include could not find load file:

    /usr/share/llvm/cmake/LLVM-Config.cmake
Call Stack (most recent call first):
  CMakeLists.txt:26 (find_package)


-- Found LLVM 3.8.0
-- Using LLVMConfig.cmake in /usr/share/llvm-3.8/cmake
-- Found Perl: /usr/bin/perl (found version "5.22.1") 
-- Found FLEX: /usr/bin/flex (found version "2.6.0") 
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
CMake Error at clang_delta/CMakeLists.txt:33 (llvm_map_components_to_libnames):
  Unknown CMake command "llvm_map_components_to_libnames".


-- Configuring incomplete, errors occurred!
See also "/home/regehr/creduce/build/CMakeFiles/CMakeOutput.log".
regehr@ulam:~/creduce/build$ 

@eeide
Copy link
Member

eeide commented Aug 3, 2016

@regehr The binary packages from apt don't work with our CMake-based build system, because their CMake defs are broken. Use the Autoconf-based build system.

@eeide
Copy link
Member

eeide commented Aug 3, 2016

(I miss threads in this forum.) I am testing with the precompiled binary from http://llvm.org/releases/download.html now.

@chenyang78
Copy link
Member

With default GCC on Ubuntu 16.04, I got the same failure as described in John's first comment. However, I successfully built clang_delta by manually appending -D_GLIBCXX_USE_CXX11_ABI=0 to DEFS in the generated clang_delta/Makefile.

@eeide
Copy link
Member

eeide commented Aug 3, 2016

@chenyang78 ...building against LLVM acquired/compiled how?

@chenyang78
Copy link
Member

@eeide That's a good question...

@regehr
Copy link
Member Author

regehr commented Aug 3, 2016

Hmm. I just configured like this:

cmake .. -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0

using the supplied gcc-5.4 and the clang+llvm 3.8.1 from the LLVM web site and ended up with this:

[  1%] Linking CXX executable clang_delta
CMakeFiles/clang_delta.dir/AggregateToScalar.cpp.o: In function `clang::QualType::getAsStringInternal(clang::SplitQualType, std::string&, clang::PrintingPolicy const&)':
AggregateToScalar.cpp:(.text._ZN5clang8QualType19getAsStringInternalENS_13SplitQualTypeERSsRKNS_14PrintingPolicyE[_ZN5clang8QualType19getAsStringInternalENS_13SplitQualTypeERSsRKNS_14PrintingPolicyE]+0x3a): undefined reference to `clang::QualType::getAsStringInternal(clang::Type const*, clang::Qualifiers, std::string&, clang::PrintingPolicy const&)'
collect2: error: ld returned 1 exit status
clang_delta/CMakeFiles/clang_delta.dir/build.make:1974: recipe for target 'clang_delta/clang_delta' failed
make[2]: *** [clang_delta/clang_delta] Error 1
CMakeFiles/Makefile2:85: recipe for target 'clang_delta/CMakeFiles/clang_delta.dir/all' failed
make[1]: *** [clang_delta/CMakeFiles/clang_delta.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

This is fewer errors than I get without that extra CXX flag.

@regehr
Copy link
Member Author

regehr commented Aug 3, 2016

binary LLVM 3.8.0 from their site gives same error.

@eeide
Copy link
Member

eeide commented Aug 3, 2016

I hate linkers.

@eeide
Copy link
Member

eeide commented Aug 3, 2016

Without going into too much gory detail, the general conclusion of my experiments today is the same as what @regehr originally reported: that one cannot compile clang_delta against LLVM's available-for-download binaries (those at http://llvm.org/releases/download.html) using GCC (5.4.0) under Ubuntu 16.04.

It works to compile against the LLVM 3.8.0 nightly build (from http://apt.llvm.org/) with GCC 5.4.0 and C-Reduce's Autoconf-based build path. Why this is, I'm not sure. Maybe it's because the binary is built with -std=c++0x. But actually, the CXX flags that we extract from the nightly build include both -std=c++0x and -std=c++11. Go figure.

But in general, compiling with GCC 5.4 against the available-for-download LLVM 3.8 binaries seems to be a no-go.

FWIW, I tried the trick suggested by @chenyang78, setting _GLIBCXX_USE_CXX11_ABI=0:

../creduce/configure --with-llvm=/disk2/randtest/clang+llvm-3.8.1-x86_64-linux-gnu-ubuntu-16.04 CPPFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0"

This is an attempt to build with GCC 5.4.0 against the available-for-download version of LLVM 3.8.1. This failed, with a bunch of errors similar to what @regehr reported:

clang_delta-AggregateToScalar.o: In function `clang::QualType::getAsStringInternal(clang::SplitQualType, std::string&, clang::PrintingPolicy const&)':
/disk2/randtest/clang+llvm-3.8.1-x86_64-linux-gnu-ubuntu-16.04/include/clang/AST/Type.h:929: undefined reference to `clang::QualType::getAsStringInternal(clang::Type const*, clang::Qualifiers, std::string&, clang::PrintingPolicy const&)'

@regehr
Copy link
Member Author

regehr commented Aug 3, 2016

As far as I'm concerned, we should just recommend that C-Reduce be built using clang++ if any problem like this is encountered. This doesn't fail on any platform that I'm aware of. We can go back to recommending GCC once everyone gets their issues figured out.

@eeide
Copy link
Member

eeide commented Aug 3, 2016

Agreed!

@chenyang78
Copy link
Member

Thanks, Eric.

I built my LLVM 3.8 locally with GCC 4.8 before I updated my system to Ubuntu 16.04. I guess this made the _GLIBCXX_USE_CXX11_ABI=0 trick work for me.

I also agree with John's last comment.

eeide added a commit that referenced this issue Dec 8, 2016
Tell people that if they encounter weird link-time errors, they should
try compiling C-Reduce with Clang (notably, not GCC 5.*).  This advice
was the outcome of issue #101.
@eeide eeide self-assigned this Dec 19, 2016
@eeide
Copy link
Member

eeide commented Dec 19, 2016

This issue was "resolved" by commit 7b7a8f7, which encourages people to compile with clang++.

@eeide eeide closed this as completed Dec 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants