Closed tibbe closed 8 years ago
It requires Cabal 1.24 from my experience.
I've managed to build with cabal:
git clone https://github.com/bscarlet/llvm-general.git
cd llvm-general/
git checkout -b llvm-3.8 origin/llvm-3.8
cd llvm-general/
cabal sandbox init
cabal sandbox add-source ../llvm-general-pure/
cabal install --only-dep
cabal configure --extra-lib-dirs=/usr/local/Cellar/libffi/3.0.13/lib -v
cabal build
This is using GHC 7.10.3 and llvm38 from Homebrew.
I spoke to soon. llvm-general itself can be built and installed but when linking my application I still get problems like these:
Undefined symbols for architecture x86_64:
"llvm::TargetRegistry::lookupTarget(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, llvm::Triple&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)", referenced from:
_LLVM_General_LookupTarget in libHSllvm-general-3.8.0.0-92hcfz1GLY9CjTAtL9qzyA.a(TargetC.o)
"llvm::raw_fd_ostream::raw_fd_ostream(llvm::StringRef, std::error_code&, llvm::sys::fs::OpenFlags)", referenced from:
_LLVM_General_WithFileRawOStream in libHSllvm-general-3.8.0.0-92hcfz1GLY9CjTAtL9qzyA.a(RawOStreamC.o)
"llvm::Instruction::getAllMetadataImpl(llvm::SmallVectorImpl<std::pair<unsigned int, llvm::MDNode*> >&) const", referenced from:
_LLVM_General_GetMetadata in libHSllvm-general-3.8.0.0-92hcfz1GLY9CjTAtL9qzyA.a(InstructionC.o)
"std::__1::error_code::message() const", referenced from:
_LLVMPrintModuleToFile in libLLVMCore.a(Core.o)
_LLVMCreateMemoryBufferWithContentsOfFile in libLLVMCore.a(Core.o)
_LLVMCreateMemoryBufferWithSTDIN in libLLVMCore.a(Core.o)
llvm::Interpreter::create(std::__1::unique_ptr<llvm::Module, std::__1::default_delete<llvm::Module> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in libLLVMInterpreter.a(Interpreter.o)
llvm::getLazyIRFileModule(llvm::StringRef, llvm::SMDiagnostic&, llvm::LLVMContext&, bool) in libLLVMIRReader.a(IRReader.o)
llvm::parseIR(llvm::MemoryBufferRef, llvm::SMDiagnostic&, llvm::LLVMContext&) in libLLVMIRReader.a(IRReader.o)
llvm::parseIRFile(llvm::StringRef, llvm::SMDiagnostic&, llvm::LLVMContext&) in libLLVMIRReader.a(IRReader.o)
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find(char, unsigned long) const", referenced from:
llvm::Module::print(llvm::raw_ostream&, llvm::AssemblyAnnotationWriter*, bool, bool) const in libLLVMCore.a(AsmWriter.o)
I'm guessing the the application itself also needs to play games with extraLibs
and ccOptions
to make things link?
It builds now. I had some other gcc on my path and removing that worked.
Having to go through this again on a new machine I can confirm that building llvm-general works if you:
resolver: lts-6.20
(which uses GHC 7.10.3)llvm-general == 3.8.0.*
brew install llvm@3.8
Apple LLVM version 8.0.0 (clang-800.0.42.1)
).extra-lib-dirs: [/usr/local/Cellar/libffi/3.0.13/lib]
to ~/.stack/config.yaml
.stack setup
in your project dir.
After installing LLVM 3.8 from Homebrew I try to compile the llvm-3.8-ghc-8 branch and get:
(I'm using
resolver: lts-6.20
for stack.)Looks like we're passing an unknown flag to GCC.
P.S. It looks like the
custom-setup
section isn't recognized. Perhaps thecabal-version
constraint needs to be bumped.