include fftw3.f instead of #include fftw3.f breaks build
@steve_biggs wrote here
"I just tried to build the latest trunk (r4424). However, it appears that a recent commit (r4421 - https://sourceforge.net/p/gyrokinetics/code/4421/) has broken the build. This is true on both a YPI server (sausage) and YARCC. Reverting that commit allows the build to complete successfully on both sausage and YARCC.
However, the comments seem to suggest that others may be having problems with the old way so the fix might not be as simple as just reverting that commit."
Comments (7)
-
reporter -
I'm sorry for breaking the code.
I think the reason that agk fails is because it is missing the following lines in the main makefile.
ifeq ($(USE_FFT),fftw3) CPPFLAGS += -DFFT=_FFTW3_ $(FFT_INC) FFT_LIB ?= -lfftw -lrfftw endif
So, if we add $(FFT_INC) to $(CPPFLAGS) the original code should work. But, I wonder if this is the right way. Why does the new code fails for GS2? Is there any special reason to use the preprocessor's include directive over the Fortran statement? For me, using the Fortran statement seems more standard.
-
reporter Thanks Ryusuke. On my machine, I'd not set
FFT_INC
to the directory containingfftw3.f
, sompif90
couldn't find it. Changing the local makefile toifeq ($(USE_FFT),fftw3) FFT_LIB = -L/usr/lib -L/usr/lib/x86_64-linux-gnu/ -lfftw3 -lfftw3f FFT_INC = -I/usr/local/include endif
builds fine.
@steve_biggs , does it build for you if you set
FFT_INC
to the result oflocate fftw3.f
? -
Yes, it builds fine when I set FFT_LIB and FFT_INC properly. I agree with @rnumata that
include
is better than#include
as it is the standard Fortran way of doing it (and is also the method suggested in the FFTW documentation). Therefore, I say, let's keep Ryusuke's change. However, we need to update any affected Makefiles accordingly. I will open a new bugfix branch for this. -
- changed status to closed
No issue with utils so closed here but new issues opened in gs2 and makefiles as that is where changes are required.
-
See https://bitbucket.org/gyrokinetics/gs2/issues/8/update-makefile-commit-to-use-new-makefile for related issue. I agree that we should use a Fortran include statement if we can. The required change to the makefile will actually make the treatment of libraries more uniform (i.e. we have to specify other
*_INC
paths for other dependencies). -
Agreed. These changes feel like the proper way to do it. Good spot @rnumata.
See also: https://bitbucket.org/gyrokinetics/makefiles/issues/1
- Log in to comment
I also see this bug and would like to revert the commit.
@rnumata, is it right that you need this change because you don't add a
-I
argument to the preprocessor? For GS2, we do pass an-I
which is handled byMakefiles/Makefile.<system>
. For example, in my laptop's makefile, I have the lines:which get passed to
CPPFLAGS
by the mainMakefile
.If you put the equivalent lines into your system makefile, can you built with the original line?: