Ubuntu 9.04/9.10 Compile From Source

39 views
Skip to first unread message

Timothy Cyders

unread,
Nov 2, 2009, 5:07:37 PM11/2/09
to freemat-devel, fre...@googlegroups.com
All,

I've successfully compiled on both Ubuntu Jaunty and Karmic. The instructions for both are pretty much the same. I'll upload a simple sh file to the google group that automates as much of this as possible when I get the chance.

Step 1: Install QT4

sudo apt-get install libqt4-dev

Step 2: Install fftw and fftwf - here, you may be able to get away with installing from the repo's (sudo apt-get install libfftw3-dev), but I forgot to try before following the below instructions. Can someone try this from a fresh install?

wget http://www.fftw.org/fftw-3.2.2.tar.gz
tar xvfz fftw-3.2.2.tar.gz
cd fftw-3.2.2
mkdir build_fftw
cd build_fftw
../configure
make && sudo make install
mkdir build_fftwf
cd build_fftwf
../configure --enable-single
make && make install

Step 3: Install cmake & ccmake

sudo apt-get install cmake cmake-curses-gui

Step 4: Install other libraries

sudo apt-get install libncurses5-dev build-essential llvm-dev gfortran liblapack-dev libsuitesparse libpcre3-dev libportaudio-dev

Step 5: Download and Unpack FreeMat Source Package

cd ~
wget http://downloads.sourceforge.net/freemat/FreeMat-4.0-Source.tar.gz
tar xvfz FreeMat-4.0.1-Source.tar.gz

Step 6: Configure FreeMat


mkdir cbuild && cd cbuild

Important Note: Ubuntu Karmic has llvm 2.6 (instead of 2.5). To reflect this, replace your CMakeLists.txt file in the FreeMat-4.0.1-Source directory with the one I've uploaded to the freemat google group. I simply changed '2.5' in the file to '2.6' so it wouldn't give me any errors using the new build (otherwise the configure wont find it).

ccmake ../FreeMat-4.0.1-Source

Type 'c' (sans quotes) to configure your install. You shouldn't come up with any errors, although it does regularly warn that using compiler optimization may bork your lapack install. I ignored this. Hit 'e' to get back to the original screen, then scroll down to the option 'Force_Bundled_portaudio' and hit 'enter' to change it to 'yes'. Configure again (so it ignores the error and lets you generate your makefiles - I had to do this twice for some reason). Hit 'g' to generate your makefiles, and it should put you back at your prompt.

Step 7: Compile and Install

make
sudo make install

I used make -j8 since I have 8 cores available (if you have a dual core, you can use -j2, quad core -j4, etc.) - this speeds up the process a LOT.

That's it.

t.cy...@gmail.com

unread,
Nov 2, 2009, 5:16:00 PM11/2/09
to freemat
I just did some testing, JIT is working on the Jaunty build, but not
on Karmic, likely due to using LLVM 2.6 instead of 2.5 - looking into
this.

TJ

