I am using pgf90 on Linux (Redhat 8.0, Pentium III). I have several libraries (.a) that I am trying to link together to create a shared object library (.so). The command line essentially looks like this:
pgf90 -shared -Wl,–whole-archive libLIB1.a libLIB2.a -Wl,–no-whole-archive -lcurses -ltermcap -o libLIB.so
The -Wl option passes options to the linker, the --whole-archive option is required, or nothing from libLIBx.a is put into libLIB.so. The first library contains C code generated by gcc. The second library contains F90 code generated by pgf90. The other libraries contain routines that are needed. There is a Fortran subroutine in libLIB2.a that is called from a C function in libLIB1.a. There are no problems there.
There is a C function in libLIB1.a that is called from a Fortran subroutine in libLIB2.a. This is where the problem is, this C function is listed as undefined in libLIB.so (using the objdump -t command). This was discovered when attempting to load libLIB.so. Using objdump -t on libLIB1.a, the C function is there with the proper name, which exactly matches the undefined name listed in libLIB2.a. Somehow the linker is not able to connect the two together.
Using pgf90 to create a program using these two libraries works fine, i.e. no undefined references occur, and the program runs fine. It is a problem with generating the shared object library.
I tried using the linker option --export-dynamic, but this did not solve the problem. I tried swapping libLIB1.a and libLIB2.a on the command line, but the result was the same. I also tried surrounding libraries with --start-group and --end-group, but also the same results I have tried using the --trace and --trace-symbol=xxx options, but did not learn anything.