[Nagiosplug-devel] [ nagiosplug-Patches-1864550 ] check_swap: unresolved symbol when compiling under hpux11.11
SourceForge.net
noreply at sourceforge.net
Sat Jan 5 21:18:18 CET 2008
Patches item #1864550, was opened at 2008-01-05 17:18
Message generated for change (Comment added) made by lausser
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1864550&group_id=29880
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: gerhard lausser (lausser)
Assigned to: Nobody/Anonymous (nobody)
Summary: check_swap: unresolved symbol when compiling under hpux11.11
Initial Comment:
Hi,
i tried to build plugins-1.4.11 on a hp-ux 11.11 machine, but it failed with:
-1.4.11/plugins -lm ../lib/libnagiosplug.a ../gl/libgnu.a
/usr/ccs/bin/ld: Unsatisfied symbols:
floorf (first referenced in check_swap.o) (code)
collect2: ld returned 1 exit status
It looks like floorf is not known to this OS. I propose to replace the
warn_size_bytes = floorf(warn_size_bytes);
with
warn_size_bytes = (float) floor(warn_size_bytes);
which converts double to float.
Attached is a patch which let me build the plugins successfully.
Greetings from Munich,
Gerhard
----------------------------------------------------------------------
>Comment By: gerhard lausser (lausser)
Date: 2008-01-05 21:18
Message:
Logged In: YES
user_id=613416
Originator: YES
It compiled successfully under hpux11.11 and after 2 hours of nearly
becoming crazy finally powerpc-ibm-aix5.1.0.0.
The problem with AIX5.1 was that even the "static inline float floorf...."
was included (i checked it with a #error directive), in the end it still
aborted with "unresolved floorf..". I think it is the GCC4.0.0 i found on
this machine. After i removed the "inline" so that i had
"static float floorf (float x) { return floor(x); }"
it compiled without problems.
I still prefer your solution Nr.2, but i strongly recommend to take the
"inline" out, because i am sure, machines with these outdated OSes also
have outdated compilers installed.
Gerhard (with a lot more grey hair now)
----------------------------------------------------------------------
Comment By: Matthias Eble (psychotrahe)
Date: 2008-01-05 19:35
Message:
Logged In: YES
user_id=1694341
Originator: NO
Hi Gerhard,
there already were some problems with floorf in the past. I guess it was
used in check disk.
As a workaround an own floorf function is defined in plugins/common.h but
only for sun systems.
There are two possibilities now:
1st: apply the changes as you suggested, remove floorf function in
common.h and add a hint to developer guidelines to never use floorf again
since it's not portable
2nd: add floorf detection to autoconf and forget about the portability
issue
Google claims that floorf is also not available on AIX and HP-UX (as you
described). So I followed
the comment in common.h and included floorf detection in configure.in.
It'd be great if you could test if this fix works for you as well.
We can then discuss which way we'll implement.
Matthias
$ svn diff configure.in plugins/common.h
Index: configure.in
===================================================================
--- configure.in (revision 1884)
+++ configure.in (working copy)
@@ -151,6 +151,7 @@
dnl check for math-related functions needing -lm
AC_CHECK_HEADERS(math.h)
AC_CHECK_LIB(m,floor,MATHLIBS="-lm")
+AC_CHECK_LIB(m,floorf,[AC_DEFINE(HAVE_FLOORF,1,[Define HAVE_FLOORF if
floorf is available])])
AC_SUBST(MATHLIBS)
dnl Check for libtap, to run perl-like tests
Index: plugins/common.h
===================================================================
--- plugins/common.h (revision 1884)
+++ plugins/common.h (working copy)
@@ -186,8 +186,7 @@
};
#endif
-/* Solaris does not have floorf, but floor works. Should probably be in
configure */
-#if defined(__sun) || defined(__sun__)
+#if !HAVE_FLOORF
static inline float floorf (float x) { return floor(x); }
#endif
----------------------------------------------------------------------
Comment By: gerhard lausser (lausser)
Date: 2008-01-05 19:08
Message:
Logged In: YES
user_id=613416
Originator: YES
Update: The same happens with AIX5.1
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1864550&group_id=29880
More information about the Devel
mailing list