[QE-developers] Configuring with IFLAGS Seemingly Breaks Build Process
Paolo Giannozzi
p.giannozzi at gmail.com
Sat Sep 13 11:46:04 CEST 2025
(not sure what happened to this message, it was held for approval and
disappeared when I approved it)
By far the simple way to deal with special values of IFLAGS is to run
configure, then modify the make.inc file. In your case, after a 'make
veryclean' (prevents problems with devXlib like the one you encounter), run
./configure --enable-parallel=no CC=/opt/homebrew/bin/gcc-15
CPP=/opt/homebrew/bin/cpp-15 LIBDIRS=/opt/homebrew/lib
then, in 'make.inc', just add "-I/opt/homebrew/include" to IFLAGS.
Currently "configure" sets IFLAGS to a few needed directories if you did
not specify it, to whatever you specified in input otherwise. This is
not a smart choice: input IFLAGS should be prepended to the needed
directories. Will be fixed soon
Paolo
On 9/13/2025 12:58 AM, James Telzrow wrote:
> Hello,
>
> I've encountered an error when trying to build pw on macOS 15.6.1 using
> FFTW3;
> It seems that running the ./configure script with the IFLAGS parameter
> specified somehow breaks the build process.
>
> I started by trying to build pw.x using the following command:
>
> ./configure --enable-parallel=no CC=/opt/homebrew/bin/gcc-15 CPP=/
> opt/homebrew/bin/cpp-15
>
>
> but this doesn't find the version of FFTW installed by homebrew, since I
> see in the ./configure output the message "using internal copy of FFTW"
> and "FFT_LIBS= " indicating that no FFT library was found.
> Running "make pw.x" afterwards succeeds and I can run PWscf, but I want
> to build it with FFTW3.
>
> I first tried to resolve this by including the option LIBDIRS="/opt/
> homebrew/lib" in my ./configure command.
> This partially worked, because I saw in the configure script:
>
> in /opt/homebrew/lib: checking for library containing
> dfftw_execute_dft... -lfftw3
> -L/opt/homebrew/lib -lfftw3
>
>
> and in the list of libraries that was found I see "FFT_LIBS=-L/opt/
> homebrew/lib -lfftw3".
> However this obviously won't work because I'm not including the
> necessary files from FFTW:
> when I run "make pw", compilation of fft_scalar.FFTW3.f90 fails as follows:
>
> gfortran -O3 -g -fallow-argument-mismatch -cpp -D__FFTW3 -I/Users/
> jamestelzrow/Documents/Junk_Drawer/custom_qe_build/q-e//external/
> devxlib/src -I. -I/Users/jamestelzrow/Documents/Junk_Drawer/
> custom_qe_build/q-e//include -c fft_scalar.FFTW3.f90 -o
> fft_scalar.FFTW3.o
> fft_scalar.FFTW3.f90:41:2:
> 41 |
> | 1
> Fatal Error: fftw3.f03: No such file or directory
> compilation terminated.
>
>
> While it isn't included in the error messsage, line 40 is "#include
> "fftw3.f03"".
> Obviously, gfortran needs to include the directory "/opt/homebrew/include".
> It seems that the correct way to do this is to specify "IFLAGS=-I/opt/
> homebrew/include" when calling ./configure, as follows:
>
> ./configure --enable-parallel=no CC=/opt/homebrew/bin/gcc-15 CPP=/
> opt/homebrew/bin/cpp-15 LIBDIRS="/opt/homebrew/lib" IFLAGS="-I/opt/
> homebrew/include"
>
>
> But when running "make pw" afterwards, although all the components of
> FFTXlib are compiled successfully, compilation of write_upf_new.f90
> fails as follows:
>
> gfortran -O3 -g -fallow-argument-mismatch -cpp -D__FFTW3 -I/Users/
> jamestelzrow/Documents/Junk_Drawer/custom_qe_build/q-e//external/
> devxlib/src -I/opt/homebrew/include -I../UtilXlib -I. -c
> write_upf_new.f90 -o write_upf_new.o
> write_upf_new.f90:176:2:
> 176 | INTEGER :: nw, nb
> | 1 ~~~~~~~~~~~
> Fatal Error: qe_version.h: No such file or directory
> compilation terminated.
>
>
> Line 175 in this file is #include "qe_version.h".
> As I can see by looking at the output of "make pw" when building with
> QE's internal copy of FFTW, this gfortran invocation should include "-I/
> Users/jamestelzrow/Documents/Junk_Drawer/custom_qe_build/q-e//include",
> as the header file "qe_version.h" lies in that directory.
> Again, this directory is included when I run "make pw" after configuring
> using the command
>
> ./configure --enable-parallel=no CC=/opt/homebrew/bin/gcc-15 CPP=/
> opt/homebrew/bin/cpp-15
>
>
> but not when running "make pw" after using the command
>
> ./configure --enable-parallel=no CC=/opt/homebrew/bin/gcc-15 CPP=/
> opt/homebrew/bin/cpp-15 LIBDIRS="/opt/homebrew/lib" IFLAGS="-I/opt/
> homebrew/include"
>
>
> so it seems to me that including the IFLAGS parameter when calling ./
> configure breaks something.
> I tried to resolve this by including "-I/Users/jamestelzrow/Documents/
> Junk_Drawer/custom_qe_build/q-e//include" in IFLAGS, running:
>
> ./configure --enable-parallel=no CC=/opt/homebrew/bin/gcc-15 CPP=/
> opt/homebrew/bin/cpp-15 LIBDIRS="/opt/homebrew/lib" IFLAGS="-I/opt/
> homebrew/include -I/Users/jamestelzrow/Documents/Junk_Drawer/
> custom_qe_build/q-e//include"
>
>
> However, when running "make pw" after doing this, compilation of
> cegterg.f90 fails as follows:
>
> gfortran -O3 -g -fallow-argument-mismatch -cpp -D__FFTW3 -I/Users/
> jamestelzrow/Documents/Junk_Drawer/custom_qe_build/q-e//external/
> devxlib/src -I/opt/homebrew/include -I/Users/jamestelzrow/Documents/
> Junk_Drawer/custom_qe_build/q-e//include -I ../../LAXlib -I ../../
> UtilXlib -I. -c cegterg.f90 -o cegterg.o
> cegterg.f90:38:7:
> 38 | USE device_memcpy_m, ONLY : dev_memcpy, dev_memset
> | 1
> Fatal Error: Cannot open module file 'device_memcpy_m.mod' for
> reading at (1): No such file or directory
> compilation terminated.
>
>
> Looking in the "q-e/external/devxlib/src" directory I see the file
> "device_memcpy_mod.f90" where the "device_memcpy_m" module is defined,
> but this directory doesn't contain any ".mod" or ".o" files, seemingly
> indicating that nothing here was compiled.
> However, in the output of "make pw" after running "./configure --enable-
> parallel=no CC=/opt/homebrew/bin/gcc-15 CPP=/opt/homebrew/bin/
> cpp-15" (without any LIBDIRS or IFLAGS parameters) I can see that these
> files do get compiled, once again making it seem like the build process
> is broken somehow.
>
> Is there some other way that I should be trying to build this, or is
> there a problem with the configuration scripts or makefiles?
>
> Thank you,
>
> James Telzrow
More information about the developers
mailing list