On Nov 2, 5:07 pm, Timothy Cyders <t.cyd...@gmail.com> wrote:
> All,
>
> I've successfully compiled on both Ubuntu Jaunty and Karmic. The
> instructions for both are pretty much the same. I'll upload a simple sh file
> to the google group that automates as much of this as possible when I get
> the chance.
>
> *Step 1: Install QT4*
>
> sudo apt-get install libqt4-dev
>
> *Step 2: Install fftw and fftwf -* here, you may be able to get away with
> installing from the repo's (*sudo apt-get install libfftw3-dev*), but I
> forgot to try before following the below instructions.* *Can someone try
> this from a fresh install?
>
> wgethttp://www.fftw.org/fftw-3.2.2.tar.gz
> tar xvfz fftw-3.2.2.tar.gz
> cd fftw-3.2.2
> mkdir build_fftw
> cd build_fftw
> ../configure
> make && sudo make install
> mkdir build_fftwf
> cd build_fftwf
> ../configure --enable-single
> make && make install
>
> *Step 3: Install cmake & ccmake*
>
> sudo apt-get install cmake cmake-curses-gui
>
> *Step 4: Install other libraries*
>
> sudo apt-get install libncurses5-dev build-essential llvm-dev gfortran
> liblapack-dev libsuitesparse libpcre3-dev libportaudio-dev
>
> *Step 5: Download and Unpack FreeMat Source Package*
>
> cd ~
> wgethttp://downloads.sourceforge.net/freemat/FreeMat-4.0-Source.tar.gz
> tar xvfz FreeMat-4.0.1-Source.tar.gz
> *
> Step 6: Configure FreeMat*
>
> mkdir cbuild && cd cbuild
>
> *Important Note: Ubuntu Karmic has llvm 2.6 (instead of 2.5). To reflect
> this, replace your CMakeLists.txt file in the FreeMat-4.0.1-Source directory
> with the one I've uploaded to the freemat google group. I simply changed
> '2.5' in the file to '2.6' so it wouldn't give me any errors using the new
> build (otherwise the configure wont find it).*
>
> ccmake ../FreeMat-4.0.1-Source
>
> Type 'c' (sans quotes) to configure your install. You shouldn't come up with
> any errors, although it does regularly warn that using compiler optimization
> may bork your lapack install. I ignored this. Hit 'e' to get back to the
> original screen, then scroll down to the option 'Force_Bundled_portaudio'
> and hit 'enter' to change it to 'yes'. Configure again (so it ignores the
> error and lets you generate your makefiles - I had to do this twice for some
> reason). Hit 'g' to generate your makefiles, and it should put you back at
> your prompt.
>
> *Step 7: Compile and Install*

Garystar

unread,
Nov 2, 2009, 8:15:07 PM11/2/09
to freemat
Tim,

1) The command "sudo apt-get install libfftw3-dev" worked just fine.
I upgraded to Karmic last week and I had to do a complete, fresh
install. So it would appear that that works just fine.

2) On the command for "Install other libraries", I got an error for
the "libsuitesparse". I looked around and found a package for
"libsuitesparse-dev" instead and used that. It appeared to work.
Tell me if that's not right.

3) Couldn't find your Cmake.txt file, so I simply opened the one in
the FreeMat source and changed all of the "2.5"s that were in the LLVM
section to "2.6".

4) When I did the "make" command, I got the following error(s):

[ 1%] Built target portaudio
[ 5%] Built target FreeMatlib
[ 5%] Building CXX object libs/libGraphics/CMakeFiles/Graphics.dir/
HandleWindow.cpp.o
In file included from /usr/include/llvm/Attributes.h:18,
from /usr/include/llvm/Argument.h:18,
from /usr/include/llvm/Function.h:23,
from /usr/include/llvm/Module.h:18,
from /home/gary/Downloads/FreeMat-4.0.1-Source/libs/
libMatC/JIT.hpp:32,
from /home/gary/Downloads/FreeMat-4.0.1-Source/libs/
libFreeMat/FunctionDef.hpp:30,
from /home/gary/Downloads/FreeMat-4.0.1-Source/libs/
libFreeMat/Context.hpp:26,
from /home/gary/Downloads/FreeMat-4.0.1-Source/libs/
libGraphics/HandleAxis.hpp:30,
from /home/gary/Downloads/FreeMat-4.0.1-Source/libs/
libGraphics/HandleWindow.cpp:20:
/usr/include/llvm/Support/MathExtras.h: In function ‘bool llvm::isInt
(int64_t)’:
/usr/include/llvm/Support/MathExtras.h:57: error: there are no
arguments to ‘INT64_C’ that depend on a template parameter, so a
declaration of ‘INT64_C’ must be available
/usr/include/llvm/Support/MathExtras.h:57: note: (if you use ‘-
fpermissive’, G++ will accept your code, but allowing the use of an
undeclared name is deprecated)
/usr/include/llvm/Support/MathExtras.h:57: error: there are no
arguments to ‘INT64_C’ that depend on a template parameter, so a
declaration of ‘INT64_C’ must be available
/usr/include/llvm/Support/MathExtras.h: In function ‘bool llvm::isUint
(uint64_t)’:
/usr/include/llvm/Support/MathExtras.h:62: error: there are no
arguments to ‘UINT64_C’ that depend on a template parameter, so a
declaration of ‘UINT64_C’ must be available
make[2]: *** [libs/libGraphics/CMakeFiles/Graphics.dir/
HandleWindow.cpp.o] Error 1
make[1]: *** [libs/libGraphics/CMakeFiles/Graphics.dir/all] Error 2
make: *** [all] Error 2

