fortran - Compilation error: Undefined symbols for architecture x86_64 -
i trying use fortran library perform fft called "2decomp&fft"(http://www.2decomp.org/download.html). library has in-built fft engine , works fine code. in order use fftw3 engine library, instead of in-built engine, instructions say:
edit 'src/makefile.inc' file in 2decomp, change fft engine 'fft=fftw3'. need set fftw_path variable in same file point fftw installation. recompile everything.
i installed fftw3.3 on local mac , followed instructions , recompiled library. after when trying compile code library, getting following error while linking.
undefined symbols architecture x86_64: "_dfftw_destroy_plan_", referenced from: ___decomp_2d_fft_mod_decomp_2d_fft_finalize in lib2decomp_fft.a(fft_fftw3.o) "_dfftw_execute_dft_", referenced from: ___decomp_2d_fft_mod_c2c_1m_z in lib2decomp_fft.a(fft_fftw3.o) ___decomp_2d_fft_mod_c2c_1m_x in lib2decomp_fft.a(fft_fftw3.o) ___decomp_2d_fft_mod_c2c_1m_y in lib2decomp_fft.a(fft_fftw3.o) "_dfftw_execute_dft_c2r_", referenced from: ___decomp_2d_fft_mod_c2r_1m_x in lib2decomp_fft.a(fft_fftw3.o) ___decomp_2d_fft_mod_fft_3d_c2r in lib2decomp_fft.a(fft_fftw3.o) "_dfftw_execute_dft_r2c_", referenced from: ___decomp_2d_fft_mod_fft_3d_r2c in lib2decomp_fft.a(fft_fftw3.o) "_dfftw_plan_many_dft_", referenced from: ___decomp_2d_fft_mod_c2c_1m_z_plan in lib2decomp_fft.a(fft_fftw3.o) ___decomp_2d_fft_mod_c2c_1m_x_plan in lib2decomp_fft.a(fft_fftw3.o) ___decomp_2d_fft_mod_c2c_1m_y_plan in lib2decomp_fft.a(fft_fftw3.o) "_dfftw_plan_many_dft_c2r_", referenced from: ___decomp_2d_fft_mod_init_fft_engine in lib2decomp_fft.a(fft_fftw3.o) "_dfftw_plan_many_dft_r2c_", referenced from: ___decomp_2d_fft_mod_init_fft_engine in lib2decomp_fft.a(fft_fftw3.o) ld: symbol(s) not found architecture x86_64 collect2: error: ld returned 1 exit status make: *** [sora_v71] error 1
here minimal code have written calls library: program test
use decomp_2d use decomp_2d_fft integer n, pr, pc call decomp_2d_init(n,n,n,pr,pc) call decomp_2d_fft_init stop end
here makefile using (decomp2d environment variable set folder containing library) :
## ------------------------------------------------------------------------ # lines included using 2decomp libraries inc_2decomp = -i$(decomp2d)/include/ lib_2decomp = -l$(decomp2d)/lib/ -l2decomp_fft ## ------------------------------------------------------------------------ rm = rm srcdir = . libdir = . bin = a.out objs = main.o ## ------------------------------------------------------------------------ # default command compiler, linker fc = mpif90 fflags = $(f90flag) $(inc_2decomp) lflags = $(f90flag) $(lib_2decomp) -l$(libdir) ## ------------------------------------------------------------------------ # default action all: $(bin) $(bin): $(objs) @echo linking $(bin) ..... $(fc) $(objs) $(lflags) $(fflags) -o $@ .f.o: @echo compiling $*.f $(fc) $(lflags) $(fflags) -c $(srcdir)/$*.f clean: @echo 'cleaning .....' $(rm) -f core *.o *~ *.l *.o $(bin) $(size_file)
Comments
Post a Comment