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:
../creduce/configure
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 ---
Eric.
-----
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
--with-llvm=/disk2/randtest/build/bin
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
-L/usr/local/lib
eeide@imp:/disk2/randtest/obj2$ llvm-config --includedir
/usr/local/include
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
-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 -l!
LLVMAnalysis -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser
-lLLVMBitReader -lLLVMMC -lLLVMCore -lLLVMSupport
eeide@imp:/disk2/randtest/obj2$ llvm-config --system-libs
-lrt -ldl -lpthread -lz -lm