mit-scheme-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MIT-Scheme-devel] Attempted Clean-up of Mac OS X MIT Scheme Port


From: Aaron Hsu
Subject: [MIT-Scheme-devel] Attempted Clean-up of Mac OS X MIT Scheme Port
Date: Sun, 19 Nov 2006 20:20:19 -0600
User-agent: IMAIL/1.21; Edwin/3.116; MIT-Scheme/7.7.90.+

Hello All,

I have been making some attempt at fixing some of the annoyances
within the Mac OS X port of MIT Scheme. So far, I have been able to
mostly eliminate the errors that occur during compile time, but not in
the most clean manner I could. I am hoping that some peopl will have
some better ideas for fixing the issues, but I'm going to send these
to this list anyways, in hopes that someone might find them useful.
All the diffs are applied against the latest CVS and I did update my
microcode directory to the pre-v15 branch. I don't think this will
make any difference for this though.

PREREQUISITES 

Before anything can really happen, I made sure my environment was
setup up specifically. The reason for this is that I have still not
found a decent way around the rather kudgy library detection used in
the autoconf scripts. I had the most problems with postgresql and db
not being detected. 

I installed MacPorts on my computer first, and then proceeded to
install the following pieces of software:

  - mhash
  - libmcrypt
  - gdbm
  - postgresql81
  - db44

Now, MacPorts doesn't install the binaries for postgresql in any
reasonable location, but since I bypassed the PQ_INCLUDE detection
used in the configure.ac file of the microcode, I decided not to worry
about it. (A solution really ought to be found for that script that
does not require a hard coded path like /usr/bin/pg_config.)

Next I configured CPATH and LIBRARY_PATH environment variables as
follows:

CPATH="/opt/local/include:/opt/local/include/postgresql81:/opt/local/include/db44:/usr/include:/usr/local/include:/usr/X11R6/include"

LIBRARY_PATH="/opt/local/lib:/opt/local/lib/postgresql81:/opt/local/lib/db44:/usr/lib:/usr/local/lib:/usr/X11R6/lib"

This is to fix the problem with autoconf not finding the header files
for db and postgresql in their respective subdirectories. This is a
problem I have not figured out how to fix yet.

I also have done all my compiling and configuration using Xterm in
X11.app, and not using Terminal.app. I imagine you could use
Terminal.app once you configured some more environment variables.

It should be noted that I specifically appended the extra db include
directory before the standard entries in an attempt to preempt gcc
from using Mac OS X's native db.h file, which does not contain any of
the necessary declarations for prdb4.c.

ADDING THE RIGHT MODULE_LDFLAGS

There was no os-dependent configuration line in microcode/configure.ac
for handling darwin needs, so in the patch below I have added the
necessary MODULE_LDFLAGS options.

MESSING WITH CMPAUXMD

By far the most annoying problem as yet has been with cmpauxmd. For
some reason, make on Mac OS X does not properly handle the implicit
rules for making .s files. What happens is that it reads the
.SUFFIXES, finds .c listed, and then assumes that this is the target
to use. So, this results it in looking for cmpauxmd.c to make
cmpauxmd.o and not finding it. It then gives up without attempting any
other rules. Two changes were made in order to get around this. I say
get around because there are better options out there, but I haven't
taken the time to change configure.ac enough to make them nicer.

I had to change the order of the suffixes listed in .SUFFIXES so that
.s was listed first (this is in microcode/makegen/Makefile.in.in). I
also had to alter OPTIONAL_SOURCES in microcode/configure.ac so that
it appended cmpauxmd.s instead of cmpauxmd.m4. While this apparently
works, I'm leery about this fix, because it is not exactly "proper."
I'm not sure if there are any ramifications beyond or hidden bugs
within that would make this fix worthless; no sufficient testing has
been done.

After making all of these changes, everything goes smoothly, except
that the scheme compiler seems to have a --heap limit of 3148 or it
fails to start. So -- and this is another unclean fix -- I altered
etc/compile.sh and microcode/utabmd.sh to explicitely use a --heap
size of 3000. This should probably be changed to use a settings
defined ahead of time by the autoconf script, which should be user
alterable through the configure script.

Once this is made, all seems to compile without a hitch.

THINGS THAT ARE STILL MISSING

I would like not to have to be so particular about specifying CPATH
and LIBRARY_PATH. Libraries should be automatically detected rather
than having to specifically state their paths. The use of pg_config to
find the location of the Postgresql include directory is good but it
requires that there be -- at least -- a symlink at /usr/bin/pg_config.
This is troublesome at best.

The changes to deal with cmpauxmd.s are very ugly, and something
better would be nice.

CURIOUS QUESTIONS

I don't know much about the limit for the heap size, but I notice that
autoconf does look for a malloc.h file. Since Mac OS X provides
malloc/malloc.h is that a different type of malloc that would be
sufficient for use? I'm guessing not, from what I hear. I'm sure there
ought to be a fix to this limited size problem, can anyone fill me in
on what's going on?

PATCHES

microcode/makegen/Makefile.in.in
197c197
< .SUFFIXES: .c .o .s .m4
---
> .SUFFIXES: .s .m4 .c .o

etc/compile.sh
33c33
<     SCHEME_COMPILER="scheme --compiler --heap 4000"
---
>     SCHEME_COMPILER="scheme --compiler --heap 3000"

microcode/configure.ac
794a795,797
> darwin*)
>     MODULE_LDFLAGS="${MODULE_LDFLAGS} -dynamiclib -flat_namespace -undefined 
> suppress"
>     ;;
863c866
<     OPTIONAL_SOURCES="${OPTIONAL_SOURCES} cmpauxmd.m4"
---
>     OPTIONAL_SOURCES="${OPTIONAL_SOURCES} cmpauxmd.s"

microcode/utabmd.sh
25c25
<     SCHEME_COMPILER="scheme --compiler"
---
>     SCHEME_COMPILER="scheme --heap 3000 --compiler"

I hope this is helpful to someone.

- Aaron Hsu
--
address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]