If you have any suggestions for how I can complete this, I'd very much
appreciate it! And thanks for putting this together! I hope to do
some more work on the Freemat Primer when I get the chance between
classes.

Thanks, again!

Gary

On Nov 2, 5:07 pm, Timothy Cyders <t.cyd...@gmail.com> wrote:
> All,
>
> I've successfully compiled on both Ubuntu Jaunty and Karmic. The
> instructions for both are pretty much the same. I'll upload a simple sh file
> to the google group that automates as much of this as possible when I get
> the chance.
>
> *Step 1: Install QT4*
>
> sudo apt-get install libqt4-dev
>
> *Step 2: Install fftw and fftwf -* here, you may be able to get away with
> installing from the repo's (*sudo apt-get install libfftw3-dev*), but I
> forgot to try before following the below instructions.* *Can someone try
> this from a fresh install?
>
> wgethttp://www.fftw.org/fftw-3.2.2.tar.gz
> tar xvfz fftw-3.2.2.tar.gz
> cd fftw-3.2.2
> mkdir build_fftw
> cd build_fftw
> ../configure
> make && sudo make install
> mkdir build_fftwf
> cd build_fftwf
> ../configure --enable-single
> make && make install
>
> *Step 3: Install cmake & ccmake*
>
> sudo apt-get install cmake cmake-curses-gui
>
> *Step 4: Install other libraries*
>
> sudo apt-get install libncurses5-dev build-essential llvm-dev gfortran
> liblapack-dev libsuitesparse libpcre3-dev libportaudio-dev
>
> *Step 5: Download and Unpack FreeMat Source Package*
>
> cd ~
> wgethttp://downloads.sourceforge.net/freemat/FreeMat-4.0-Source.tar.gz
> tar xvfz FreeMat-4.0.1-Source.tar.gz
> *
> Step 6: Configure FreeMat*
>
> mkdir cbuild && cd cbuild
>
> *Important Note: Ubuntu Karmic has llvm 2.6 (instead of 2.5). To reflect
> this, replace your CMakeLists.txt file in the FreeMat-4.0.1-Source directory
> with the one I've uploaded to the freemat google group. I simply changed
> '2.5' in the file to '2.6' so it wouldn't give me any errors using the new
> build (otherwise the configure wont find it).*
>
> ccmake ../FreeMat-4.0.1-Source
>
> Type 'c' (sans quotes) to configure your install. You shouldn't come up with
> any errors, although it does regularly warn that using compiler optimization
> may bork your lapack install. I ignored this. Hit 'e' to get back to the
> original screen, then scroll down to the option 'Force_Bundled_portaudio'
> and hit 'enter' to change it to 'yes'. Configure again (so it ignores the
> error and lets you generate your makefiles - I had to do this twice for some
> reason). Hit 'g' to generate your makefiles, and it should put you back at
> your prompt.
>
> *Step 7: Compile and Install*
>

Timothy Cyders

unread,
Nov 2, 2009, 10:40:30 PM11/2/09
to fre...@googlegroups.com
Gary,

As a quick check, in ccmake go to the option to use llvm and switch it to 'no', reconfigure and make. Let me know if that fixes the problem. I'll poke around a bit to see if I can come up with anything else. And libsuitesparse-dev should work just fine (it's just the development branch of the same libraries). I haven't uploaded a txt file because I still don't have the JIT compiler working in my successfully-built FreeMat on Karmic (works just fine in Jaunty).

A side note, I did install the llvm 2.5 release in Karmic and successfully compiled with that, but JIT still doesn't work.

TJ

Chuong

unread,
Nov 3, 2009, 7:07:59 AM11/3/09
to freemat
Hi Timothy and Gary,

How do you install llvm 2.5 on Karmic?

I installed it on Karmic using Jaunty's deb files. Original Freemat
4.0* source compiled without problems. My test shows that JIT works:

--> jitcontrol off, tic, for ii=1:1000000, jj=ii+1000; end, toc
ans =
10.0890
--> jitcontrol on, tic, for ii=1:1000000, jj=ii+1000; end, toc
ans =
0.3170
-->

