Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29594 Discussions

Lots of 'undefined reference to' errors when using IPO

casso__pau
Beginner
2,049 Views
Hi

I tried to compile wrf adding -ipo -ipo_obj but it gives a very long 'undefined reference to' error list, like this ones:

module_alloc_space.f90:(.text+0x11d): undefined reference to `wrf_message_'
module_alloc_space.f90:(.text+0x4ed): undefined reference to `wrf_error_fatal_'

The program compiles ok when not using -ipo -ipo_obj , any way to have ipo working ?
0 Kudos
4 Replies
Ron_Green
Moderator
2,049 Views
David,

I was tempted to say that, with respect to compiling WRF with -ipo, some have tried, all have failed. A colleague says that that is an oversimplification.

First, -ipo_obj is no longer supported in newer compilers. You may try -ipo-c as a replacement.

An older version of WRF that was in SPEC2006 is presumably build with -ipo, but we know of no one who builds the main research branch of WRF with -ipo.

IPO is complex and tends to have difficulty with very large and very complex codes such as this. Thus, it may not be feasible to compile the entire application with -ipo. Subsets, perhaps, particularly those involved with computation such as dyn_em and phys.

If you are successful with this effort on the latest WRF, we would of course be interested in your build scripts so that we could update our online WRF build/run guides.

good hunting!

ron
0 Kudos
casso__pau
Beginner
2,049 Views
All those undefined references always have an underscore at the end added by the compiler at some stage, all problematic functions exist but are external, i.e.:

libwrflib.a(module_alloc_space.o): In function `module_alloc_space_mp_alloc_space_field_core_':
module_alloc_space.f90:(.text+0x11d): undefined reference to `wrf_message_'

if i do:

#nm libwrflib.a | grep wrf_message
U wrf_message__ (some of them)

Now, if i compile wrf without ipo and do:

#nm libwrflib.a | grep wrf_message
U wrf_message_ (some of them)
0000000000000000 T wrf_message_

so looks that at some point the compiler is adding an extra underscore when using ipo and also for some reason wrf_message is not added or exported in libwrflib.a

this is a bug/problem/malfunctio in ifort when using -ipo

0 Kudos
Ron_Green
Moderator
2,049 Views
David,

The double underscore is indicative of symbols decorated for use by g77 - g77 used double underscores. IPO would not do this. Is it possible a define somewhere in the build scripts has something like USE_GNU or something that would trigger a build for g77?

ron
0 Kudos
casso__pau
Beginner
2,049 Views
Hi

I hope i found the solution ... the double underscore is because the compiler cannot find that symbol and thinks that this is an external symbol (here why it has the doublke underscore). The real problem is that ar does not work with ipo, just reading the compiler documentation i found a place where it says that xiar should be used instead. Unfortunatelly this was not documented on "Using IPO" chapter (where one should hope to find this kind of information) but in "IPO-Related performance issues" so i take me some time to realize of this.

Now i'm trying to compile wrf using xiar for static libraries and by now it compiles ok altoug compilation has not finalized yet (it's taking a really long time), maybe i will also have to replace ld with xild but looks like it will work.
0 Kudos
Reply