STEEVdotnet Random ramblings, sometimes talk about Gentoo development

5Apr/098

Running Titanium on Gentoo

(This assumes an x86 system - although ppc also works as long as you replace all the so files!)
In order to get Titanium working on Gentoo, you will need to build a few things yourself since they don't have a patch for webkit (yet - they are working on it :) ) and also a few other files will need to be replaced.

This is how I did it. First I checked out the titanium git repository

cd ~/sandbox
git clone git://github.com/marshall/titanium.git
git submodule update --init
cd kroll
git pull origin master
cd ~/sandbox

I read through the readme, and installed the different dependencies.
sudo apt-get install build-essential ruby rubygems libzip-ruby scons libxml2-dev libgtk2.0-dev python-dev ruby-dev libdbus-glib-1-dev libnotify-dev libgstreamer0.10-dev libxss-dev libcurl4-openssl-dev
is their suggestion, however on Gentoo, these are a lot different.

I found that libzip-ruby (rubyzip?) was not needed, and on Gentoo installing the packages themselves gives you the "dev" packages, so

emerge ruby rubygems scons libxml2 gtk+ dbus-glib libnotify gstreamer libXScrnSaver curl gperf

Once this is finished, you will have to do a little bit more work - We don't need poco installed, but we will need to compile it ourselves, along with the titanium version of webkit (they've got it "patched" to support app:// urls - no actual patch yet (but they are working on it!))

We also need to use their version of libcurl, which is also patched, however again, we don't need to install it to our system, just build it.

git clone git://github.com/mrobinson/libcurl_titanium.git
after the checkout, we just ./configure && make

Now we need to check out their copy of webkit, please note that this one WILL take a while to check out, so go grab a coffee, watch a good TV show, or perhaps hit the pub with some friends (I prefer the latter)
git clone git://github.com/marshall/webkit_titanium.git
... some random amount of time later...
git checkout --track -b titanium_pr2 origin/titanium_pr2

Now we are on the titanium_pr2 branch, which is what is currently in use, although they are migrating to ToT for WebKit which will allow us to use libsoup in the future, rather than the curl that is currently in use.

We need to link against the libcurl_titanium and not against the system libcurl, so we need to export 2 variables.

export LIBCURL_CFLAGS ="-I/home/username/sandbox/libcurl_titanium/include"
export LIBCURL_LIBS ="-L/home/username/sandbox/libcurl_titanium/lib/.libs -lcurl"

and then we just use the build.py script to build since we won't be installing this into the system either. so...
./autogen.sh
./build.py

Depending on your processor (this takes around 15 hours on my Efika which is 400mhz with 128mb of ram) go ahead and go back to the pub, go to work, cook yourself a nice meal... you get the picture.
Once it is finished, assuming the titanium checkout is in ~/sandbox/titanium and the webkit_titanium checkout is in ~/sandbox/webkit_titanium you just run ./copy-libs-to-kroll.sh

Now we need to build poco, you can either emerge it, or just fetch it via emerge, and build it in your ~/sandbox (or wherever you are doing this at) once it is built (it really doesn't take that long) you need to copy the .so files to ~/sandbox/titanium/kroll/thirdparty/linux/poco/lib/ - you can look at what is currently in there to know which files to copy. I tend to use cp -a so that the symlinks stay symlinks. You need to copy the libcurl .so files that were built in ~/sandbox/libcurl_titanium/lib/.libs into ~/sandbox/titanium/kroll/thirdparty/linux/libcurl/lib - again just the files that are needed.

As part of building webkit (assuming you didn't have it installed on your system, you need to build icu, currently 3.8.1-r1 is the latest in portage, which is what is currently used in titanium as well.

I've submitted a few patches that have already been implemented to allow for the different paths for python and ruby that Gentoo uses, so at this point you should be able to go into ~/sandbox/titanium and run scons debug=1 dist and it should build. Once the compilation is completed, you should have a ~/sandbox/titanium/build/linux/dist directory which includes the titanium sdk as a .bin file as well as a .tgz file. Simply run either sudo sh titanium-sdk-0.4.bin or chmod +x titanium-sdk-0.4.bin && sudo ./titanium-sdk-0.4.bin in order to install it.

Please note - at the time of this writing, PR3 has been released, and the current master is what PR4 (or beta) is going to be based on. This is *very* much in flux, and it may be hit or miss on compiling and/or installing. Currently when installed (which needs to be done as root) the files do not all get the proper permissions, and you will likely need to go into /opt/titanium/modules and change all the .so files to be 755 and all the manifest files to 644. There may be others as well, but I cannot recall at the moment.

As a side note: if you want to use what is known as the PR3 release, you can (and probably should) use checkout --track -b titanium_pr3 origin/titanium_pr3 inside ~/sandbox/titanium as well as making sure to switch to the titanium_pr3 branch in kroll if you do that. (but why would we? We're Gentoo users, we like bleeding edge ;) )

At this point you have a working Titanium Developer that you can run via the console ~/TitaniumApps/Titanium\ Developer/Titanium\ Developer

Enjoy writing webapps that don't require Adobe Air!

Also, if you find any issues with this post please leave a comment and I will try to get it corrected as soon as possible.

Filed under: General Leave a comment
Comments (8) Trackbacks (0)
  1. hello,steev

    I’m trying to build titanium on my system(amd64),
    the compilation is successfull but, I got a segment fault on execution.

    When I look at the libs with the ld command,
    it returns:


    ld: warning: libkroll.so, needed by libapimodule.so, not found (try using -rpath or -rpath-link)

    Can you help me please.

    Thanks,
    luiz

  2. Hi Luiz,

    Unfortunately, I have no experience installing it on an amd64 machine. Did you run the installer, or is it already installed? I do know that the amd64 portion may not be completely finished just yet, so there is also that possibility… Did you rebuild all the libraries yourself and copy them in?

  3. @steev
    Hello Steev,

    Running the installer I get a segment fault too.

    I will try to rebuild the libraries and tell you the result. So thanks, and thanks too for this great tutorial.;)

  4. @luiz aoki
    opps, I forgot:

    I dont have the titanium installed. (*^-^*)

  5. Yeah, I figured you didn’t have it installed – Unfortunately I don’t have access to an amd64 machine with Gentoo (or any linux for that matter) installed so I haven’t had a chance to look (mainly due to lack of a wireless card) at getting Titanium going on a 64bit machine. Please keep in mind that latest git is definitely in flux for Titanium and it may not build and/or work on any given commit :)

  6. Hello Steev, I’m tryied to rebuild all the libs, and use the pr3 version, but
    got the same segment fault problem, as you write probably are a problem at amd64.
    I take to wait another version for now. Werever thankyou very much for the help.

    My best regards,

    Luiz
    P.S If I have any progress about, I write here ;)

  7. If you use IRC, you can also join #titanium_app on irc.freenode.net – thats where a lot of titanium users (and the devs) hang out at – perhaps someone there can offer some insight – by the way, would it be possible for you to get a backtrace from the segfault?

  8. (11:23:24 AM) Steev: do me a favor
    (11:23:25 AM) Me: The Apple USB charger is 1000mA?!
    (11:23:28 AM) Steev: go leave a comment on my blog.


Leave a comment


No trackbacks yet.