AFD-Illinois / ipole

Polarized covariant radiative transport code
BSD 3-Clause "New" or "Revised" License
16 stars 12 forks source link

Installation of ipole in mac #92

Open R-0-n-Y opened 11 months ago

R-0-n-Y commented 11 months ago

I am having an installation issue with ipole in my mac m1 os. This is the error I am facing.

After I installed brew install llvm gsl hdf5 in my Downloads.

fatal: not a git repository (or any of the parent directories): .git Compiling coordinates.c /opt/homebrew/bin/h5cc: line 316: /usr/local/opt/llvm/bin/clang: No such file or directory make: *** [/Users/myusername/Downloads/ipole-1.5/build_archive//coordinates.o] Error 127

Let me know what is the issue.

I also tried to located h5cc and use make CC=/path/to/h5cc.

bprather commented 11 months ago

Hi!

ipole's a little complex to compile on macs, since we pretty much require OpenMP, and Apple's version of clang brazenly refuses to support that. So, beyond just h5cc, we need to find a backend compiler which supports OpenMP -- we've in the past used homebrew's clang. This mode of compiling isn't really supported, since none of us use ipole on local mac machines too often.

I happen to have an M1 mac with homebrew around, though, so let's take a crack at this. It looks like all the homebrew folder locations have changed, but we can use the same principle. I'm using (I think)

% brew install gcc@13 hdf5 gsl

no particular reason I'm preferring gcc here when we've used clang before, but I know it's been broken in homebrew in the past.

And I can compile successfully if I apply the following diff to the makefile, which just directs h5cc and make to use the new homebrew locations of gcc and gsl:

diff --git a/makefile b/makefile
index d349682..ad11b08 100644
--- a/makefile
+++ b/makefile
@@ -27,10 +27,10 @@ ECHO=echo -e

 # Overrides of the above for macOS
 ifneq (,$(findstring Darwin,$(shell uname)))
-       export HDF5_CC = /usr/local/opt/llvm/bin/clang
-       export HDF5_CLINKER = /usr/local/opt/llvm/bin/clang
+       export HDF5_CC = /opt/homebrew/bin/gcc-13
+       export HDF5_CLINKER = /opt/homebrew/bin/gcc-13

-       GSL_DIR=/usr/local
+       GSL_DIR=/opt/homebrew/opt/gsl
        SYSTEM_LIBDIR=

        MD5=md5

Given it breaks every couple of years depending on homebrew, I'm not sure if the maintainers want to upstream this & support macs again generally, but the diff's there if you want it -- pinging in particular @avjoshi21