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

September 6, 2009

Running Carbon Emacs.app 22.3 on Snow Leopard

Filed under: Emacs, Mac OS X — frankoid @ 8:09 pm

Here’s how to get the Carbon GUI version of Emacs 22.3 running on Snow Leopard. It won’t compile on Snow Leopard, so you need to compile it on Leopard.

Ingredients:

  • a mac running OS X 10.5.8 with Xcode 3.1.x installed
  • a mac running OS X 10.6.0 with Xcode 3.2 installed
  • the Emacs sources, emacs-22.3.tar.gz

On the 10.5.8 mac, extract the emacs sources and compile them:

tar xzf emacs-22.3.tar.gz
cd emacs-22.3
./configure --enable-carbon-app && nice make -j2

On the 10.6 mac, copy the emacs-22.3 directory from the 10.5.8 mac and install. The path ‘/Volumes/francis’ in the commands below is my home directory on the 10.5.8 mac, which I mounted on the 10.6 mac in Finder:

ditto /Volumes/francis/Code/unmodified/emacs-22.3 emacs-22.3
cd emacs-22.3
sudo make install

You should now have a working /Applications/Emacs.app on your 10.6 (Snow Leopard) mac 🙂

October 29, 2008

Installing gcc 3.3 on Mac OS X Leopard/Intel

Filed under: Computers, Mac OS X, Software Development — frankoid @ 5:01 pm

In order to build applications that run on Mac OS versions prior to 10.3.9, you need to use gcc 3.3 (see this Apple documentation for details). This is a problem if you have an Intel Mac running Leopard, because the Xcode 2.5 installer will only allow you to install gcc 3.3 on Tiger. However, there is a way to get it to install anyway… Be warned that Apple probably had a good reason to prevent gcc 3.3 from being installed on Leopard, so this may break your system and/or the binaries that you compile. However, it did work for me and allowed me to compile a small application that ran OK on OS X 10.3.7/PPC. Here’s how to do it:

  1. Install Xcode 2.5, including the 10.3.9 SDK.
  2. Copy gcc3.3.pkg from the Packages/Packages directory in the Xcode Tools disk image to your desktop.
  3. Open the copy of gcc3.3.pkg (right click it and choose “Show Package Contents”).
  4. Open gcc3.3.pkg/Resources/VolumeCheck in a text editor.
  5. Change if( CheckVersion("$SYSTEM_VERS", "10.5", "ProductVersion", ">=" )) to if( CheckVersion("$SYSTEM_VERS", "10.6", "ProductVersion", ">=" )) and save the file.
  6. Double-click on your modified copy of gcc3.3.pkg. You will now be able to install it like any standard Installer package.
  7. “If it breaks you get to keep both pieces.”

Create a free website or blog at WordPress.com.