Parallel-NetCDF / PnetCDF

Source code repository of PnetCDF library and utilities
https://parallel-netcdf.github.io
Other
83 stars 23 forks source link

Link error when building pnetcdf 0.13.0 or 0.14.0 with intel 2025.0.0 compilers on linux #157

Open bourdin opened 1 week ago

bourdin commented 1 week ago

I am having the following error when trying to build v1.13.0 or checkpoint.1.14.0 with the most recent intel compilers and mvapich2:

$ ./configure --with-mpi=$MPI_ROOT
:
:
------------------------------------------------------------------------------

  PnetCDF Version 1.14.0

  Features:  Build static libraries                      - yes
             Build shared libraries                      - yes
             Build Fortran APIs                          - yes
             Build C++ APIs                              - yes

  Compilers: MPICC       = /mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/oneapi-2025.0.0/mvapich2-2.3.7-1-fceikn42xh6pzcjzczg63nilbh6l73ss/bin/mpicc
             MPICXX      = /mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/oneapi-2025.0.0/mvapich2-2.3.7-1-fceikn42xh6pzcjzczg63nilbh6l73ss/bin/mpicxx
             MPIF77      = /mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/oneapi-2025.0.0/mvapich2-2.3.7-1-fceikn42xh6pzcjzczg63nilbh6l73ss/bin/mpif77
             MPIF90      = /mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/oneapi-2025.0.0/mvapich2-2.3.7-1-fceikn42xh6pzcjzczg63nilbh6l73ss/bin/mpif90
             CFLAGS      = -O2
             CXXFLAGS    = -O2
             FFLAGS      = -g
             FCFLAGS     = -g
             SEQ_CC      = /usr/bin/gcc

$ make -j 8 all
:
:
 CCLD     ncmpigen
