When I try to compile a program with mlton
, I get an error.
~/projects/serve-sml $ mlton server.mlb
In file included from /usr/lib/mlton/include/platform.h:13:0,
from /usr/lib/mlton/include/common-main.h:16,
from /usr/lib/mlton/include/amd64-main.h:11,
from /tmp/file86PWQJ.1.c:110:
/usr/lib/mlton/include/cenv.h:137:17: fatal error: gmp.h: No such file or directory
#include "gmp.h"
^
compilation terminated.
call to system failed with exit status 1:
gcc -std=gnu99 -c -I/usr/lib/mlton/targets/self/include -I/usr/lib/mlton/include -O1 -fno-common -fno-strict-aliasing -fomit-frame-pointer -w -m64 -o /tmp/fileg5D5To.o /tmp/file86PWQJ.1.c
~/projects/serve-sml $
According to this, that means I should install libgmp3-dev
. I've run apt-get install libgmp3-dev
, and verified that the file /usr/include/x86_64-linux-gnu/gmp.h
exists, but am still getting the same error.
Any idea what I'm doing wrong?
Try executing
gcc -v -x c -E -
in your terminal. This will print out the header file search path that your C compiler is using. I get something like:So if I had
gmp.h
in/usr/include/x86_64-linux-gnu/
, then my C compiler would not find it. I would suggest moving your .h file into a directory that is on this search path (like/usr/local/include
in my case), or passing in the-I /usr/include/x86_64-linux-gnu/
flag, which would require modifying MLton's build scripts. Chances are you are going to have to do the same thing withlibgmp.a
when it comes time to link