Preprocessing errors on macOS when compiling BerkeleyGW-4.0

40 views
Skip to first unread message

Sergey

unread,
Sep 17, 2025, 10:38:14 AMSep 17
to BerkeleyGW Help
Hello!
I am trying to compile BerkeleyGW on a macOS using Intel oneAPI + MPICH. However, I have encountered preprocessing errors with Fortran files, particularly when using the "FCPP = cpp -C -nostdinc" option. I have also tried "FCPP = icc -E", but this does not work either.

I guess the CPP on macOS is incompatible with BerkeleyGW. Could someone please tell me which preprocessor I should use instead?

Here is my arch.mk file:

# Precompiler options
#
COMPFLAG  = -DINTEL
PARAFLAG  = -DMPI
MATHFLAG  = -DUSESCALAPACK -DUNPACKED -DUSEFFTW3 -DHDF5 -DUSEMR3
# Only uncomment DEBUGFLAG if you need to develop/debug BerkeleyGW.
# The output will be much more verbose, and the code will slow down by ~20%.
#DEBUGFLAG = -DDEBUG

FCPP    = cpp -C -nostdinc
F90free = mpifort
LINK    = mpifort
FOPTS   = -O3
FNOOPTS = $(FOPTS)
MOD_OPT = -module ./
INCFLAG = -I

C_PARAFLAG = -DPARA
C_COMP  = mpicc
CC_COMP = mpicxx
C_LINK  = mpicxx
C_OPTS  = -O3
C_DEBUGFLAG =

REMOVE  = /bin/rm -f

# Libraries
#
FFTWLIB = -Wl,--start-group \
        $(MKLROOT)/lib/libmkl_scalapack_lp64.a \
        $(MKLROOT)/lib/libmkl_intel_lp64.a \
        $(MKLROOT)/lib/libmkl_core.a \
        $(MKLROOT)/lib/libmkl_sequential.a \
        $(MKLROOT)/lib/libmkl_blacs_mpich_lp64.a \
        -Wl,--end-group -lpthread -lm -ldl

FFTWINCLUDE = $(MKLROOT)/include/fftw
LAPACKLIB   = $(FFTWLIB)

HDF5_DIR  = /Users/me/install/hdf5/1.14.6
HDF5_LDIR = $(HDF5_DIR)/lib
HDF5LIB   = $(HDF5_LDIR)/libhdf5hl_fortran.a \
            $(HDF5_LDIR)/libhdf5_hl.a \
            $(HDF5_LDIR)/libhdf5_fortran.a \
            $(HDF5_LDIR)/libhdf5.a -ldl
HDF5INCLUDE = $(HDF5_DIR)/include

PERFORMANCE =
TESTSCRIPT = 

Mauro Del Ben

unread,
Sep 19, 2025, 3:22:31 AM (13 days ago) Sep 19
to Sergey, BerkeleyGW Help
Hi Sergey,

For me it works using GNU cpp-14 installed using homebrew (you can clearly use GNU cpp and still build with intel compiler). Here the line I'm using on my MacBook Pro, macOS Sequoia 15.6.1: 

FCPP = /opt/homebrew/opt/gcc/bin/cpp-14  -C -nostdinc


Best


-M


--
You received this message because you are subscribed to the Google Groups "BerkeleyGW Help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to help+uns...@berkeleygw.org.
To view this discussion visit https://groups.google.com/a/berkeleygw.org/d/msgid/help/af2fcbce-4e73-4eb5-bb79-541ef0c35b4fn%40berkeleygw.org.

Sergey

unread,
Sep 22, 2025, 1:18:57 PM (10 days ago) Sep 22
to BerkeleyGW Help, Mauro Del Ben, BerkeleyGW Help
Hi Mauro,

I tried GNU cpp-15 and it worked out! I had to modify the following lines: CPP = cpp-15 -C -P -nostdinc, and FOPTS   = -O3 -free. I also removed the group "-Wl,--start-group" and  "-Wl,--end-group" from FFTWLIB. Trying GNU cpp was a great idea! Thank you!

Best,
Sergey
Reply all
Reply to author
Forward
0 new messages