Francis Devereux

February 15, 2010

Quick Recipe for Building Universal jsvc on OS X 10.5

Filed under: Java, Mac OS X — frankoid @ 4:52 pm

Edit: Now that commons-daemon 1.0.2 has been released and included in MacPorts, an easier way of building a universal jsvc is to install MacPorts, set universal_archs to “i386 x86_64” in macports.conf and run “sudo port install commons-daemon +universal”.

Here’s how to build Apache jsvc (commons-daemon) on OS X 10.5 so that it is capable of launching Java 1.5 32 bit, 1.5 64 bit or 1.6 64 bit.  This post is mainly for my own reference, so it hasn’t been tested thoroughly…

First, get the latest commons-daemon code from svn (the 1.0.1 release won’t work – you need the fix for this):

svn co http://svn.apache.org/repos/asf/commons/proper/daemon/trunk commons-daemon-trunk

Now the recipe:

cd commons-daemon-trunk/src/native/unix/
autoconf
CFLAGS="-g -O2 -arch i386 -arch x86_64" LDFLAGS="-arch i386 -arch x86_64" ./configure
make
sudo cp jsvc <prefix>/bin/

This jsvc will start a 64-bit JVM by default.  To run a 32 bit JVM, do

arch -i386 jsvc <jsvc args>

or, if you are using tomcat6 from MacPorts and have the universal jsvc in /opt/local/bin:

JSVC_ENV="arch -i386" tomcatctl start
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: