kfl / mosml

Moscow ML is a light-weight implementation of Standard ML (SML), a strict functional language widely used in teaching and research.
http://mosml.org
341 stars 42 forks source link

There's no <malloc.h> on OSX #32

Open nrnrnr opened 9 years ago

nrnrnr commented 9 years ago

I'm trying to build mosml on OSX. But there's no <malloc.h> file on my system.

There is a <malloc/malloc.h> and a <sys/malloc.h>.

kfl commented 9 years ago

That sound strange. My main platform for developing Moscow ML these days are OSX, but maybe I have polluted/enhanced my local setup.

Can you give me a bit more information about your setup? Are you using gcc or clang to compile the runtime, for instance? (I always use gcc as it makes Moscow ML 5-15% faster for some reason.)

Also, where do you get the compile error? Because we really shouldn't include malloc.h anywhere

nrnrnr commented 9 years ago

That sound strange. My main platform for developing Moscow ML these days are OSX, but maybe I have polluted/enhanced my local setup.

Can you give me a bit more information about your setup? Are you using gcc or clang to compile the runtime, for instance? (I always use gcc as it makes Moscow ML 5-15% faster for some reason.)

I'm using someone else's Mac, about which I know almost nothing.

I'm using something called /usr/bin/gcc but it's clearly an alias for clang.

I found malloc.h in /usr/include/malloc/malloc.h, but I ran into enough other issues that I stopped filing them. Including no access to mallopt().

Also, where do you get the compile error? Because we really shouldn't include malloc.h anywhere

Maybe the best thing for me to do is to send you the diffs between what I pulled from github and what eventually compiled? And the joker in the system is that all of this is on top of my own changes (which are limited to things like the version string and converting some warnings to errors).

Norman

kfl commented 9 years ago

It sound like you have a modified version of src/runtime/gc_ctrl.c (*), please check that you are using the gc_ctrl.c from github

(*) At one point we had a hard to track down bug on 64 bit Linux, that triggered when malloc() switched to using mmap(). Thus, the advice back then was use mallopt(), but this advice (and bug) is/was glibc specific and is no longer needed.