I would like to get Tor running on my Macbook. Unfortunately, the developers haven’t figured out how to build Universal Binaries for MacOS X yet. I’m not waiting for them. I had earlier hacked together an Intel Privoxy, so Tor shouldn’t be too hard.
The Tor configure fails because I don’t have libevent. Libevent looks very interesting. It could be a candidate for my “good” category of OSS. I might want to incorporate libevent into some shareware. I had been just linking all my libraries statically. Now that I have Universal Binaries to worry about, perhaps I should bite the bullet and figure out how to distribute dynamic libraries inside my .app packages. I also don’t want to just install it on my system because I need to test my yet-to-be-developed scheme for distributing dynamic libraries. I think it is a good idea to develop my software in the same environment in which it will be run. Yeah. I’m a wacko. Maybe when all this is done, I’ll fix my hacked-up Privoxy and submit patches to the offical Tor and Privoxy people. They seem to need to help.
Luckily, Apple has a nice technote on how to build Universal Binary configure-based open source software. It would be even nicer if it worked. Apple’s instructions will not create Universal Binary dynamic libraries.
This guy seems to know what he’s talking about. He thinks I need to download new versions of autoconf, automake, and libtool. I’m not a Linux guy so I would prefer not to muck around with my system. I keep looking and find this post. He claims to have gotten it working. He also says you can install autoconf, automake, and libtool in /usr/local. OK, I’ll do that.
I download, configure, and install autoconf, automake, and libtool. No problems.
Next, I go into my libevent directory and run:
This may not be necessary. See the next post.
Now, in theory, make should forward those “-arch” arguments on to the linker. I’m ready to re-configure. I setup some handy aliases in my bash profile for configuring and building Universal Binaries. You have to modify CFLAGS to specify that you want both the ppc and 386 architectures built. You have to add the new isysroot thingy. Finally, you have to disable the default dependency tracking to handle the new split personality nature of the object files. Here are my aliases:
alias uconfigure="env CFLAGS=\"-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc\" ./configure --prefix=/Programming/Libraries --disable-dependency-tracking"
alias umake="env CFLAGS=\"-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc\" make"
Note that I am going to install any Universal Binaries into /Programming/Libraries. That way, the system won’t see them. The only way they’ll work is if I figure out how to put them inside a .app bundle. (I hope that works or I’ll have to re-do all this.)
This is all similar to Apple’s instructions. Apple also had us munging up the LDFLAGS, turning off optimization, and turning on debug. I had read somewhere (I forget where, hence the need for this blog) that you don’t have to mess with LDFLAGS. Also, I’ll let the makefile handle optiization and debugging.
It all works. I can now build a Universal Binary libevent and Tor. Next, I’ll fix the official Tor and Privoxy packages. That will take more work. Plus I like to run Privoxy all the time. Tor messes with Privoxy’s config file. I need to figure out a way to switch between them. That’s for later.
I can now build Universal Binary dynamic libraries from OSS. I can easily install them into a hidden, but usable location. I’ve learned about libevent. Overall, a productive tangent.
PS: Today is 10-05-2006 and the blog has come in handy. I forgot how to check the executable type of a file. The above link the Apple technote helped, but, for the record, it is: