Static linking icpc and pgi

Hi

I am testing out the possibility to change from ifort to pgf90 for a project using Intel MPI. Intel C(icc) and C++(icpc) compilers are used.

When compiling with dynamic libraries libpgc etc everything works fine.

I would like to compile this statically, but I get errors as if I have not included the libraries.

"mpicxx -cxx=icpc -o filename -O3 -static-intel -qopenmp -xHost -align /opt/pgi/linux86-64/18.10/lib/libpgc.a /opt/pgi/linux86-64/18.10/lib/libpgf90.a /opt/pgi/linux86-64/18.10/lib/libpgmath.a /opt/pgi/linux86-64/18.10/lib/libpgftnrtl.a /opt/pgi/linux86-64/18.10/lib/libpgf90_rpm1_p.a /opt/pgi/linux86-64/18.10/lib/libpgf90rtl.a /opt/pgi/linux86-64/18.10/lib/libpgf902.a"

Gives the following:

/private/hraa/code/wire/stoFortran/src/wit_resampleTime.f90:454: undefined reference to pgf90_floorv' /private/hraa/code/wire/stoFortran/src/wit_resampleTime.f90:458: undefined reference to pgf90_floorv’
/private/hraa/code/wire/stoFortran/src/wit_resampleTime.f90:459: undefined reference to pgf90_ceilingv' /private/hraa/code/wire/stoFortran/src/wit_resampleTime.f90:465: undefined reference to pgf90_alloc04_chka_i8’
/private/hraa/code/wire/stoFortran/src/wit_resampleTime.f90:473: undefined reference to pgf90_alloc04_chka_i8' /private/hraa/code/wire/stoFortran/src/wit_resampleTime.f90:490: undefined reference to pgf90_alloc04_chka_i8’
/private/hraa/code/wire/stoFortran/src/wit_resampleTime.f90:511: undefined reference to pgf90_allocated_i8' /private/hraa/code/wire/stoFortran/src/wit_resampleTime.f90:511: undefined reference to pgf90_dealloc03a_i8’
/private/hraa/code/wire/stoFortran/src/wit_resampleTime.f90:511: undefined reference to pgf90_allocated_i8' /private/hraa/code/wire/stoFortran/src/wit_resampleTime.f90:511: undefined reference to pgf90_dealloc03a_i8’
/private/hraa/code/wire/stoFortran/src/wit_resampleTime.f90:511: undefined reference to pgf90_allocated_i8' /private/hraa/code/wire/stoFortran/src/wit_resampleTime.f90:511: undefined reference to pgf90_dealloc03a_i8’
stoFortran/libstoFortran.a(wit_resampleTime.o): In function `time_output8__11F1L477_':

etc etc

Anyone have any idea why this fails?

Hi hhward,

Those symbols are found in libpgf90.a which you have on the link line.

Maybe it’s an ordering issue where the libraries are being added before the object? Try adding the libraries to the link line at the end, after you add the objects.

Not sure which linker Intel uses but some linkers can handle objects and libraries in any order, others need dependencies places after.

-Mat