[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [creduce-dev] Handrolled LLVM+Clang on Ubuntu 14.04 (Re: towards a release)

I see what's going on now. I think John built his LLVM 3.8 with Clang. I was able to config/build C-Reduce with my LLVM 3.8 that was built with GCC. However, I got error "cannot compile and link test program with selected LLVM" after I switched to another version LLVM that was built with Clang.

config.log gave me the following error message:

configure:15977: g++ -o conftest -g -O2 -I/home/chenyang/work/compilers/compiler-install/llvm-3.8-release/include -fPIC -fvisibility-inlines-hidden -std=c++11 -fcolor-diagnostics -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS conftest.cpp -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMInstrumentation -lLLVMProfileData -lLLVMTransformUtils -lLLVMBitWriter -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMExecutionEngine -lLLVMTarget -lLLVMAnalysis -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMMC -lLLVMCore -lLLVMSupport -L/home/chenyang/work/compilers/compiler-install/llvm-3.8-release/lib -lrt -ldl -ltinfo -lpthread -lz -lm >&5
g++: error: unrecognized command line option '-fcolor-diagnostics'
configure:15977: $? = 1
configure: failed program was:

So, looks like we have to filter out -fcolor-diagnostics in our configure file.

- Yang

On 2016-03-15 14:31, Eric Eide wrote:
John Regehr <regehr@cs.utah.edu> writes:

On Ubuntu 14.04, our current repo configures/builds/installs using both clang++ and g++ while linking against the distributed LLVM 3.8 binaries.

When linking against an LLVM 3.8 that I compiled myself, I get "cannot compile
and link test program with selected LLVM".

I just tried this, and "it works for me," so we'll have to investigate.

The following command line "basically works" for me, by which I mean that the
configure-time LLVM test program compiles and links:

  CC=/disk2/randtest/build/bin/clang \
  CXX=/disk2/randtest/build/bin/clang++ \
  ../creduce/configure --with-llvm=/disk2/randtest/build/bin

(Actually, the configure works but the build fails, because the clang headers are not installed in the right place. Rather than sort that out, I just
installed the LLVM+clang, then did this:
  CC=clang CXX=clang++ ../creduce/configure
  make -j8
And the whole build went through.)

(Also, I tried configuring with the installed g++, too:
And that configured fine.  I didn't have the patience to do the make.)

So let's diagnose.

1. Attached to the end of this message is a transcript of the commands I issued to build and install LLVM+clang. Maybe you can spot a relevant difference with
your setup.

2. What does your llvm-config say? See end of message for the answers that my
llvm-config produces.

3. Can you send me the config.log file for your failed creduce configure?

Thanks ---



  501  cd /disk2/randtest
  502  wget http://llvm.org/releases/3.8.0/llvm-3.8.0.src.tar.xz
  503  wget http://llvm.org/releases/3.8.0/cfe-3.8.0.src.tar.xz
  504  wget http://llvm.org/releases/3.8.0/compiler-rt-3.8.0.src.tar.xz
  505  tar xf llvm-3.8.0.src.tar.xz
  506  tar xf cfe-3.8.0.src.tar.xz
  507  tar xf compiler-rt-3.8.0.src.tar.xz
  508  cd llvm-3.8.0.src/llvm/tools
  509  cd llvm-3.8.0.src/tools/
  510  mv ../../cfe-3.8.0.src ./clang
  511  cd ../projects/
  512  ls
  513  mv ../../compiler-rt-3.8.0.src ./compiler-rt
  514  cd ../..
  515  mkdir build
  516  cd build
  517  cmake --help
  518  sudo apt-get install cmake
  519  cmake -G "Unix Makefiles" ../llvm-3.8.0.src
  520  history
  521  make
  522  ls
  523  ls bin
  524  bin/clang++ --version
  525  cd ..
  526  ls
  527  git clone https://github.com/csmith-project/creduce.git
  528  mkdir obj
  529  cd obj
  530  CC=/disk2/randtest/build/bin/clang
CXX=/disk2/randtest/build/bin/clang++ ../creduce/configure
  531  make -j8 > Make.errs 2>&1
# Above fails to build clang_delat due to header issue.
  532  emacs -nw -q Make.errs
  533  history
  534  cd ../build
  535  make -n install
  536  sudo make install
  537  which clang
  538  cd ..
  539  mkdir obj2
  540  cd obj2
  541  CC=clang CXX=clang++ ../creduce/configure
  542  make -j8 > Make.errs 2>&1
# Above works.


eeide@imp:/disk2/randtest/obj2$ llvm-config --ldflags
eeide@imp:/disk2/randtest/obj2$ llvm-config --includedir
eeide@imp:/disk2/randtest/obj2$ llvm-config --libs
-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
-lLLVMNVPTXAsmPrinter -lLLVMMSP430CodeGen -lLLVMMSP430Desc
-lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMipsDisassembler
-lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo
-lLLVMMipsAsmPrinter -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen
-lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo
-lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMBPFCodeGen !
 -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMBPFAsmPrinter -lLLVMARMDisassembler
-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 -l!
 LLVMAnalysis -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser
-lLLVMBitReader -lLLVMMC -lLLVMCore -lLLVMSupport
eeide@imp:/disk2/randtest/obj2$ llvm-config --system-libs
-lrt -ldl -lpthread -lz -lm