I have an SML / NJ program that I can run as a heap, and I want to create a standalone binary executable. However, the heap2exec
tool in SML / NJ 110.73 always gives errors for me.
I created a tigerc.x86-darwin
heap image through the following:
ml-build sources.cm Main.main tigerc
I can run my program using a heap image using
sml @SMLload=tigerc.x86-darwin
I should be able to create standalone binaries via
heap2exec tigerc.x86-darwin tigerc
but it generates an error
ld: warning: -macosx_version_min not specificed, assuming 10.7 ld: warning: ignoring file tigerc.o, file was built for unsupported file format which is not the architecture being linked (i386)
I looked at the heap2exec
script shell, and the key lines (with a variable extension) did the following:
heap2asm "$heapfile" "$execfile".s cc -c -o "$execfile".o "$execfile".s ld -o "$execfile" ${RUNX} "$execfile".o
When I perform these steps individually, the cc
command creates the x86_64 .o
file, but the ld
command tries to link the i386 executable. Therefore, I need to convince the cc
command to generate the i386 .o
file.
Is there a way to set the environment variable to get cc
for i386 build instead of x86_84? ( ARCH
doesn't do the trick, by the way - it's already installed in i386
.)
Or is there another workaround to get heap2exec
to create the correct architecture?