open-mpi / hwloc

Hardware locality (hwloc)
https://www.open-mpi.org/projects/hwloc
Other
564 stars 173 forks source link

pointless configure check? #70

Closed ompiteam closed 10 years ago

ompiteam commented 10 years ago

Solaris 9 doesn't have fabsf(), naturally the configure check fails - this however doesn't abort the process - even with no alternatives.

Instead we happily proceed to compile and then fail with: {{{ CC distances.lo "distances.c", line 669: warning: implicit function declaration: fabsf }}} and later at: {{{ CC lstopo-lstopo-cairo.o "lstopo-cairo.c", line 529: warning: empty translation unit CCLD lstopo Undefined first referenced symbol in file fabsf /home/igalic/mgar/pkg/hwloc/trunk/work/solaris9-sparc/build-isa-sparcv8/hwloc-1.4.1/src/.libs/libhwloc.so ld: fatal: Symbol referencing errors. No output written to .libs/lstopo gmake[1]: *\ [lstopo] Error 1 }}}

ompiteam commented 10 years ago

Imported from trac issue 69. Created by igalic on 2012-03-22T09:37:08, last modified: 2012-12-22T02:55:59

ompiteam commented 10 years ago

Trac comment by bgoglin on 2012-03-22 10:16:15:

The configure check was only added to bring -lm when needed. I am surprised Paul didn't catch this Solaris 9 issue. I'll add a workaround. Thanks for the report.

ompiteam commented 10 years ago

Trac comment by bgoglin on 2012-03-22 11:35:34:

Can you try this? Google seems to say that fabs (and math.h) are available on solaris 9 and older, and using it (casting from float to double) shouldn't be too bad.

ompiteam commented 10 years ago

Trac comment by bgoglin on 2012-03-22 17:20:38:

I managed to find a Solaris 9 to test the patch. There's a tiny change to apply, but it works otherwise, I'll commit that soon.

Note that this only happens when not using gcc. gcc uses a builtin for fabsf, and I couldn't compile with other compilers, so I used CFLAGS=-fno-builtin to reproduce the problem.

ompiteam commented 10 years ago

Trac comment by bgoglin on 2012-03-22 17:21:47:

(In [4418]) Workaround missing fabsf on Solaris 9 or older.

Use fabs() with a cast to double when fabsf() doesn't exist.

The problem does not occur with gcc because it used a builtin for fabsf (unless -fno-builtin is given)

Fixes #69

Thanks to Igor Galic for the report.