Skip to content

Instantly share code, notes, and snippets.

@binarymax
Last active November 29, 2015 22:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binarymax/1650078c82e6c69cc41d to your computer and use it in GitHub Desktop.
Save binarymax/1650078c82e6c69cc41d to your computer and use it in GitHub Desktop.
Compile Crafty Chess on Mac OSX
Compiling crafty chess on MacOS, you get the following error:
-------------------------------------------------------------
~/apps/crafty/crafty-23.4:$ make darwin
/Applications/Xcode.app/Contents/Developer/usr/bin/make target=FreeBSD \
CC=gcc CXX=g++ \
CFLAGS='-Wall -pipe -O3' \
CXFLAGS='-Wall -pipe -O3' \
LDFLAGS= \
LIBS='-lstdc++' \
opt='' \
crafty-make
gcc -Wall -pipe -O3 -DFreeBSD -c crafty.c
In file included from crafty.c:13:
In file included from ./search.c:1:
./chess.h:28:12: fatal error: 'malloc.h' file not found
# include <malloc.h>
^
1 error generated.
make[2]: *** [crafty.o] Error 1
make[1]: *** [crafty-make] Error 2
make: *** [darwin] Error 2
-------------------------------------------------------------
To fix the problem, you need to:
sudo cp /usr/include/malloc/malloc.h /usr/include/
Then crafty will compile!
@cawel
Copy link

cawel commented Nov 29, 2015

On OSX 10.11.1 (El Capitan), you cannot write to /usr/include by default, even when using sudo. So instead I did that and it worked:

cp /usr/include/malloc/malloc.h /usr/local/include/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment