google-research / dex-lang

Research language for array processing in the Haskell/ML family
BSD 3-Clause "New" or "Revised" License
1.56k stars 106 forks source link

Homebrew Include Directory Incorrectly Specified for M2 in Makefile #1184

Closed christopherpriebe closed 1 year ago

christopherpriebe commented 1 year ago

I am running macOS Monterey 12.6 with an M2 processor. I am using Homebrew 3.6.15 and I install libpng 1.6.39. When attempting to install Dex based on the instructions given in the README, I was getting the following error:

clang++ -fPIC -std=c++11 -fno-exceptions -fno-rtti -pthread -DDEX_LIVE -c -emit-llvm src/lib/dexrt.cpp -o src/lib/dexrt.bc
src/lib/dexrt.cpp:30:10: fatal error: 'png.h' file not found
#include <png.h>
         ^~~~~~~
1 error generated.
make: *** [src/lib/dexrt.bc] Error 1

The current Makefile specifies an include directory supported by Intel Macs. I changed the Makefile to specify the new include directory /opt/homebrew/include. It seems to be working so far. The code I have for lines 97-100 is below:

# libpng
ifneq (,$(wildcard /opt/homebrew/include/png.h))
CFLAGS := $(CFLAGS) -I/opt/homebrew/include
endif

Can this be fixed to support all machines?

axch commented 1 year ago

Thanks for your interest! We're not worrying super-actively about OS support right now, but if you want to throw us a PR that seems reasonable to you, if it passes tests we'll merge it!

christopherpriebe commented 1 year ago

Will do. Thanks!