LANL-Seismoacoustics / infraGA

Methods to simulate propagation of infrasound in the limit of geometric acoustics
Other
22 stars 7 forks source link

`make` command may produce errors on Apple Silicon w/ Homebrew #5

Open liamtoney opened 11 months ago

liamtoney commented 11 months ago

I recently tried installing infraGA on a new MacBook with an Apple M2 Max processor. I'm using Homebrew to install the dependencies (FFTW only, turns out that OpenMPI is one of its dependencies). Previously, on my Intel MacBook, the make command for infraGA ran w/o errors. Here, though, I got the following:

src/geoac/geoac.eqset.2d.cpp:9:10: fatal error: 'fftw3.h' file not found
#include <fftw3.h>
         ^~~~~~~~~

I looked into this and on Apple Silicon Homebrew installs libraries and headers in /opt/homebrew/lib/ and /opt/homebrew/include/. Based on this SE article I modified the infraGA makefile CFLAGS to be

CFLAGS=  -Wno-write-strings -lfftw3 -L/opt/homebrew/lib/ -I/opt/homebrew/include/ 

and the make process ran without errors. Just a note to hopefully save future users time if they run into the same issue!

davidfee5 commented 10 months ago

I had similar(?) issues installing with the Apple M1 Max chip on Sonoma. I installed fftw3 separately using homebrew and now get the error:

ld: warning: dylib (/opt/homebrew/lib//libfftw3.dylib) was built for newer macOS version (14.0) than being linked (11.3)

Any ideas?

liamtoney commented 10 months ago

I installed fftw3 separately using homebrew

Did you run brew install fftw or something else?

davidfee5 commented 10 months ago

Yes, I used brew install fftw.

liamtoney commented 10 months ago

It sort of sounds like you've got multiple installs of FFTW somehow, but that differs from the error I got. Assuming you modified the makefile the way I suggested and you're still getting that error, I'm not sure I can help :( maybe try removing all possible installs of FFTW from your system?

davidfee5 commented 10 months ago

I was able to resolve this by adding export MACOSX_DEPLOYMENT_TARGET=14.0. I had another problem with the setup and using pip to install importlib, but worked around that as well. Thanks @liamtoney!