bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Build + test problems on OpenSolaris (aka Solaris 11)


From: Simon Josefsson
Subject: Re: Build + test problems on OpenSolaris (aka Solaris 11)
Date: Mon, 02 Nov 2009 13:38:46 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux)

The GnuTLS team received the bug report below, but it appears to be a
gnulib issue.

The problem indicate a sub-optimal approach in gnulib's inet_ntop
module.  It causes link failures due to missing -lnsl on Solaris.  The
m4/inet_ntop.m4 file reads:

  dnl The AC_SEARCH_LIBS call is a hack to persuade the Solaris 8 linker to
  dnl find inet_ntop.
  dnl
  dnl It is the responsibility of gl_INET_NTOP's caller to arrange for
  dnl -lnsl if it is needed.  Normally -lnsl is not needed on Solaris 8,
  dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo
  dnl isn't built on Solaris 8.
  gl_save_LIBS=$LIBS
  AC_SEARCH_LIBS([inet_ntop], [nsl], [],
    [AC_REPLACE_FUNCS([inet_ntop])])
  LIBS=$gl_save_LIBS

In similar situations, other gnulib module provide an variable LIBFOO
that can be used by the application.  Compare m4/sockets.m4 which
provide the LIBSOCKET variable that sometimes evaluates to -lsocket.  I
suggest to do the same in inet_ntop.m4.

How about this patch?  Not tested on Solaris systems, but posted for
review of my general idea.

/Simon

diff --git a/m4/inet_ntop.m4 b/m4/inet_ntop.m4
index 2bbdca1..92a3e7f 100644
--- a/m4/inet_ntop.m4
+++ b/m4/inet_ntop.m4
@@ -17,12 +17,20 @@ AC_DEFUN([gl_INET_NTOP],
   dnl It is the responsibility of gl_INET_NTOP's caller to arrange for
   dnl -lnsl if it is needed.  Normally -lnsl is not needed on Solaris 8,
   dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo
-  dnl isn't built on Solaris 8.
+  dnl isn't built on Solaris 8.  The recommended way to do this is to
+  dnl add $(LIBNSL) to the linker parameters when linking
+  dnl applications/libraries that uses inet_ntop.
   gl_save_LIBS=$LIBS
   AC_SEARCH_LIBS([inet_ntop], [nsl], [],
     [AC_REPLACE_FUNCS([inet_ntop])])
   LIBS=$gl_save_LIBS
 
+  LIBNSL=
+  if test "$ac_cv_search_inet_ntop" != "none needed"; then
+    LIBNSL="$ac_cv_search_inet_ntop"
+  fi
+  AC_SUBST([LIBNSL])
+
   gl_PREREQ_INET_NTOP
 ])
 
diff --git a/modules/inet_ntop b/modules/inet_ntop
index bf7ab75..b3e278c 100644
--- a/modules/inet_ntop
+++ b/modules/inet_ntop
@@ -19,6 +19,9 @@ gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
 
 Makefile.am:
 
+Link:
+$(LIBNSL)
+
 License:
 LGPLv2+
 

Boyan Kasarov <address@hidden> writes:

> Hello,
>
> This is the build output for the example
>
> gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../..  -I../../lib/includes
> -I../../lib/includes -I../../libextra/includes -I../../gl -I../../gl
> -g -O2 -MT ex-serv-export.o -MD -MP -MF .deps/ex-serv-export.Tpo -c -o
> ex-serv-export.o ex-serv-export.c
> mv -f .deps/ex-serv-export.Tpo .deps/ex-serv-export.Po
> /bin/sh ../../libtool --tag=CC   --mode=link gcc -std=gnu99   -g -O2
> -no-install  -o ex-serv-export ex-serv-export.o
> libexamples.la ../../lib/libgnutls.la ../../libextra/libgnutls-extra.la 
> ../../gl/libgnu.la -lsocket 
>
> libtool: link: gcc -std=gnu99 -g -O2 -o ex-serv-export
> ex-serv-export.o  ./.libs/libexamples.a ../../lib/.libs/libgnutls.so 
> ../../libextra/.libs/libgnutls-extra.so 
> /export/home/derex/workspace/gnutls-2.9.8/lib/.libs/libgnutls.so -ltasn1 -lz 
> -lgcrypt ../../gl/.libs/libgnu.a -lsocket 
> -R/export/home/derex/workspace/gnutls-2.9.8/lib/.libs 
> -R/export/home/derex/workspace/gnutls-2.9.8/libextra/.libs -R/tmp/gnutls/lib
>
> ld: warning:
> file /export/home/derex/workspace/gnutls-2.9.8/lib/.libs/libgnutls.so:
> linked to ../../lib/.libs/libgnutls.so: attempted multiple inclusion of
> file
> Undefined                       first referenced
> symbol                             in file
> inet_ntop                           ex-serv-export.o  (symbol belongs to
> implicit dependency /lib/libnsl.so.1)
> ld: fatal: symbol referencing errors. No output written to
> ex-serv-export
>
> On Mon, 2009-11-02 at 11:40 +0100, Simon Josefsson wrote:
>> When you don't use the workaround, what is the value of LIBSOCKET in
>> doc/examples/Makefile?  I think it should contain -lnsl, and should be
>> used when linking ex-serv1.  Can you show the build output?
>
> LIBSOCKET = -lsocket
>
> Boyan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]