Chuong

On Nov 3, 2:40 pm, Timothy Cyders <t.cyd...@gmail.com> wrote:
> Gary,
>
> As a quick check, in ccmake go to the option to use llvm and switch it to
> 'no', reconfigure and make. Let me know if that fixes the problem. I'll poke
> around a bit to see if I can come up with anything else. And
> libsuitesparse-dev should work just fine (it's just the development branch
> of the same libraries). I haven't uploaded a txt file because I still don't
> have the JIT compiler working in my successfully-built FreeMat on Karmic
> (works just fine in Jaunty).
>
> A side note, I did install the llvm 2.5 release in Karmic and successfully
> compiled with that, but JIT still doesn't work.
>
> TJ
>

Timothy Cyders

unread,
Nov 3, 2009, 12:47:09 PM11/3/09
to fre...@googlegroups.com
Chuong,

that's how I had installed it (with Jaunty's debs). I will go back and recompile for a test, now that I have a bunch of work behind me.

TJ

Garystar

unread,
Nov 3, 2009, 12:54:20 PM11/3/09
to freemat
Thanks, Tim & Chuong.

I set USE_LLVM to OFF in the cmake file. That let me generate the
make files. I was then able to both make and make install FreeMat 4.0
under my Ubuntu Karmic. It's up and running now. Don't know about
the JIT controls. I'm testing some of my simpler scripts and
functions. I'll report back later. Right now, I have a homework
assignment to finish and, if all goes well, I'll be using the new
FreeMat to do it!

NOTE: I looked through the Debian repositories and all I found there
for "stable" packages was llvm-2.2. I've not looked through Jaunty's
deb files. Frankly, I wouldn't even know how or where to look for
that. But, hey, I'm up and running!

Thanks again!

Gary

Timothy Cyders

unread,
Nov 3, 2009, 12:57:26 PM11/3/09
to fre...@googlegroups.com

https://launchpad.net/ubuntu/jaunty/i386/llvm/2.5-0ubuntu1

Download the deb here. There are links to the rest of the llvm packages in there. This is assuming your'e using i386. I've been able to compile on AMD64 as well.

TJ

Timothy Cyders

unread,
Nov 3, 2009, 2:41:21 PM11/3/09
to fre...@googlegroups.com
Just ran a test on JIT using Jaunty's llvm 2.5 packages (needed both llvm and llvm-dev, make sure to install them in that order). It does indeed work just fine:


--> jitcontrol off,  tic, for ii=1:1000000, jj=ii+1000; end, toc
ans =
    6.3960

--> jitcontrol on,  tic, for ii=1:1000000, jj=ii+1000; end, toc
ans =
    0.0420

Gary, download these deb files (assuming you're using i386 - if you're using amd64, just switch 'i386' in the url to 'amd64'), remove llvm*, install the llvm deb, then the llvm-dev deb (if you do llvm-dev first, it will install the 2.6 libraries from the repo). Totally delete your freemat source tree and unpack a fresh start (no changes to the CMakeLists.txt file), then just ccmake, generate your code, and make. See if that works. I was having some compiling issues too, so I just blew away the source directory and started fresh - worked right out of the box.

TJ

Timothy Cyders

unread,
Nov 3, 2009, 2:42:33 PM11/3/09
to fre...@googlegroups.com

Garystar

unread,
Nov 3, 2009, 3:54:59 PM11/3/09
to freemat
That did it! I deleted the source directory and re-installed fresh
from the tar.gz file. I then downloaded and installed the llvm-dev
file. I was able to walk through all of the original steps without
any problem. It's now installed on my system and JIT appears to work
just fine. And since we're comparing results, here's mine:

--> jitcontrol off, tic, for ii=1:1000000, jj=ii+1000; end, toc
ans =
14.1600
--> jitcontrol on, tic, for ii=1:1000000, jj=ii+1000; end, toc
ans =
0.0270

Thanks, again, all (especially Tim!) for the help. Now I can finish
this homework assignment and use Freemat 4.0 on Ubuntu to do it.

Gary

