sdiehl / kaleidoscope

Haskell LLVM JIT Compiler Tutorial
http://www.stephendiehl.com/llvm
Other
1.03k stars 131 forks source link

can't compile chapters 3, 4, ... #3

Closed osa1 closed 10 years ago

osa1 commented 10 years ago
➜  kaleidoscope git:(master) ✗ make chapter3
ghc -no-user-package-db -package-db .cabal-sandbox/*-packages.conf.d --make src/chapter3/*.hs -o chapter3
[5 of 6] Compiling Emit             ( src/chapter3/Emit.hs, src/chapter3/Emit.o )

src/chapter3/Emit.hs:99:14: Not in scope: `moduleString'
make: *** [chapter3] Error 1
➜  kaleidoscope git:(master) ✗ make chapter4
gcc -fPIC -shared src/chapter4/cbits.c -o src/chapter4/cbits.so
ghc -no-user-package-db -package-db .cabal-sandbox/*-packages.conf.d src/chapter4/cbits.so --make src/chapter4/*.hs -o chapter4
[4 of 7] Compiling JIT              ( src/chapter4/JIT.hs, src/chapter4/JIT.o )

src/chapter4/JIT.hs:46:16: Not in scope: `moduleString'
make: *** [chapter4] Error 1
➜  kaleidoscope git:(master) ✗ make chapter5
gcc -fPIC -shared src/chapter5/cbits.c -o src/chapter5/cbits.so
ghc -no-user-package-db -package-db .cabal-sandbox/*-packages.conf.d src/chapter5/cbits.so --make src/chapter5/*.hs -o chapter5
[1 of 7] Compiling Lexer            ( src/chapter5/Lexer.hs, src/chapter5/Lexer.o )
[2 of 7] Compiling Syntax           ( src/chapter5/Syntax.hs, src/chapter5/Syntax.o )
[3 of 7] Compiling Parser           ( src/chapter5/Parser.hs, src/chapter5/Parser.o )
[4 of 7] Compiling JIT              ( src/chapter5/JIT.hs, src/chapter5/JIT.o )

src/chapter5/JIT.hs:46:16: Not in scope: `moduleString'
make: *** [chapter5] Error 1
➜  kaleidoscope git:(master) ✗ make chapter6
gcc -fPIC -shared src/chapter6/cbits.c -o src/chapter6/cbits.so
ghc -no-user-package-db -package-db .cabal-sandbox/*-packages.conf.d src/chapter6/cbits.so --make src/chapter6/*.hs -o chapter6
[1 of 7] Compiling Lexer            ( src/chapter6/Lexer.hs, src/chapter6/Lexer.o )
[2 of 7] Compiling Syntax           ( src/chapter6/Syntax.hs, src/chapter6/Syntax.o )
[3 of 7] Compiling Parser           ( src/chapter6/Parser.hs, src/chapter6/Parser.o )
[4 of 7] Compiling JIT              ( src/chapter6/JIT.hs, src/chapter6/JIT.o )

src/chapter6/JIT.hs:46:16: Not in scope: `moduleString'
make: *** [chapter6] Error 1
➜  kaleidoscope git:(master) ✗ 
sdiehl commented 10 years ago

This is from llvm-general API change that is backwards incompatable, I made the required version (3.3.8.2) explicit in the cabal file on master.

See: https://github.com/sdiehl/kaleidoscope/issues/2

osa1 commented 10 years ago

but now it requires LLVM 3.3...

sdiehl commented 10 years ago

You're on your own if you want use versions other than what the tutorial instructs you to use. In practice I think the only difference is the name change from moduleString to moduleLLVMAssembly but I haven't tested it against the other versions of the bindings.

I'll take a look to see if the changes are trivial, if so I'll add a note about 3.4 compatibility.

sdiehl commented 10 years ago

Should work on both 3.3 and 3.4 now.