pgf90 module and -g : undefined reference


I’m trying to find out why some configure scripts die when using pgf90 as
F90 compiler. The script compiles a trivial module in a subdirectory:

pgf90 -g -c …/conftest-module.f90

and compiles an equally trivial test program in the directory above using
-module to locate the compiled module:

pgf90 -g -module ./subdir conftest.f90

This fails with

/tmp/pgf90zaUblNGcg-y6.o:(.debug_info+0x81): undefined reference to `…Dm_tstmod’

Why ?
Note that ‘-g’ was used in both compilations. Without the ‘-g’ it works fine !


Hi Norbert,

I’m not really sure. Do you have a specific example that I can try to recreate the problem here? I’ve looked at serveral of the configures that I have here but none seem to use conftest-module.f90. Also, which compiler version and OS are you using?


Try these two :

---- conftest-module.f90 ----
module TSTMOD
integer :: i
end type TST_TYPE
end module TSTMOD

---- conftest.f90 -------------------
program f90usemodule
end program f90usemodule

I was using versions 6.2-5 and 6.1-2 on SLES9 and SLES10 and did the following:

% ls
conftest-module.f90 conftest.f90
% mkdir subdir
% cd subdir
% pgf90 -g -c …/conftest-module.f90
% ls
conftest-module.o tstmod.mod
% cd …
% pgf90 -g -module ./subdir conftest.f90
/tmp/pgf90JAUePeimChHU.o:(.debug_info+0x7a): undefined reference to `…Dm_tstmod’

Hi Norbert,

Sorry, I should have seen this in the first post. Debug information is contained in the modules object file since the “.mod” file contains only definitions. Add “subdir/conftest-module.o” to you link to bring in the debug info.

  • Mat