update:
I'm now on LLVM 2.9 with binding llvm-0.9.1.2 running on ghc 7.0.4 and I'm down to just one of these errors:
/home/jfmiller28/.cabal/lib/llvm-0.9.1.2/ghc-7.0.4/libHSllvm-0.9.1.2.a(Scalar.o): In function `sm03_info':
(.text+0x24d): undefined reference to `LLVMAddLoopIndexSplitPass'
collect2: ld returned 1 exit status
I am getting the following linker error for the haskell LLVM bindings:
Linking llvm ...
/home/jfmiller28/.cabal/lib/llvm-0.9.0.1/ghc-6.12.3/libHSllvm-0.9.0.1.a(Core.o): In function `scZD_info':
(.text+0xf589): undefined reference to `LLVMBuildFNeg'
/home/jfmiller28/.cabal/lib/llvm-0.9.0.1/ghc-6.12.3/libHSllvm-0.9.0.1.a(Core.o): In function `sdRn_info':
(.text+0x114c5): undefined reference to `LLVMAddDestination'
/home/jfmiller28/.cabal/lib/llvm-0.9.0.1/ghc-6.12.3/libHSllvm-0.9.0.1.a(Core.o): In function `sdSb_info':
(.text+0x11545): undefined reference to `LLVMAddGlobalInAddressSpace'
...
collect2: ld returned 1 exit status
For ghc --make hello.hs:
module Main where
import Data.Word
import LLVM.Core
import LLVM.ExecutionEngine
bldGreet :: CodeGenModule (Function (IO ()))
bldGreet = withStringNul "Hello, JIT!" (\greetz -> do
puts <- newNamedFunction ExternalLinkage "puts" :: TFunction (Ptr Word8 -> IO Word32)
func <- createFunction ExternalLinkage $ do
tmp <- getElementPtr0 greetz (0::Word32, ())
_ <- call puts tmp -- Throw away return value.
ret ()
return func)
main :: IO ()
main = do
initializeNativeTarget
greet <- simpleFunction bldGreet
-- greet
return ()
LLVM was installed with apt-get to /usr/lib/llvm.
/usr/include/llvm/*? What version of LLVM is installed? 2.8? 2.9?