Home
.. Links
.. Search
.. Plugins
.. Help
.. Irc Faq

Projects
.. Platform/Faq
.. JDT/Faq/Plan
.. PDE/Faq
.. SWT/Faq
.. RCP/Faq

Tools Projects
.. CDT/Faq
.. GEF/Faq
.. EMF/Faq

Wiki Tutorials

Hosted Projects
.. MTJ
.. Google Summer Of Code 2007
.. Update Manager 2.0
.. EasyEclipse
.. Stylebase for Eclipse

Archives

CompilingSolarisX86GTK


People seem to feel it's impossible to get Eclipse 3 to compile in GTK mode on Solaris x86.

It's not. After quite a few hours of banging my head against various things, I've gotten it to compile cleanly, and with an extremely small number of changes. It turned out to be more of "what needs to be done" more than "lots of be changed".

For starters, I've done this all on Solaris 9 x86, using gcc 3.4.2 from Sunfreeware, and using JDK 1.4.2_05. I tried JDK 1.5.0_01 too, but although the build was successfully, there were many warnings and some things seemed broken. Stick with JDK 1.4.2 for now. :)

Ok, here's how to do it. We need to build Eclipse from source:

  1. Grab eclipse-sourceBuild-srcIncluded-3.0.2.zip from the local eclipse download mirror.
  2. Extract it somewhere (i.e. /tmp/install)
  3. Go into the extracted directory, you'll need to adjust the script file called "build" as it's broken for our purposes.
    Change the line "export ANT_OPTS=-Xmx1000M" to "ANT_OPTS=-Xmx1000M; export ANT_OPTS", so that bit works.
    Also, there's a big if statement at the end to reject any option combinations the script builder thinks are invalid. We need to get rid of the if statement at the end and leave:
    "ant -buildfile build.xml $target -DinstallOs=$os -DinstallWs=$ws -DinstallArch=$arch -Dbootclasspath=$bootclasspath -DjavacTarget=1.2" so that always gets run.
  4. Start the build with:
    $ sh build -os solaris -ws gtk -arch sparc

    Notice how it's got "sparc" instead of "x86"? Yep, leave it as sparc, even though we're building for x86. If you put in x86 instead, you'll get errors because it'll look for x86 versions of files that aren't there, and using "sparc" does work for us.

    It'll take a while to compile. 20+ minutes on my laptop.
  5. After this you should get a message saying the build was successful, and there will be a "result" subdirectory with a file in it called "solaris-gtk-sparc-sdk.zip". That's the main part of our Solaris x86 built Eclipse. Extract it somewhere. (i.e. /usr/local/eclipse)
  6. There are three files that we need to specifically recompile and add to the extracted zip because Eclipse will work. Go into the main Eclipse source directory we just compiled from, and then go into the plugins/platform-launcher/library/gtk/ from there. Recompile the needed file by running:
    $ sh build.sh
  7. This will create a small file called "eclipse" that is the actual main eclipse program launcher. Copy this into the directory where you extracted the compiled version of Eclipse we built (i.e. cp eclipse /usr/local/eclipse).
  8. Now we just need to recompile the Eclipse GTK shared libraries. Change to the main eclipse source directory again, then change to the plugins/org.eclipse.swt.gtk from there. Run the command:
    $ ant -buildfile build.xml build.sources
  9. This will create a bunch of zip and jar files in a subdirectory of this called ws/gtk. Copy the zip's to a temporary location, as we'll be extracting them and compile stuff from there. (i.e. mkdir /tmp/install2; cp ws/gtk/*zip /tmp/install2).
  10. Extract the contents of these zip files:
    $ unzip swt-mozillasrc.zip
    $ unzip swt-pisrc.zip
    $ unzip swtsrc.zip
  11. We need to adjust the file "make_solaris.mak" as it's missing a library path it needs on the AWT_LIBS line. Add the path "-L/usr/j2se/jre/lib/i386" to the AWT_LIBS line. It should now look like this:
    AWT_LIBS = -L$(AWT_LIB_PATH) -ljawt -shared -L/usr/j2se/jre/lib/i386
  12. Compile the new versions of the GTK libraries:
    $ sh build.sh

    I get a few warnings about gcc ignoring #pragma ident, but it doesn't seem to hurt anything. This step should complete, leaving four new library files in the directory:
    libswt-atk-gtk-3064.so
    libswt-awt-gtk-3064.so
    libswt-gtk-3064.so
    libswt-pi-gtk-3064.so
  13. Copy these files to the plugins/org.eclipse.swt.gtk_3.0.2/os/solaris/sparc/ subdirectory of the compiled Eclipse installation you extracted before. (i.e. /usr/local/eclipse/plugins/org.eclipse.swt.gtk_3.0.2/os/solaris/sparc/)
  14. That's it. If you change to the base directory of where you extracted the compiled Eclipse, it should all work fine. You launch it by running ./eclipse
  15. As a thought, I had to add /usr/local/lib to my LD_LIBRARY_PATH before Eclipse would work, because gcc expects various libraries to be in there. There's probably some way of working around this, but I haven't yet looked, being happy enough just to get things running. :)

Follow-up note

Following the above results in an Eclipse build that identifies itself as being of the "sparc" architecture, which can mess things up (i.e. when trying to use CDT). I've since been able to rebuild Eclipse 3.0.2 for Solaris GTK for x86, but it took quite a bit of time cut-n-pasting various build files and stuff. Didn't need any source code changes (just build.xml's and similar), but more than I've got time to make instructions for. If someone can tell me where to upload a tarball, I've still got the source archive handy for successfully building it from. :)


Last Modified 6/21/06 10:20 AM

Hide Tools