Paul and I have been talking about the below issue and I thought it would be useful to update the list just in case someone else runs into this problem and ends up searching the email list before we actually fix the issue.

The problem is OMPI's configure tests to see if -lm is needed to get math library functions (eg ceil, sqrt...).  In the case that one is using the Solaris Studio compilers (from Oracle) and one passes in the -fast option via CFLAGS the -lm test in configure will turn out false because -fast set the -xlibmopt flag which provides inline versions of some of the math library function.  Because of that OMPI decides it doesn't need to set -lm for linking.

The above is problematic when configuring with -with-lsf because the lsf library has a symbol of ceil that needs to be resolved (so it needs -lm in the case of Studio compilers).  Without the -lm the configure check for lsf fails.

There are several work arounds:

1.  Put LIBS="-lm" on the configure line.  The compiler still will inline the math function compiled in OMPI but linking of the ompi libs with lsf libs will work because of the -lm.

2.  In the CFLAGS add -xnolibmopt in addition to -fast.  This will turn off the inlining and cause OMPI's configure script to insert -lm.

3.  Don't use -fast.

On 04/07/2011 08:36 AM, Paul Kapinos wrote:
Hi Terry,

so, the attached ceil.c example file *can* be compiled by "CC" (the Studio C++ compiler), but *cannot* be compiled using "cc" (the Studio C compiler).
$ CC ceil.c
$ cc ceil.c

Did you try to link in the math library -lm?  When I did this your test program worked for me and that actually is the first test that the configure does.

5. Looking into configure.log and searching on `ceil' results: there was a check for the availability of `ceil' for the C compiler (see config.log.ceil). This check says `ceil' is *available* for the "cc" Compiler, which is *wrong*, cf. (4).
See above, it actually is right when you link in the math lib.

Thankt for the tipp! Yes, if using -lm so the Studio C compiler "cc" works also fine for ceil.c:

$ cc ceil.c -lm

So, is there an error in the configure stage? Or either the checks in config.log.ceil does not rely on the avilability of the `ceil' funcion in the C compiler?
It looks to me like the lbat configure test is not linking in the math lib.

Yes, the is no -lm in configure:84213 line.

Note the cheks for ceil again, config.log.ceil. As far as I unterstood these logs, the checks for ceil and for the need of -lm deliver wrong results:

configure:55000: checking if we need -lm for ceil
configure:55104: result: no

configure:55115: checking for ceil
configure:55115: result: yes

So, configure assumes "ceil" is available for  the "cc" compiler without the need for -lm flag - and this is *wrong*, "cc" need -lm.

It seem for me to be an configure issue.



_______________________________________________ users mailing list

Terry D. Dontje | Principal Software Engineer
Developer Tools Engineering | +1.781.442.2631
Oracle - Performance Technologies
95 Network Drive, Burlington, MA 01803