Mercury-Language/mercury

stdlib.h not found? macos 14.0

hyperswine opened this issue · 3 comments

Im getting this error with a simple tutorial file. Not sure whats going on, I checked PATH and all, and CC should be pointing to /opt/homebrew/Cellar/llvm/17.0.2/bin/clang. I also tried gcc to no avail. Any ideas?

mmc --make -E invocate
Making Mercury/os/invocate.o
In file included from Mercury/cs/invocate.c:29:
In file included from ./Mercury/mihs/invocate.mih:31:
In file included from /opt/homebrew/Cellar/mercury/22.01.8/lib/mercury/inc/mercury.h:22:
In file included from /opt/homebrew/Cellar/mercury/22.01.8/lib/mercury/inc/mercury_float.h:14:
/opt/homebrew/Cellar/mercury/22.01.8/lib/mercury/inc/mercury_std.h:31:10: fatal error: 'stdlib.h' file not found
#include <stdlib.h> // for size_t
         ^~~~~~~~~~
1 error generated.
** Error making `Mercury/os/invocate.o'.
make: *** [Makefile:4: build] Error 1

I assume you have verified that C compiler, /opt/homebrew/Cellar/llvm/17.0.2/bin/clang, is actually working
independently of Mercury (e.g. by compiling a C program with it)?

If so, was /opt/homebrew/Cellar/llvm/17.0.2/bin/clang the C compiler that was to used to configure and build Mercury,
or was a different compiler used?

it does indeed work, with #include<stdlib.h> as well. I just used the brew formula to download and install mercury. It does have a quick check on a mercury file which it builds and runs, and asserts should give an output. So it seems the installation should have worked properly and ran that sample program. Not entirely sure why its not working when I compile a mercury program manually, could it be some other kind of error perhaps

huh, it actually works properly when I run the command directly mmc invocate but with make it does not. Well I'll keep that in mind