Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 3/3] Find and link with -lmachuser -lhurduser
Date: Fri, 07 Feb 2014 08:01:00 -0000	[thread overview]
Message-ID: <1391759958-972-4-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1391759958-972-1-git-send-email-yao@codesourcery.com>

I see this link error when build native gdb for hurd.

/home/yao/Software/hurd-toolchain/bin/../lib/gcc/i686-pc-gnu/4.8.0/../../../../i686-pc-gnu/bin/ld: gnu-nat.o: undefined reference to symbol 'mach_port_destroy'
/home/yao/Software/hurd-toolchain/bin/../lib/gcc/i686-pc-gnu/4.8.0/../../../../i686-pc-gnu/bin/ld: note: 'mach_port_destroy' is defined in DSO
/home/yao/Software/hurd-toolchain/bin/../i686-pc-gnu/libc/lib/libmachuser.so.1 so try adding it to the linker command line
/home/yao/Software/hurd-toolchain/bin/../i686-pc-gnu/libc/lib/libmachuser.so.1:
could not read symbols: Invalid operation

This patch is to find and link GDB with -lmachuser and -lhurduser.

I find my patch is quite similar to another patch posted here
https://lists.debian.org/debian-hurd/2011/03/msg00198.html
in which, it mentioned that this change "will not be needed in next
version of libc0.3".  However, I don't know much about hurd, and post
the patch for review, because it fixes the build failure after all.

gdb:

2014-02-07  Yao Qi  <yao@codesourcery.com>

	* configure.ac: Invoke AC_SEARCH_LIBS to search libmachuser and
	libhurduser.
	* configure: Regenerated.
---
 gdb/configure    |  114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/configure.ac |    4 ++
 2 files changed, 118 insertions(+), 0 deletions(-)

diff --git a/gdb/configure b/gdb/configure
index 8ae2e09..c4340b7 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -6711,6 +6711,120 @@ if test "$ac_res" != no; then :
 fi
 
 
+# On GNU/Hurd we may need libmachuser and libhurduser (used by gnu-nat.c).
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing mach_port_destroy" >&5
+$as_echo_n "checking for library containing mach_port_destroy... " >&6; }
+if test "${ac_cv_search_mach_port_destroy+set}" = set; 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 mach_port_destroy ();
+int
+main ()
+{
+return mach_port_destroy ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' machuser; 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_mach_port_destroy=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_mach_port_destroy+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_mach_port_destroy+set}" = set; then :
+
+else
+  ac_cv_search_mach_port_destroy=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_mach_port_destroy" >&5
+$as_echo "$ac_cv_search_mach_port_destroy" >&6; }
+ac_res=$ac_cv_search_mach_port_destroy
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing proc_getmsgport" >&5
+$as_echo_n "checking for library containing proc_getmsgport... " >&6; }
+if test "${ac_cv_search_proc_getmsgport+set}" = set; 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 proc_getmsgport ();
+int
+main ()
+{
+return proc_getmsgport ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' hurduser; 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_proc_getmsgport=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_proc_getmsgport+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_proc_getmsgport+set}" = set; then :
+
+else
+  ac_cv_search_proc_getmsgport=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_proc_getmsgport" >&5
+$as_echo "$ac_cv_search_proc_getmsgport" >&6; }
+ac_res=$ac_cv_search_proc_getmsgport
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+
 
 
 
diff --git a/gdb/configure.ac b/gdb/configure.ac
index feb28f3..52aebf5 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -521,6 +521,10 @@ AM_ZLIB
 # On HP/UX we may need libxpdl for dlgetmodinfo (used by solib-pa64.c).
 AC_SEARCH_LIBS(dlgetmodinfo, [dl xpdl])
 
+# On GNU/Hurd we may need libmachuser and libhurduser (used by gnu-nat.c).
+AC_SEARCH_LIBS(mach_port_destroy, machuser)
+AC_SEARCH_LIBS(proc_getmsgport, hurduser)
+
 AM_ICONV
 
 # GDB may fork/exec the iconv program to get the list of supported character
-- 
1.7.7.6


  parent reply	other threads:[~2014-02-07  8:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-07  8:01 [PATCH 0/3] Unbreak build on hurd Yao Qi
2014-02-07  8:01 ` [PATCH 2/3] Fix -Werror=pointer-sign warnings Yao Qi
2014-02-07 11:42   ` Joel Brobecker
2014-02-16  7:39   ` Thomas Schwinge
2014-02-17  3:32     ` Yao Qi
2014-02-07  8:01 ` [PATCH 1/3 OBV] Fix -Wformat warnings in gnu-nat.c Yao Qi
2014-02-16  7:38   ` Thomas Schwinge
2014-02-17  3:32     ` Yao Qi
2014-02-07  8:01 ` Yao Qi [this message]
2014-02-16  7:49   ` [PATCH 3/3] Find and link with -lmachuser -lhurduser Thomas Schwinge
2014-02-17  2:17     ` Yao Qi
2014-02-25  5:10     ` Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1391759958-972-4-git-send-email-yao@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox