Compiling JavaHL On Mac OS X

April 17, 2007 CollabNet VersionOne

 

Usually compiling JavaHL is pretty simple: just follow the directions
mentioned in the source code. Not on OS X though, there is an anomaly on
OS X when running "make javahl" or "make
install-javahl". When you run these make targets on OS X, you get
output like this:

ld: multiple definitions of symbol ___divdi3
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libgcc.a(_divdi3.o) private external definition of
___divdi3 in section (__TEXT,__text)
/usr/lib/libgcc_s.10.4.dylib(_divdi3_s.o) definition of ___divdi3
ld: multiple definitions of symbol ___udivdi3
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libgcc.a(_udivdi3.o) private external definition of
__udivdi3 in section (__TEXT,__text)
/usr/lib/libgcc_s.10.4.dylib(_udivdi3_s.o) definition of ___udivdi3
ld: multiple definitions of symbol ___umoddi3
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of
___umoddi3 in section (__TEXT,__text)
/usr/lib/libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3
/usr/bin/libtool: internal link edit command failed
make: *** [subversion/bindings/java/javahl/native/libsvnjavahl-1.la] Error 1

After digging around, I finally joined the #fink irc channel on
irc.freenode.net and started asking questions (I heard they had a working
script to compile the JavaHL bindings.) After talking to a few people in
#fink, they passed me this nice little snippet that fixed the problem:

perl -pi -e "s/-all_load//g" libtool

The above Perl call removes the "-all_load" flag from libtool to
work around a libtool issue on the Mac. Going into deeper detail is really
a libtool matter and I’ll omit that here but let me give you a little cheat sheet for building the JavaHL bindings from
scratch. Here are the brief steps:

  1. Download Subversion source.
  2. Change directory to where you downloaded the Subversion source.
  3. Run "./autogen.sh".
        
  4. Run "./configure <your_flags>". 
  5. Run "make". 
  6. Run "perl -pi -e  "s/-all_load//g" libtool". 
  7. Run "make javahl".
        
  8. Run "make install-javahl".

If you follow the steps above, you’ll have a working JavaHL
installation on your OS X system.  Enjoy.

Previous Article
Subversion Repository Layout

I see a lot of questions asked about “What is the recommended repository layout?”, “What does trunk mean?”,...

Next Article
How Subversion conserves disk space

I wanted to share something from our March openCollabNet Technical Newsletter. If you do not get our newsle...