On Mon, Feb 27, 2012 at 5:35 PM, Robert Story <[email protected]> wrote:

> On Wed, 15 Feb 2012 11:36:17 +0100 Bart wrote:
> BVA> Update: the changes that were present on the master+ntpd-fix branch
> BVA> have been committed on the v5.7 and master branches, and the
> BVA> master+ntpd-fix branch itself has been deleted.
>
> I updated today, ran 'make distclean', reconfigured, build and installed.
> Following the sub-agent tutorial, I ran 'net-snmp-config --compile-subagent
> mysubagent nstAgentSubagentObject.c' and I get:
>
> /usr/bin/ld: /tmp/snmp/trunk/lib/libnetsnmp.a(tools.o): undefined
> reference to symbol 'clock_gettime@@GLIBC_2.2.5'
> /usr/bin/ld: note: 'clock_gettime@@GLIBC_2.2.5' is defined in DSO
> /lib64/librt.so.1 so try adding it to the linker command line
> /lib64/librt.so.1: could not read symbols: Invalid operation
>

I haven't been able to reproduce this, probably because I'm using another
Linux distribution. Anyway, does the attached patch help ?

Bart.

[PATCH] Add -lrt to NETSNMPLIBS

---
 configure                       |  145
++++++++++++++++++++++-----------------
 configure.d/config_os_functions |    3 +-
 configure.d/config_os_libs1     |    6 --
 configure.d/config_os_libs2     |    8 ++
 4 files changed, 92 insertions(+), 70 deletions(-)

diff --git a/configure b/configure
index 7f58983..b1f04b5 100755
--- a/configure
+++ b/configure
@@ -18945,67 +18945,6 @@ rm -f confcache
 #########################################


-#
-# clock_gettime()
-#
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing
clock_gettime" >&5
-$as_echo_n "checking for library containing clock_gettime... " >&6; }
-if ${ac_cv_search_clock_gettime+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char clock_gettime ();
-int
-main ()
-{
-return clock_gettime ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' rt posix4; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_clock_gettime=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_clock_gettime+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_clock_gettime+:} false; then :
-
-else
-  ac_cv_search_clock_gettime=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result:
$ac_cv_search_clock_gettime" >&5
-$as_echo "$ac_cv_search_clock_gettime" >&6; }
-ac_res=$ac_cv_search_clock_gettime
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-
-
 ##
 #   RPM checks
 #
@@ -21886,6 +21825,88 @@ $as_echo "#define HAVE_LIBKSTAT 1" >>confdefs.h



+#
+#   librt
+#
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing
clock_gettime" >&5
+$as_echo_n "checking for library containing clock_gettime... " >&6; }
+if ${netsnmp_cv_func_clock_gettime_LNETSNMPLIBS+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  netsnmp_func_search_save_LIBS="$LIBS"
+     netsnmp_target_val="$LNETSNMPLIBS"
+          netsnmp_temp_LIBS="${netsnmp_target_val}  ${LIBS}"
+     netsnmp_result=no
+     LIBS="${netsnmp_temp_LIBS}"
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  netsnmp_result="none required"
+else
+  for netsnmp_cur_lib in rt ; do
+              LIBS="-l${netsnmp_cur_lib} ${netsnmp_temp_LIBS}"
+              cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  netsnmp_result=-l${netsnmp_cur_lib}
+                   break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+          done
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     LIBS="${netsnmp_func_search_save_LIBS}"
+     netsnmp_cv_func_clock_gettime_LNETSNMPLIBS="${netsnmp_result}"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result:
$netsnmp_cv_func_clock_gettime_LNETSNMPLIBS" >&5
+$as_echo "$netsnmp_cv_func_clock_gettime_LNETSNMPLIBS" >&6; }
+ if test "${netsnmp_cv_func_clock_gettime_LNETSNMPLIBS}" != "no" ; then
+    if test "${netsnmp_cv_func_clock_gettime_LNETSNMPLIBS}" != "none
required" ; then
+       LNETSNMPLIBS="${netsnmp_result} ${netsnmp_target_val}"
+    fi
+    $as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
+
+
+ fi
+
+
+
 ##
 #   MIB-module-specific checks
 ##
@@ -24991,7 +25012,7 @@ done


 #  Library:
