migratio f90 -> pgf90 : file format not recognized


Doing a migration from f90 (sun) to pgf90 (linux) i have the following error:

/usr/bin/ld:OBJ/My_module_XX: file format not recognized; treating as linker script
/usr/bin/ld:OBJ/My_module_XX.o:1: syntax error
*** Error code 2
clearmake: Error: Build script failed for "PROGNAME"

On the makefile:

	$(F90) $(XXMODULE) -o  $@ $(OBJCOM) $(DLDFLAGS)

When make file is “launched”, i have:

       pgf90 XXXX1.o XXXX2.o (...) -o  PROGNAME AFILE.o AFILE2.o ALIB.a

Would you havec any idea about this problem ??
Thanks a lot for your help !!

Hi goethe,

The problem here is that the linker doesn’t know what type of file your objects are. My best guess is that you have an error in compile options which is causing a different type of file to be created, such as “-S” to create an assembly file. Do you have an example of the compile line for “My_module_XX.o”?

  • Mat

Hi, and thanks a lot for your help !

Compile options should be th key point (i haven’t found how to “translate” F90 option to pgf90…)

Here are the line:

F90FLAGS	=	-i4 -r8 -Mcpp -C -IINC -IOBJ -LOBJ

$(DIROBJ)/%.o:	%.F90
	pgf90 $(F90FLAGS) -c $<  -o $@


One possible issue is using “$<”. That can only be used in suffix rules, at least in GNU Make (not sure about clearmake). For a % rule in gmake, I use “$^”. May not solve the underlying issue, though.

The problem is the “-Mcpp” flag which just pre-processes the file using cpp but does not compile it. Remove this flag or change it to “-Mpreprocess” (though .F90 files are preprocessed by default).

Hope this helps,

% pgf90 -help -Mcpp
                    Just preprocess the input files
    m               Print makefile dependencies
    md              Print makefile dependencies to .d file
    mm              Print makefile dependencies; ignore system includes
    mmd             Print makefile dependencies to .d file; ignore system includes
    line            Insert line numbers into preprocess output
    [no]comment     Keep comments in preprocessed output
    suffix:<suff>   Suffix to use for makefile dependencies
    <suff>          Suffix to use for makefile dependencies
    include:<file>  Include file before processing source file
    c89             Use the C89 language
    c99             Use the C99 language

Hello, and thank you for your help.
Infortunatly it does not work…

The flags i had with f90 are:

-xtypemap=integer:32,real:64,double:64 -xpp=cpp -C -u -ftrap=%all,no%inexact -aligncommon=8 -IINC -IOBJ -MOBJ

I am currently doing migration of other easier makefile and librray…
I will tell you if i find the solution !