/usr/bin/ld: ../../../src/libs/.libs/[libpnetcdf.so](http://libpnetcdf.so/): undefined reference to `std::ios_base_library_init()'
icx: error: linker command failed with exit code 1 (use -v to see invocation)

Changing SEQ_CC for g++, icx, or icpx does not make a difference and neither does switching to the intel MPI. Compiling with gcc and mvapich2 works fine.

wkliao commented 1 week ago

Can you try this command below?

make -j 8 all LIBS=-lstdc++
bourdin commented 1 week ago

That did not work. For now, I am just using --disable-cxx since I don't need it, but it would be nice to understand what is going on.

wkliao commented 1 week ago

Can you run commands and let me know the output on screen? They should dump the entire linker command.

cd src/libs
make clean
make V=1 LIBS=-lstdc++
bourdin commented 1 week ago

Here is what I get:

[bourdinb@bbserv2 libs]$ make V=1 libs=-lstdc++
/bin/sh ../../libtool  --tag=CXX   --mode=link /mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/oneapi-2025.0.0/mvapich2-2.3.7-1-fceikn42xh6pzcjzczg63nilbh6l73ss/bin/mpicxx  -O2 -version-info 6:0:0  -o libpnetcdf.la -rpath /usr/local/lib   ../dispatchers/libdispatchers.la ../drivers/common/libcommon.la ../drivers/ncmpio/libncmpio.la     ../binding/cxx/libcxx.la ../binding/f77/libf77.la ../binding/f90/libf90.la -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/oneapi-2025.0.0/mvapich2-2.3.7-1-fceikn42xh6pzcjzczg63nilbh6l73ss/lib -lmpifort -lmpi -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/oneapi-2025.0.0/intel-oneapi-mkl-2024.2.2-3qvyjyequb4hlg7ctf7uwruzansxa7hg/mkl/2024.2/lib -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-13.2.0/intel-oneapi-compilers-2025.0.0-7mqdqmcxbkur32yrea226rlpmstn7vfg/compiler/2025.0/lib -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-13.2.0/intel-oneapi-compilers-2025.0.0-7mqdqmcxbkur32yrea226rlpmstn7vfg/compiler/2025.0/lib/clang/19/lib/x86_64-unknown-linux-gnu -L/usr/lib/gcc/x86_64-redhat-linux/11/ -L/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/ -L/lib/../lib64 -L/lib/../lib64/ -L/usr/lib/../lib64 -L/usr/lib/../lib64/ -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/oneapi-2025.0.0/intel-oneapi-mkl-2024.2.2-3qvyjyequb4hlg7ctf7uwruzansxa7hg/mkl/2024.2/lib/ -L./ -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-13.2.0/intel-oneapi-compilers-2025.0.0-7mqdqmcxbkur32yrea226rlpmstn7vfg/compiler/2025.0/lib/ -L/usr/lib/gcc/x86_64-redhat-linux/11/../../../ -L/lib64 -L/lib/ -L/usr/lib64 -L/usr/lib -lifport -lifcoremt -limf -lsvml -lm -lipgo -lirc -lpthread -lirc_s -ldl -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/oneapi-2025.0.0/mvapich2-2.3.7-1-fceikn42xh6pzcjzczg63nilbh6l73ss/lib -lmpifort -lmpi -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/oneapi-2025.0.0/intel-oneapi-mkl-2024.2.2-3qvyjyequb4hlg7ctf7uwruzansxa7hg/mkl/2024.2/lib -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-13.2.0/intel-oneapi-compilers-2025.0.0-7mqdqmcxbkur32yrea226rlpmstn7vfg/compiler/2025.0/lib -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-13.2.0/intel-oneapi-compilers-2025.0.0-7mqdqmcxbkur32yrea226rlpmstn7vfg/compiler/2025.0/lib/clang/19/lib/x86_64-unknown-linux-gnu -L/usr/lib/gcc/x86_64-redhat-linux/11/ -L/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/ -L/lib/../lib64 -L/lib/../lib64/ -L/usr/lib/../lib64 -L/usr/lib/../lib64/ -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/oneapi-2025.0.0/intel-oneapi-mkl-2024.2.2-3qvyjyequb4hlg7ctf7uwruzansxa7hg/mkl/2024.2/lib/ -L./ -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-13.2.0/intel-oneapi-compilers-2025.0.0-7mqdqmcxbkur32yrea226rlpmstn7vfg/compiler/2025.0/lib/ -L/usr/lib/gcc/x86_64-redhat-linux/11/../../../ -L/lib64 -L/lib/ -L/usr/lib64 -L/usr/lib -lifport -lifcoremt -limf -lsvml -lm -lipgo -lirc -lpthread -lirc_s -ldl 
libtool: link: /mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/oneapi-2025.0.0/mvapich2-2.3.7-1-fceikn42xh6pzcjzczg63nilbh6l73ss/bin/mpicxx  -fPIC -DPIC -shared -nostdlib /lib/../lib64/crti.o /mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-11.4.1/gcc-13.2.0-kbdjr2dwgiytofc7ir5mo5zo345bestm/lib/gcc/x86_64-pc-linux-gnu/13.2.0/crtbeginS.o  -Wl,--whole-archive ../dispatchers/.libs/libdispatchers.a ../drivers/common/.libs/libcommon.a ../drivers/ncmpio/.libs/libncmpio.a ../binding/cxx/.libs/libcxx.a ../binding/f77/.libs/libf77.a ../binding/f90/.libs/libf90.a -Wl,--no-whole-archive  -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/oneapi-2025.0.0/mvapich2-2.3.7-1-fceikn42xh6pzcjzczg63nilbh6l73ss/lib -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/oneapi-2025.0.0/intel-oneapi-mkl-2024.2.2-3qvyjyequb4hlg7ctf7uwruzansxa7hg/mkl/2024.2/lib -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-13.2.0/intel-oneapi-compilers-2025.0.0-7mqdqmcxbkur32yrea226rlpmstn7vfg/compiler/2025.0/lib -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-13.2.0/intel-oneapi-compilers-2025.0.0-7mqdqmcxbkur32yrea226rlpmstn7vfg/compiler/2025.0/lib/clang/19/lib/x86_64-unknown-linux-gnu -L/usr/lib/gcc/x86_64-redhat-linux/11/ -L/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/ -L/lib/../lib64 -L/lib/../lib64/ -L/usr/lib/../lib64 -L/usr/lib/../lib64/ -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/oneapi-2025.0.0/intel-oneapi-mkl-2024.2.2-3qvyjyequb4hlg7ctf7uwruzansxa7hg/mkl/2024.2/lib/ -L./ -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-13.2.0/intel-oneapi-compilers-2025.0.0-7mqdqmcxbkur32yrea226rlpmstn7vfg/compiler/2025.0/lib/ -L/usr/lib/gcc/x86_64-redhat-linux/11/../../../ -L/lib64 -L/lib/ -L/usr/lib64 -L/usr/lib -lmpifort -lifport -lifcoremt -lipgo -lirc -lpthread -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-13.2.0/intel-oneapi-compilers-2025.0.0-7mqdqmcxbkur32yrea226rlpmstn7vfg/compiler/2025.0/bin/compiler/../../lib -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-11.4.1/gcc-13.2.0-kbdjr2dwgiytofc7ir5mo5zo345bestm/lib/gcc/x86_64-pc-linux-gnu/13.2.0 -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-11.4.1/gcc-13.2.0-kbdjr2dwgiytofc7ir5mo5zo345bestm/lib/gcc/x86_64-pc-linux-gnu/13.2.0/../../../../lib64 -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-11.4.1/gcc-13.2.0-kbdjr2dwgiytofc7ir5mo5zo345bestm/lib/gcc/x86_64-pc-linux-gnu/13.2.0/../../.. -L/mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-13.2.0/intel-oneapi-compilers-2025.0.0-7mqdqmcxbkur32yrea226rlpmstn7vfg/compiler/2025.0/bin/compiler/../../opt/compiler/lib -L/lib -L. -lmpicxx -lmpi -lsvml -lirng -lstdc++ -limf -lm -lintlc -ldl -lc -lgcc_s -lgcc -lirc_s /mnt/bbnfs/sw/spack/opt/spack/linux-rocky9-x86_64_v3/gcc-11.4.1/gcc-13.2.0-kbdjr2dwgiytofc7ir5mo5zo345bestm/lib/gcc/x86_64-pc-linux-gnu/13.2.0/crtendS.o /lib/../lib64/crtn.o  -O2   -Wl,-soname -Wl,libpnetcdf.so.6 -o .libs/libpnetcdf.so.6.0.0
libtool: link: (cd ".libs" && rm -f "libpnetcdf.so.6" && ln -s "libpnetcdf.so.6.0.0" "libpnetcdf.so.6")
libtool: link: (cd ".libs" && rm -f "libpnetcdf.so" && ln -s "libpnetcdf.so.6.0.0" "libpnetcdf.so")
libtool: link: (cd .libs/libpnetcdf.lax/libdispatchers.a && ar x "/mnt/bbnfs/sw/HPC/petsc/main/arch-intel-oneapi-compilers-2025.0.0-mvapich2-2.3.7-1-g/externalpackages/git.pnetcdf/src/libs/../dispatchers/.libs/libdispatchers.a")
libtool: link: (cd .libs/libpnetcdf.lax/libcommon.a && ar x "/mnt/bbnfs/sw/HPC/petsc/main/arch-intel-oneapi-compilers-2025.0.0-mvapich2-2.3.7-1-g/externalpackages/git.pnetcdf/src/libs/../drivers/common/.libs/libcommon.a")
libtool: link: (cd .libs/libpnetcdf.lax/libncmpio.a && ar x "/mnt/bbnfs/sw/HPC/petsc/main/arch-intel-oneapi-compilers-2025.0.0-mvapich2-2.3.7-1-g/externalpackages/git.pnetcdf/src/libs/../drivers/ncmpio/.libs/libncmpio.a")
libtool: link: (cd .libs/libpnetcdf.lax/libcxx.a && ar x "/mnt/bbnfs/sw/HPC/petsc/main/arch-intel-oneapi-compilers-2025.0.0-mvapich2-2.3.7-1-g/externalpackages/git.pnetcdf/src/libs/../binding/cxx/.libs/libcxx.a")
libtool: link: (cd .libs/libpnetcdf.lax/libf77.a && ar x "/mnt/bbnfs/sw/HPC/petsc/main/arch-intel-oneapi-compilers-2025.0.0-mvapich2-2.3.7-1-g/externalpackages/git.pnetcdf/src/libs/../binding/f77/.libs/libf77.a")
libtool: link: (cd .libs/libpnetcdf.lax/libf90.a && ar x "/mnt/bbnfs/sw/HPC/petsc/main/arch-intel-oneapi-compilers-2025.0.0-mvapich2-2.3.7-1-g/externalpackages/git.pnetcdf/src/libs/../binding/f90/.libs/libf90.a")
libtool: link: ar cru .libs/libpnetcdf.a   .libs/libpnetcdf.lax/libdispatchers.a/attr_getput.o .libs/libpnetcdf.lax/libdispatchers.a/attribute.o .libs/libpnetcdf.lax/libdispatchers.a/dimension.o .libs/libpnetcdf.lax/libdispatchers.a/error_codes.o .libs/libpnetcdf.lax/libdispatchers.a/file.o .libs/libpnetcdf.lax/libdispatchers.a/lib_version.o .libs/libpnetcdf.lax/libdispatchers.a/var_getput.o .libs/libpnetcdf.lax/libdispatchers.a/variable.o  .libs/libpnetcdf.lax/libcommon.a/check_name.o .libs/libpnetcdf.lax/libcommon.a/convert_swap.o .libs/libpnetcdf.lax/libcommon.a/create_imaptype.o .libs/libpnetcdf.lax/libcommon.a/dtype_decode.o .libs/libpnetcdf.lax/libcommon.a/error_mpi2nc.o .libs/libpnetcdf.lax/libcommon.a/error_posix2nc.o .libs/libpnetcdf.lax/libcommon.a/hash_map.o .libs/libpnetcdf.lax/libcommon.a/mem_alloc.o .libs/libpnetcdf.lax/libcommon.a/ncx.o .libs/libpnetcdf.lax/libcommon.a/pack_unpack.o .libs/libpnetcdf.lax/libcommon.a/utf8proc.o .libs/libpnetcdf.lax/libcommon.a/utils.o  .libs/libpnetcdf.lax/libncmpio.a/ncmpio_attr.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_bput.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_close.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_create.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_dim.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_driver.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_enddef.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_file_io.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_file_misc.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_filetype.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_fill.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_getput.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_hash_func.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_header_get.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_header_put.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_i_getput.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_i_varn.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_intra_node.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_open.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_sync.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_util.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_var.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_vard.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_varn.o .libs/libpnetcdf.lax/libncmpio.a/ncmpio_wait.o  .libs/libpnetcdf.lax/libcxx.a/ncmpiAtt.o .libs/libpnetcdf.lax/libcxx.a/ncmpiByte.o .libs/libpnetcdf.lax/libcxx.a/ncmpiChar.o .libs/libpnetcdf.lax/libcxx.a/ncmpiCheck.o .libs/libpnetcdf.lax/libcxx.a/ncmpiCompoundType.o .libs/libpnetcdf.lax/libcxx.a/ncmpiDim.o .libs/libpnetcdf.lax/libcxx.a/ncmpiDouble.o .libs/libpnetcdf.lax/libcxx.a/ncmpiEnumType.o .libs/libpnetcdf.lax/libcxx.a/ncmpiException.o .libs/libpnetcdf.lax/libcxx.a/ncmpiFile.o .libs/libpnetcdf.lax/libcxx.a/ncmpiFloat.o .libs/libpnetcdf.lax/libcxx.a/ncmpiGroup.o .libs/libpnetcdf.lax/libcxx.a/ncmpiGroupAtt.o .libs/libpnetcdf.lax/libcxx.a/ncmpiInt.o .libs/libpnetcdf.lax/libcxx.a/ncmpiInt64.o .libs/libpnetcdf.lax/libcxx.a/ncmpiOpaqueType.o .libs/libpnetcdf.lax/libcxx.a/ncmpiShort.o .libs/libpnetcdf.lax/libcxx.a/ncmpiType.o .libs/libpnetcdf.lax/libcxx.a/ncmpiUbyte.o .libs/libpnetcdf.lax/libcxx.a/ncmpiUint.o .libs/libpnetcdf.lax/libcxx.a/ncmpiUint64.o .libs/libpnetcdf.lax/libcxx.a/ncmpiUshort.o .libs/libpnetcdf.lax/libcxx.a/ncmpiVar.o .libs/libpnetcdf.lax/libcxx.a/ncmpiVarAtt.o .libs/libpnetcdf.lax/libcxx.a/ncmpiVlenType.o .libs/libpnetcdf.lax/libcxx.a/ncmpi_notyet.o  .libs/libpnetcdf.lax/libf77.a/allf.o .libs/libpnetcdf.lax/libf77.a/inq_libversf.o .libs/libpnetcdf.lax/libf77.a/issyserrf.o .libs/libpnetcdf.lax/libf77.a/strerrnof.o .libs/libpnetcdf.lax/libf77.a/strerrorf.o .libs/libpnetcdf.lax/libf77.a/xinq_libversf.o .libs/libpnetcdf.lax/libf77.a/xstrerrnof.o .libs/libpnetcdf.lax/libf77.a/xstrerrorf.o  .libs/libpnetcdf.lax/libf90.a/pnetcdf.o 
libtool: link: ranlib .libs/libpnetcdf.a
libtool: link: rm -fr .libs/libpnetcdf.lax
libtool: link: ( cd ".libs" && rm -f "libpnetcdf.la" && ln -s "../libpnetcdf.la" "libpnetcdf.la" )

Note that this works whether I add the LIBS=-stdc++ argument to the make command or not.

wkliao commented 1 week ago

Can you confirm this error happens only when using Intel 2025.0.0? In #151, you mentioned using 2024.2. I assume that version works.

bourdin commented 1 week ago

I have not tried again 2024.2. I am building pnetcdf on a new cluster.