bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44419: Errors when using NVHPC


From: Arturo Fernandez
Subject: bug#44419: Errors when using NVHPC
Date: Tue, 03 Nov 2020 14:38:52 GMT
User-agent: Desktop

Hello,
The linking of shared libraries for several apps with the Nvidia-HPCv20.9 (NVHPC) compilers is producing error messages of the type relocation R_AARCH64_ADR_PREL_PG_HI21. The compilations on x86_64 seem to be working fine but their counterparts on Aarch64 are failing (apparently because libtool is not adding the -fPIC flag). Let me be more specific and use netcdf-fortran (https://github.com/Unidata/netcdf-fortran) as an example. The compilation with NVHPC proceeds almost until the end when it breaks with the following message:
...
libtool: compile:  /opt/openmpi/bin/mpif90 -I. -g -c nf_fortv2.f90 -o nf_fortv2.o >/dev/null 2>&1
/bin/bash ../libtool  --tag=FC   --mode=link /opt/openmpi/bin/mpif90 -I. -g -version-info 7:0:0 -L/opt/openmpi/lib -L/opt/hdf5/lib -L/opt/netcdf/lib -lcurl -o libnetcdff.la -rpath /opt/netcdf/lib nf_attio.lo nf_control.lo nf_dim.lo nf_misc.lo nf_genatt.lo nf_geninq.lo nf_genvar.lo nf_vario.lo nf_var1io.lo nf_varaio.lo nf_varmio.lo nf_varsio.lo nf_logging.lo nf_nc.lo  nf_v2compat.lo nf_fortv2.lo nf_lib.lo nf_nc4.lo libtypeSizes.la libnetcdf_nc_data.la libnetcdf_nf_data.la libnetcdf_nc_interfaces.la libnetcdf_nf_interfaces.la libnetcdfm.la libnetcdf_f03.la libnetcdf_fortv2_c_interfaces.la libnetcdf4_nc_interfaces.la libnetcdf4_nf_interfaces.la libnetcdf4_f03.la -lnetcdf -lm
libtool: link: /opt/openmpi/bin/mpif90 -shared   .libs/nf_attio.o .libs/nf_control.o .libs/nf_dim.o .libs/nf_misc.o .libs/nf_genatt.o .libs/nf_geninq.o .libs/nf_genvar.o .libs/nf_vario.o .libs/nf_var1io.o .libs/nf_varaio.o .libs/nf_varmio.o .libs/nf_varsio.o .libs/nf_logging.o .libs/nf_nc.o .libs/nf_v2compat.o .libs/nf_fortv2.o .libs/nf_lib.o .libs/nf_nc4.o   --whole-archive ./.libs/libtypeSizes.a ./.libs/libnetcdf_nc_data.a ./.libs/libnetcdf_nf_data.a ./.libs/libnetcdf_nc_interfaces.a ./.libs/libnetcdf_nf_interfaces.a ./.libs/libnetcdfm.a ./.libs/libnetcdf_f03.a ./.libs/libnetcdf_fortv2_c_interfaces.a ./.libs/libnetcdf4_nc_interfaces.a ./.libs/libnetcdf4_nf_interfaces.a ./.libs/libnetcdf4_f03.a --no-whole-archive  -L/opt/openmpi/lib -L/opt/hdf5/lib -L/opt/netcdf/lib -lcurl /opt/hdf5/lib/libhdf5_hl.so /opt/hdf5/lib/libhdf5.so -ldl -lz /opt/netcdf/lib/libnetcdf.so -lm  -g   -soname libnetcdff.so.7 -o .libs/libnetcdff.so.7.0.0
/usr/bin/ld: .libs/nf_dim.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `pgf90_ptr_alloc04a_i8' which may bind externally can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: .libs/nf_dim.o(.text+0x28): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `pgf90_ptr_alloc04a_i8'
/usr/bin/ld: final link failed: bad value
make[2]: *** [Makefile:734: libnetcdff.la] Error 2
make[2]: Leaving directory '/home/ubuntu/netcdf-fortran/fortran'
make[1]: *** [Makefile:626: all] Error 2
make[1]: Leaving directory '/home/ubuntu/netcdf-fortran/fortran'
make: *** [Makefile:581: all-recursive] Error 1

I set the environment variables (CFLAGS, CPPFLAGS, FCFLAGS) to include the flag (-fPIC) but it didn't make any difference. In a different system, I followed the same steps but using GNU compilers rather than NVHPC. The compilation completes w/o any issue and, at the same point, it shows:
... 
libtool: link: /opt/openmpi/bin/mpif90 -shared  -fPIC  .libs/nf_attio.o .libs/nf_control.o .libs/nf_dim.o .libs/nf_misc.o .libs/nf_genatt.o .libs/nf_geninq.o .libs/nf_genvar.o .libs/nf_vario.o .libs/nf_var1io.o .libs/nf_varaio.o .libs/nf_varmio.o .libs/nf_varsio.o .libs/nf_logging.o .libs/nf_nc.o .libs/nf_v2compat.o .libs/nf_fortv2.o .libs/nf_lib.o .libs/nf_nc4.o  -Wl,--whole-archive ./.libs/libtypeSizes.a ./.libs/libnetcdf_nc_data.a ./.libs/libnetcdf_nf_data.a ./.libs/libnetcdf_nc_interfaces.a ./.libs/libnetcdf_nf_interfaces.a ./.libs/libnetcdfm.a ./.libs/libnetcdf_f03.a ./.libs/libnetcdf_fortv2_c_interfaces.a ./.libs/libnetcdf4_nc_interfaces.a ./.libs/libnetcdf4_nf_interfaces.a ./.libs/libnetcdf4_f03.a -Wl,--no-whole-archive  -L/opt/openmpi/lib -L/opt/hdf5/lib -L/opt/netcdf/lib /opt/hdf5/lib/libhdf5_hl.so /opt/hdf5/lib/libhdf5.so -lz /usr/lib/aarch64-linux-gnu/libcurl.so /opt/netcdf/lib/libnetcdf.so -ldl -lm  -g -O2   -pthread -Wl,-soname -Wl,libnetcdff.so.7 -o .libs/libnetcdff.so.7.0.0    

Thanks.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]