bscarlet / llvm-general

Rich LLVM bindings for Haskell (with transfer of LLVM IR to and from C++, detailed compilation pass control, etc.)
http://hackage.haskell.org/package/llvm-general
132 stars 38 forks source link

An AST instruction was not found in the LLVM instruction defs #98

Closed mr- closed 10 years ago

mr- commented 10 years ago

I have been trying to compile llvm-general. It fails at: [33 of 85] Compiling LLVM.General.Internal.FFI.Builder ( src/LLVM/General/Internal/FFI/Builder.hs, dist/dist-sandbox-3447375f/build/LLVM/General/Internal/FFI/Builder.o )

src/LLVM/General/Internal/FFI/Builder.hs:1:1: Exception when trying to run compile-time code: An AST instruction was not found in the LLVM instruction defs Code: do { ($) liftM (concat) ($) sequence do { let ...; .... } } Failed to install llvm-general-3.4.2.2 cabal: Error: some packages failed to install: llvm-general-3.4.2.2 failed during the building phase. The exception was: ExitFailure 1

I installed llvm-3.4 using apt-get.

uname -a says Linux mini 3.11.0-17-generic #31-Ubuntu SMP Mon Feb 3 21:52:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

mr- commented 10 years ago

After removing llvm-3.4 and installing llvm-3.2, cabal managed to install llvm-general-3.2.8.2.

bscarlet commented 10 years ago

1) There might be an llvm-config binary on your path for the wrong version of llvm, for some reason. The Setup.hs file searches for llvm-config and e.g. llvm-config-3.4 on your path to figure out where the various parts of llvm have been put. 2) The package you got with apt could be tweaked or not-quite-up-to-date. If include/llvm/IR/Instruction.def from the package does not match the version in the llvm svn repository under llvm/branches/release_34/ this is likely the problem. 3) Your build could have been other than clean. Since you say you're using cabal this case is unlikely, but I do sometimes see that error when change my git branch (and hence the version of llvm I'm building against) and forget to do a clean build.

ilya-biryukov commented 10 years ago

I've had the same problem with llvm-general-3.4.2.2 from cabal and llvm-3.4-dev package from ubuntu repo. I've tried a bundle of llvm-general-3.3.11.2 and llvm-3.3-dev package from ubuntu repo instead and it worked for me.

bscarlet commented 10 years ago

Can you get me a link to the repo in question?

bscarlet commented 10 years ago

Having gotten no response, I'm going to close this for now. Please reopen it if it resurfaces. Knowing exactly what the origin of your particular llvm is will be necessary to understand why the instruction list is out of sync. I don't get this error building against vanilla llvm, I suspect you somehow got a weird version.

abhiranjankumar00 commented 9 years ago

@bscarlet resurfaces for this repo (https://github.com/sdiehl/kaleidoscope). Had tried this on llvm-3.3 and llvm-3.4. Default install points to llvm-3.2, tried to update-alternatives few symlinks (llvm-as, llvm-config, llvm-link). Please let me know if I missed something.

Error Code:

[35 of 91] Compiling LLVM.General.Internal.FFI.Builder ( src/LLVM/General/Internal/FFI/Builder.hs, dist/dist-sandbox-f9a2b2ee/build/LLVM/General/Internal/FFI/Builder.o )

src/LLVM/General/Internal/FFI/Builder.hs:1:1:
    Exception when trying to run compile-time code:
      An AST instruction was not found in the LLVM instruction defs
    Code: do { ($)
                 liftM (concat)
                 ($)
                   sequence
                   do { let ...;
                        .... } }
cabal: Error: some packages failed to install:
llvm-general-3.4.5.3 failed during the building phase. The exception was:
ExitFailure 1
$ uname -a
Linux Vostro-2520 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
bscarlet commented 9 years ago

llvm-general-X.Y.a.b is for llvm-X.Y

It finds llvm based on the version of llvm-config on the path when it's built.

I'd recommend you build llvm from sources, set your path so your newly built llvm-config is the one found, and then build llvm-general. If that works, your original problem is somewhere outside llvm-general.