-ipo and undefined reference to 'MAIN__'

-ipo and undefined reference to 'MAIN__'

Hello, I am a quite novice ifort user. I need to compile my program with -ipo option. It fails with the message:

ifort_8.1.024/lib/for_main.o(.text+0x28): In function `main': undefined reference to `MAIN__'

It only works when I specify -ipo_obj as well. This compiler behaves the same way on the following short program:

program for_main
    integer :: a
 
    a = 0
end program for_main

Any idea?
Thanx,
Pavel

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Try changing the name of your program from for_main to something else, as I think there is a library routine by that name.

Steve - Intel Developer Support

Look plz at my output

[]$ ifort -c -ipo test.F90 
[]$ ifort -o test test.o
ifort_8.1.024/lib/for_main.o(.text+0x28): In function `main':
: undefined reference to `MAIN__'
[]$ nm test.o
(nm shows nothing)

And using -ipo_obj

[]$ ifort -c -ipo -ipo_obj test.F90
[]$ ifort -o test test.o
(no errors)
[pmankevi@nstmklel1 bld]$ nm test.o
                 U for_set_reentrancy
0000000000000000 d LITPACK_0.0.0
0000000000000000 T MAIN__

I understand -ipo doesn't generate .o files the same way the compiler does without -ipo. But fortran user guied doesn't mention that I must specify -ipo_obj along with -ipo flag. Is it correct, or there is some other way of using -ipo without -ipo_obj and above error could be avoided?

Pavel

Leave a Comment

Please sign in to add a comment. Not a member? Join today