Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26750 Discussions

error building pnetcdf 1.9.0 by impi-2018

Giuseppe_C_
Beginner
192 Views
I am trying to build the pnetcdf 1.9.0 with shared enable by impi-2018:
 
source /users/home/opt/intel/parallel_studio_xe_2018.3.051/bin/psxevars.sh intel64
 
MPIF77=mpiifort MPIF90=mpiifort MPICC=mpiicc MPICXX=mpiicpc ./configure --prefix=/users/home/opt-intel_2018/parallel-netcdf/parallel-netcdf-1.9.0 --enable-shared
 
 
but I receive these errors:
 
 
make[3]: Entering directory `/users/home/SOFTWARE/netcdf/2018/parallel-netcdf-1.9.0/src/utils/ncmpigen'
  CC       main.o
  CC       load.o
  CC       escapes.o
  CC       getfill.o
  CC       init.o
  CC       genlib.o
  CC       ncmpigentab.o
  CCLD     ncmpigen
../../../src/libs/.libs/libpnetcdf.so: undefined reference to `for_cpystr'
../../../src/libs/.libs/libpnetcdf.so: undefined reference to `for_allocate'
../../../src/libs/.libs/libpnetcdf.so: undefined reference to `for_dealloc_allocatable'
../../../src/libs/.libs/libpnetcdf.so: undefined reference to `for_cpstr'
../../../src/libs/.libs/libpnetcdf.so: undefined reference to `for_alloc_allocatable'
../../../src/libs/.libs/libpnetcdf.so: undefined reference to `for_len_trim'
../../../src/libs/.libs/libpnetcdf.so: undefined reference to `for_array_copy_in'
../../../src/libs/.libs/libpnetcdf.so: undefined reference to `for_trim'
../../../src/libs/.libs/libpnetcdf.so: undefined reference to `for_contig_array'
../../../src/libs/.libs/libpnetcdf.so: undefined reference to `for_check_mult_overflow64'
../../../src/libs/.libs/libpnetcdf.so: undefined reference to `for_array_copy_out'
 
 
What i'an doing wrong?
Thanks
0 Kudos
5 Replies
Steve_Lionel
Black Belt Retired Employee
192 Views

What's happening is that, for the command that creates the executable, it isn't referencing the Intel Fortran run-time libraries. I gather that CCLD invokes the C compiler to run ld, and it doesn't know how to find the Fortran libraries.I think that if you had CCLD run ifort instead for this step it would work. There are probably other ways to solve it, and I assume others will suggest them (Linux not being my strong point.)

Juergen_R_R
Valued Contributor I
192 Views

We also use the C compiler as linker for our main library which is Fortran code to make it besser accessible from external programs. For gcc/gfortran this works as gcc automatically links in all run-time libraries necessary. For ifort this doesn't work. We get access to the runtime libraries using the AC_FC_LIBRARY_LDFLAGS command from autotools  during our configure process, store these  in the FCLIBS variable and use them during linking. 

 

Giuseppe_C_
Beginner
192 Views

Sorry but I do not know how to use your advice, this is my configure:

module load INTEL/intel_xe_2018 
module load IMPI/intel_mpi_2018
export MPICC=mpiicc
export MPIF77=mpiifort
export MPIFC=mpiifort
export MPIF90=mpiifort
export MPIF90=mpif90
export MPICXX=mpiicpc
 
./configure --enable-shared --prefix=/users/home/opt-intel_2018/parallel-netcdf/parallel-netcdf-1.9.0 
 
Can you help me?
Thanks

 

Juergen_R_R
Valued Contributor I
192 Views

E.g., on  MAC OS X we get the flags from our configure script, and those flags are then stored in the environment variable

FCLIBS = '-L/opt/intel/compilers_and_libraries_2019.0.070/mac/compiler/lib -L/usr/lib -lifportmt -lifcoremt -limf -lsvml -lipgo -lintlc -lpthread'

When we build our library, we add $(FCLIBS) in the link command according to 

lib<your_project_name>_la_LIBADD +=  $(FCLIBS)

Note that this is autotools-specific, for cmake you need to add this to the linker flags, which would be something like

-DCMAKE_EXE_LINKER_FLAGS = '-L/ .... '  or something similar, I am not really familiar with cmake. 

Giuseppe_C_
Beginner
192 Views

Thanks Juergen, thanks at all.

I have solved getting FCLIBS from the Makefile and doing, after configure:

make LDFLAGS="fclibs contents"

Regards

Reply