Link in a static library built with gcc

Hello,
Is it possible to build an application with the PGI compiler, but link in an external library built statically with gcc?

I am working on Titan, which is a Cray supercomputer at ORNL. The application uses OpenACC and is written in Fortran.

Building as

ftn -g -C -I <path-to-adios2>/adios2-installation/gcc-7.2.0-release/include/fortran -DDEBUG -c adios2_test.F90

results in a ‘Corrupt or Old Module file’ error.

PGF90-F-0004-Corrupt or Old Module file <path-to-adios2>/adios2-installation/gcc-7.2.0-release/include/fortran/adios2.mod (adios2_test.F90: 6)

The external library was built with gcc-7.2.0. I tried building the application with PGI/16.10.0 and PGI/17.9.0.

My loaded modules are:

  1. eswrap/1.3.3-1.020200.1280.0
  2. craype-network-gemini
  3. cray-mpich/7.6.3
  4. craype-interlagos
  5. lustredu/1.4
  6. xalt/0.7.5
  7. git/2.13.0
  8. module_msg/0.1
  9. modulator/1.2.0
  10. hsi/5.0.2.p1
  11. DefApps
  12. pgi/17.9.0
  13. craype/2.5.13
  14. python/3.5.1
  15. cmake3/3.9.0
  16. cray-libsci/16.11.1
  17. udreg/2.3.2-1.0502.10518.2.17.gem
  18. ugni/6.0-1.0502.10863.8.28.gem
  19. pmi/5.0.12
  20. dmapp/7.0.1-1.0502.11080.8.74.gem
  21. gni-headers/4.0-1.0502.10859.7.8.gem
  22. xpmem/0.1-2.0502.64982.5.3.gem
  23. dvs/2.5_0.9.0-1.0502.2188.1.113.gem
  24. alps/5.2.4-2.0502.9774.31.12.gem
  25. rca/1.0.0-2.0502.60530.1.63.gem
  26. atp/2.1.1
  27. PrgEnv-pgi/5.2.82

Your help is appreciated.
–Kshi_tij

Hi Kshi_tij,

Is it possible to build an application with the PGI compiler, but link in an external library built statically with gcc?

Yes, this is fine.

Though, it looks like your questions is more about gfortran compatibility rather than gcc. In general, different Fortran compilers are not compatible, specifically F90 features such as modules and allocatable arrays (due to the descriptor). Each compiler will have their own format for these (they’re not standardized). If you were using F77 interfaces between the two, then you’d be fine.

You’ll need an Adios2 built with PGI in order to use this module.

-Mat

Thanks Mat,
It looks like we cannot build Adios2 with PGI as of now as PGI does not support certain C++11 features.

Since Adios2 is mainly written in C++ with Fortran bindings, I am considering building the bindings with PGI, while building the main library with gcc.

Thanks,
Kshi_tij

I am considering building the bindings with PGI, while building the main library with gcc.

I should have been more specific, that I meant that you’ll need to compile the Fortran portions with PGI. The C/C++ portions can be compiled with GNU (gcc/g++).

PGI does not support certain C++11 features

What feature? In PGI 17.10, all of C++11 and C++14 should be supported. Since we’re interoperable with g++ and use the g++ STL, the level of C++11/14 support will depend on the GNU version that PGI is configured to use. Perhaps your install is configured to use an older GNU version?

We did add GNU 7.2 capability in PGI 18.1.

-Mat

you’ll need to compile the Fortran portions with PGI. The C/C++ portions can be compiled with GNU

Yes, this is what I needed to do. Thanks.

n PGI 17.10, all of C++11 and C++14 should be supported.

Great! Thanks!