David,
Thanks for that.
If I do:
./configure --build=x86_64-darwin
then make works, but make cvs then fails like this:
make all-recursive Making all in libpolyml make[2]: Nothing to be done for `all'. Making all in libpolymain make[2]: Nothing to be done for `all'. make[2]: Nothing to be done for `all-am'. ./poly -H 10 < mlsource/BuildExport.sml /bin/sh: line 1: 18804 Bus error ./poly -H 10 < mlsource/BuildExport.sml make: *** [compiler] Error 138
If I do:
./configure --build=x86_64-darwin LDFLAGS='-segprot POLY rwx rwx'
then everything works (but as you predict I also have to put -segprot POLY rwx rwx in the steps in my make files that link a poly program.
If I do:
./configure CFLAGS='-arch i386'
It fails on x86_dep.lo just as it does with no extra settings.
Regards,
Rob.
rda@lemma-one.com wrote:
My first attempt to compile Poly/ML 5.2.1 on Snow Leopard (= MacOS X 10.6) resulted in an error due to a cast of a pointer to an int in libpolyml/x86_dep.cpp. There is a fix for this in the latest source, but the build then falls over as follows:
Rob, I had an email about this from Peter Homeier. Since I don't have access to a machine running this I can't test it directly. My feeling is that it is building the 64-bit version by default. Try grep SIZEOF_VOIDP config.h and see what it says. I have managed to build the 64-bit version on an older version of Mac OS X with the following: ./configure --build=x86_64-darwin CFLAGS='-arch x86_64 -O3' \ CXXFLAGS='-arch x86_64 -O3' CCASFLAGS='-arch x86_64' \ LDFLAGS='-segprot POLY rwx rwx'
This may work on 10.6. If so, some of the arguments may not actually be necessary and I'd like to know exactly which. I would expect that the CFLAGS, CXXFLAGS and CCASFLAGS can all be omitted if it is defaulting to 64-bit anyway. The LDFLAGS wasn't needed for the build itself but without it the resulting poly executable would SEGFAULT as soon as it was run. The problem was that the linker was ignoring the access rights in the object file itself and removing execute permission. This doesn't have any effect in 32-bit mode but in 64-bit mode it seems the processor was respecting the no-execute flag and failing. If this is needed it will have to be provided on any link step with your own code.
It may be possible to force 32-bit mode with ./configure CFLAGS='-arch i386 -O3' CXXFLAGS='-arch i386 -O3' \ CCASFLAGS='-arch i386'
Regards, David