[MLton] fun with ranlib

Filip Pizlo pizlo@purdue.edu
Wed, 15 Sep 2004 15:25:08 -0500 (EST)


It turns out that Mac OS X is making things *extremely* difficult because
of the semantics of ar and ranlib.  When I was building things
more-or-less manually on my Mac, things more or less worked.  But now I'm
finding that there are some weird issues when I build using the top-level
Makefile.

The problem is that runtime/*.a is copied to build/lib/<blah>, where
<blah> is usually self.  But on Mac OS X, after you do this copy, you have
to rerun ranlib!

My solution for now is to add a loop that runs ranlib for
build/lib/<blah>/*.a after *.a is copied there in the runtime target of
the top-level Makefile.  However, I'm wondering what, exactly, has to be
done for this to be cross-compile-friendly.  Any thoughts?

(By the way, the really bad part is that this error was coming up in the
following weird way: upgrade-basis is the first thing that 'make
all-no-docs' does that requires linking to work.  However, upgrade-basis
simply assumes that an error in running mlton means that upgrade-basis.sml
needs to contain the inputLine and readDir definitions.  From there, the
build blows up with a completel non-intuitive error.  So, I have modified
upgrade-basis to first do a sanity-check build to verify that mlton works
at all before generating any code.)

--
Filip Pizlo
http://bocks.psych.purdue.edu/
pizlo@purdue.edu