[Gambas-user] llvm compiling - how to (your millage may vary)
The Phantomgraph };8>
phantomgraph at ...626...
Tue Nov 27 07:02:09 CET 2012
Hey All,
I run Ubuntu 11.10 and I was able to get llvm compiled and
subsequently Gambas 3-3.3.3 with the gb.jit component. I did have a
lot of trouble, mostly figuring out how to get llvm to compile with
the options I needed so that it would have all the stuff for Gambas...
I hope I haven't forgotten any steps...
0-----=^=-----0
If you have any of the packages for llvm installed first remove them
all with yum or apt-get or whatever you use for your flavor of Linux.
If you compiled, make uninstall and delete the llvm source directory.
Next down load LLVM 3.1 from the website =>
http://llvm.org/releases/download.html#3.1
While you are at it I grabbed CLang and the Compiler RT sources.
I hate screaming but : DO NOT FOLLOW THE INSTRUCTIONS IN THE
DOCUMENTATION FOR COMPILING LLVM. IT WILL NOT WORK. The docs are
rather old and assume you have your environment set up in a certain
way so I had to figure it out by trial and error. Don't use symbolic
links instead of renaming the directories and don't use their method
of creating a build directory within the llvm directory to compile.
To let you know I believe the reason why you have to do things as
follows is because of the way the environment is set up. (Not sure,
don't care, it works for me =)
1) Unpack LLVM 3.1 then rename the directory llvm_3.1 (You will notice
a pattern with renaming stuff, this is part of what is wrong with the
documentation / the environment.) If it isn't already, move the
llvm_3.1 directory to your HOME directory aka ~/
*NOTE: A friend of mine could only compile from ~/llvm but I used
~/llvm_3.1 just fine on at least 2 machines.
2) Unpack Clang then rename the directory clang then move the clang
directory to ~/llvm_3.1/tools
3) Unpack Compiler RT then rename the directory compiler-rt then move
the directory to ~/llvm_3.1/projects
4) cd to ~/llvm_3.1
5) Enter the following command to configure and get some coffee. :
./configure --enable-optimized --enable-jit --enable-shared
This will build llvm , Clang and the jit compiler WITH the .so
files (shared object or dynamic libraries) you need to compile Gambas
:)
6) Now you can make. To speed it up a bit use : make -j4
Replace the 4 with the number of processors you have in the
machine. (I have an i5 so 4 is what I used) You may now cross your
fingers, pray, sacrifice a chicken or what ever you normally do while
compiling. ;p
7) If everything worked out O.K. it's : make install
8) Test out your installation by trying this : clang --version
You should see the following ---
clang version 3.1 (branches/release_31)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Obviously what your looking for is the clang version Your target
and thread model will vary depending on your system. (aka non 64 bit
processors so on)
9) If it fails for some reason you can use : make clean OR make
dist-clean and try again (I recommend starting with rm -rf /llvm_3.1 )
10) Now ./reconf-all Gambas and so on. (Note: you can use the make -j#
trick with Gambas as well)
11) If all goes well you should have your gb-jit component.
Here is a quick diagram of where things should go (I'm not putting all
the directories in obviously.)
~/llvm_3.1/tools/clang
~/llvm_3.1/projects/compiler-rt
Protip: The llvm sources takes up quite a bit of hard drive space on
my lap top. Once I had it compiled and installed I b-ziped the llvm
directory up and chucked it in a backup in case I ever need to make
uninstall or play around with adding components to it later.
Good luck, hope this works for you all! (And I haven't forgotten anything) :p
--
------------------------------------
The Phantomgraph };8>
More information about the User
mailing list