-for ac_func in
clock_gettime
closedir        fgetc_unlocked  flockfile
fork            funlockfile     getipnodebyname
gettimeofday    if_nametoindex  mkstemp
opendir         readdir         regcomp
setenv          setitimer       setlocale
setsid          snprintf        strcasestr
strdup          strerror        strncasecmp
sysconf         times           vsnprintf
+for ac_func in closedir        fgetc_unlocked
flockfile                        fork            funlockfile
getipnodebyname                  gettimeofday    if_nametoindex
mkstemp                          opendir         readdir
regcomp                          setenv          setitimer
setlocale                        setsid          snprintf
strcasestr                       strdup          strerror
strncasecmp                      sysconf         times           vsnprintf
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/configure.d/config_os_functions
b/configure.d/config_os_functions
index 0da92e7..3c5385b 100644
--- a/configure.d/config_os_functions
+++ b/configure.d/config_os_functions
@@ -31,8 +31,7 @@ AC_CHECK_FUNCS([lrand48         rand          random    ]
dnl
                [signal          sigset                  ] )

 #  Library:
-AC_CHECK_FUNCS([clock_gettime                                    ] dnl
-               [closedir        fgetc_unlocked  flockfile        ] dnl
+AC_CHECK_FUNCS([closedir        fgetc_unlocked  flockfile        ] dnl
                [fork            funlockfile     getipnodebyname  ] dnl
                [gettimeofday    if_nametoindex  mkstemp          ] dnl
                [opendir         readdir         regcomp          ] dnl
diff --git a/configure.d/config_os_libs1 b/configure.d/config_os_libs1
index c24acc9..35f052a 100644
--- a/configure.d/config_os_libs1
+++ b/configure.d/config_os_libs1
@@ -7,12 +7,6 @@
 #########################################


-#
-# clock_gettime()
-#
-AC_SEARCH_LIBS([clock_gettime],[rt posix4])
-
-
 ##
 #   RPM checks
 #
diff --git a/configure.d/config_os_libs2 b/configure.d/config_os_libs2
index fa846c8..cde0ee9 100644
--- a/configure.d/config_os_libs2
+++ b/configure.d/config_os_libs2
@@ -158,6 +158,14 @@ NETSNMP_SEARCH_LIBS(kstat_lookup, kstat,
         LNETSNMPLIBS)


+#
+#   librt
+#
+
+NETSNMP_SEARCH_LIBS(clock_gettime, rt, [AC_DEFINE([HAVE_CLOCK_GETTIME])],,,
+                    LNETSNMPLIBS)
+
+
 ##
 #   MIB-module-specific checks
 ##
-- 
1.7.7
From 30e2a411fb06bbddba2d50f511ab7daa5f967ec3 Mon Sep 17 00:00:00 2001
From: Bart Van Assche <[email protected]>
Date: Mon, 27 Feb 2012 18:42:58 +0000
Subject: [PATCH] Add -lrt to NETSNMPLIBS

---
 configure                       |  145 ++++++++++++++++++++++-----------------
 configure.d/config_os_functions |    3 +-
 configure.d/config_os_libs1     |    6 --
 configure.d/config_os_libs2     |    8 ++
 4 files changed, 92 insertions(+), 70 deletions(-)

diff --git a/configure b/configure
index 7f58983..b1f04b5 100755
--- a/configure
+++ b/configure
@@ -18945,67 +18945,6 @@ rm -f confcache
 #########################################
 
 
-#
-# clock_gettime()
-#
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
-$as_echo_n "checking for library containing clock_gettime... " >&6; }
-if ${ac_cv_search_clock_gettime+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char clock_gettime ();
-int
-main ()
-{
-return clock_gettime ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' rt posix4; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_clock_gettime=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_clock_gettime+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_clock_gettime+:} false; then :
-
-else
-  ac_cv_search_clock_gettime=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
-$as_echo "$ac_cv_search_clock_gettime" >&6; }
-ac_res=$ac_cv_search_clock_gettime
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-
-
 ##
 #   RPM checks
 #
@@ -21886,6 +21825,88 @@ $as_echo "#define HAVE_LIBKSTAT 1" >>confdefs.h
 
 
 
+#
+#   librt
+#
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
+$as_echo_n "checking for library containing clock_gettime... " >&6; }
+if ${netsnmp_cv_func_clock_gettime_LNETSNMPLIBS+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  netsnmp_func_search_save_LIBS="$LIBS"
+     netsnmp_target_val="$LNETSNMPLIBS"
+          netsnmp_temp_LIBS="${netsnmp_target_val}  ${LIBS}"
+     netsnmp_result=no
+     LIBS="${netsnmp_temp_LIBS}"
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  netsnmp_result="none required"
+else
+  for netsnmp_cur_lib in rt ; do
+              LIBS="-l${netsnmp_cur_lib} ${netsnmp_temp_LIBS}"
+              cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  netsnmp_result=-l${netsnmp_cur_lib}
+                   break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+          done
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     LIBS="${netsnmp_func_search_save_LIBS}"
+     netsnmp_cv_func_clock_gettime_LNETSNMPLIBS="${netsnmp_result}"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $netsnmp_cv_func_clock_gettime_LNETSNMPLIBS" >&5
+$as_echo "$netsnmp_cv_func_clock_gettime_LNETSNMPLIBS" >&6; }
+ if test "${netsnmp_cv_func_clock_gettime_LNETSNMPLIBS}" != "no" ; then
+    if test "${netsnmp_cv_func_clock_gettime_LNETSNMPLIBS}" != "none required" ; then
+       LNETSNMPLIBS="${netsnmp_result} ${netsnmp_target_val}"
+    fi
+    $as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
+
+
+ fi
+
+
+
 ##
 #   MIB-module-specific checks
 ##
@@ -24991,7 +25012,7 @@ done
 
 
 #  Library:
-for ac_func in clock_gettime                                                    closedir        fgetc_unlocked  flockfile                        fork            funlockfile     getipnodebyname                  gettimeofday    if_nametoindex  mkstemp                          opendir         readdir         regcomp                          setenv          setitimer       setlocale                        setsid          snprintf        strcasestr                       strdup          strerror        strncasecmp                      sysconf         times           vsnprintf
+for ac_func in closedir        fgetc_unlocked  flockfile                        fork            funlockfile     getipnodebyname                  gettimeofday    if_nametoindex  mkstemp                          opendir         readdir         regcomp                          setenv          setitimer       setlocale                        setsid          snprintf        strcasestr                       strdup          strerror        strncasecmp                      sysconf         times           vsnprintf
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/configure.d/config_os_functions b/configure.d/config_os_functions
index 0da92e7..3c5385b 100644
--- a/configure.d/config_os_functions
+++ b/configure.d/config_os_functions
@@ -31,8 +31,7 @@ AC_CHECK_FUNCS([lrand48         rand          random    ] dnl
                [signal          sigset                  ] )
 
 #  Library:
-AC_CHECK_FUNCS([clock_gettime                                    ] dnl
-               [closedir        fgetc_unlocked  flockfile        ] dnl
+AC_CHECK_FUNCS([closedir        fgetc_unlocked  flockfile        ] dnl
                [fork            funlockfile     getipnodebyname  ] dnl
                [gettimeofday    if_nametoindex  mkstemp          ] dnl
                [opendir         readdir         regcomp          ] dnl
diff --git a/configure.d/config_os_libs1 b/configure.d/config_os_libs1
index c24acc9..35f052a 100644
--- a/configure.d/config_os_libs1
+++ b/configure.d/config_os_libs1
@@ -7,12 +7,6 @@
 #########################################
 
 
-#
-# clock_gettime()
-#
-AC_SEARCH_LIBS([clock_gettime],[rt posix4])
-
-
 ##
 #   RPM checks
 #
diff --git a/configure.d/config_os_libs2 b/configure.d/config_os_libs2
index fa846c8..cde0ee9 100644
--- a/configure.d/config_os_libs2
+++ b/configure.d/config_os_libs2
@@ -158,6 +158,14 @@ NETSNMP_SEARCH_LIBS(kstat_lookup, kstat,
         LNETSNMPLIBS)
 
 
+#
+#   librt
+#
+
+NETSNMP_SEARCH_LIBS(clock_gettime, rt, [AC_DEFINE([HAVE_CLOCK_GETTIME])],,,
+                    LNETSNMPLIBS)
+
+
 ##
 #   MIB-module-specific checks
 ##
-- 
1.7.7

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to