On Nov 3, 2:42 pm, Timothy Cyders <t.cyd...@gmail.com> wrote:
> Forgot the links -
>
> i386:
>
> https://launchpad.net/ubuntu/jaunty/i386/llvm/2.5-0ubuntu1https://launchpad.net/ubuntu/jaunty/i386/llvm-dev
>
> AMD64:
>
> https://launchpad.net/ubuntu/jaunty/amd64/llvm/2.5-0ubuntu1https://launchpad.net/ubuntu/jaunty/amd64/llvm-dev

Garystar

unread,
Nov 3, 2009, 4:01:26 PM11/3/09
to freemat
Ooooh, that JIT is DEFINITELY a boost in computational speed! Just
ran one of my functions that typically takes about 2 seconds. Now,
I'll swear it's giving me an answer before I finish pushing the
"Enter" key.

Sweeeeeeet!

Gary

Chuong

unread,
Nov 3, 2009, 8:54:23 PM11/3/09
to freemat
One more thing to do is to prevent Karmic automatically replaces llvm
2.5 with 2.6 version when updating your machine, in Synatic Package
Manager you need to select the installed llvm and llvm-dev 2.5
packages, go to "Package" menu and choose "Lock version".

Chuong

Garystar

unread,
Nov 5, 2009, 11:22:51 AM11/5/09
to freemat
Once Freemat is installed, does it matter if llvm is replaced? Does
it use llvm during the running of the program, or is it just used to
create the executable?

Gary

Timothy Cyders

unread,
Nov 5, 2009, 1:16:46 PM11/5/09
to fre...@googlegroups.com
Even though I had set synaptic to lock llvm at version 2.5, I did a sudo apt-get upgrade and it upgraded to 2.6. My FreeMat install seems unfazed tho, no problems that I can see, with JIT or otherwise. Pretty sure it only matters at compile time, but I could be wrong.

TJ

Chuong

unread,
Nov 6, 2009, 1:57:15 AM11/6/09
to freemat
To Gary: You have a good point. I looked into AllVariables.txt and
find this line which seems to say Freemat is compiled with llvm static
library:
LLVM_LIBS "/usr/lib/llvm/lib/libLLVMInstrumentation.a;/usr/lib/llvm/
lib/libLLVMipo.a;/usr/lib/llvm/lib/LLVMX86CodeGen.o;/usr/lib/llvm/lib/
libLLVMSelectionDAG.a;/usr/lib/llvm/lib/libLLVMAsmPrinter.a;/usr/lib/
llvm/lib/LLVMExecutionEngine.o;/usr/lib/llvm/lib/LLVMJIT.o;/usr/lib/
llvm/lib/libLLVMCodeGen.a;/usr/lib/llvm/lib/libLLVMScalarOpts.a;/usr/
lib/llvm/lib/libLLVMTransformUtils.a;/usr/lib/llvm/lib/libLLVMipa.a;/
usr/lib/llvm/lib/libLLVMAnalysis.a;/usr/lib/llvm/lib/libLLVMTarget.a;/
usr/lib/llvm/lib/libLLVMCore.a;/usr/lib/llvm/lib/libLLVMSupport.a;/usr/
lib/llvm/lib/libLLVMSystem.a"

So external llvm libraries are required during compiling only.

To Timothy: Sorry I was wrong. "Lock Version" should be chosen instead
of "Force Version". When applied "Lock version" , both "Install
Version" and "Latest Version" columns should show "2.5-0ubuntu1" and
llvm packages are highlighted red.

From my past impression, there were big changes between llvm versions.
This is why FreeMat 4.0 requires exactly llvm 2.5. You have compiled
using llvm 2.6 without compiling problems so probably there are not
many API changes this time. However you said JIT didn't work when
compiled with llvm 2.6. I hope Samit and Eugene will soon update
FreeMat so we have no significant problem to install it on the next
LTS Ubuntu version.

Cheers,
Chuong


On Nov 6, 5:16 am, Timothy Cyders <t.cyd...@gmail.com> wrote:
> Even though I had set synaptic to lock llvm at version 2.5, I did a sudo
> apt-get upgrade and it upgraded to 2.6. My FreeMat install seems unfazed
> tho, no problems that I can see, with JIT or otherwise. Pretty sure it only
> matters at compile time, but I could be wrong.
>
> TJ
>
Reply all
Reply to author
Forward
0 new messages