gnutls-devel
[Top][All Lists]
Advanced

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

Re: Problem with cross build for windows on linux with shared libraries


From: Tomasz Gajewski
Subject: Re: Problem with cross build for windows on linux with shared libraries
Date: Thu, 5 Sep 2013 20:49:32 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

B. Scott Michel <scottm <at> aero.org> writes:

> 
> On 9/5/2013 1:36 AM, Tomasz Gajewski wrote:
> > I've checked that this symbol is available in four built libraries:
> >
> > ./gnutls-3.2.3/lib/.libs/libgnutlsxx-28.dll
> > ./gnutls-3.2.3/lib/.libs/libgnutls-xssl-0.dll
> > ./gnutls-3.2.3/lib/.libs/libgnutls-28.dll
> > ./gnutls-3.2.3/extra/.libs/libgnutls-openssl-27.dll
> >
> > but it is exported using def files only from:
> >
> > ./gnutls-3.2.3/lib/.libs/libgnutls-xssl-0.dll
> > ./gnutls-3.2.3/extra/.libs/libgnutls-openssl-27.dll
> >
> >
> > I don't know how those libraries are expected to be used (as replacements or
> > some extension plugins) and in consequence I don't know if how this should
> > be fixed.
> >
> > I see two ways of fixing:
> >
> >    - extend def file for libgnutls-28.dll with rpl_* functions
> >    - add one of those libraries which have rpl_* functions exported to link
> > command for psktool.exe
> >
> > What do you think about this?
> 
> ".def" symbol export files should be avoided, if at all possible. Use 
> the '.dll.a' archives -- libtool ensures that the '.dll.a' files are 
> properly generated.

I'm just changing scripts from mxe project to make shared build. They make
builds in source tree and when I found def files I assumed they are used to
make export ibraries (dll.a files). Now I checked that it is the other way -
they are generated during library link. I'm using dll.a files for linking
right now although binutils documentation says it is better to link directly
to dll files right now in almost all cases. Mayby I will experiment with
changing that later.

> However, this requires that the gnutls library do two things: (a) use 
> symbol visibility attributes in the code to mark imported/exported 
> functions, (b) arrange for the "right" symbol visibility when compiling 
> the library vs. compiling non-library/application code. For the WinXX 
> platform, import vs. export preprocessor header file management isn't 
> complicated, but can be messy. There is a subtle benefit for the Linux 
> and shared object platforms: gnutls can hide symbols and generally speed 
> up dynamic linking (as opposed to making all symbols visible, which is 
> the default.)
> 
> The patch to pull off (a) and (b) is not small and it isn't incremental. 
> Additionally, there's some gnulib hacking foo required to expose 
> symbols, since gnulib doesn't natively include symbol visibility
> attributes.

Yes. I know how it works on windows and also on linux and I also know that I
lack this "gnulib hacking foo" :-)

The problem is fixed for me after suggestion from Eli. I have reordered
library dependencies to always have ../gl/libgnu.la after $(LIBOPTS_LDADD)
and build succeeded. Patch below in case it is useful for anyone.

Regards
Tomasz Gajewski

--- gnutls-3.2.3.orig/src/Makefile.am   2013-03-03 10:04:09.000000000 +0100
+++ gnutls-3.2.3/src/Makefile.am        2013-09-05 22:35:59.000000000 +0200
@@ -66,16 +66,16 @@
 
 if ENABLE_SRP
 srptool_SOURCES = srptool.c
-srptool_LDADD = ../lib/libgnutls.la libcmd-srp.la ../gl/libgnu.la 
-srptool_LDADD += $(LIBOPTS_LDADD) $(LTLIBINTL)
+srptool_LDADD = ../lib/libgnutls.la libcmd-srp.la
+srptool_LDADD += $(LIBOPTS_LDADD) ../gl/libgnu.la  $(LTLIBINTL)
 noinst_LTLIBRARIES += libcmd-srp.la
 libcmd_srp_la_CFLAGS =
 libcmd_srp_la_SOURCES = srptool-args.def srptool-args.c srptool-args.h
 endif
 
 psktool_SOURCES = psk.c
-psktool_LDADD = ../lib/libgnutls.la libcmd-psk.la ../gl/libgnu.la 
-psktool_LDADD += $(LIBOPTS_LDADD) $(LTLIBINTL)
+psktool_LDADD = ../lib/libgnutls.la libcmd-psk.la
+psktool_LDADD += $(LIBOPTS_LDADD) ../gl/libgnu.la  $(LTLIBINTL)
 noinst_LTLIBRARIES += libcmd-psk.la
 libcmd_psk_la_CFLAGS = 
 libcmd_psk_la_SOURCES = psk-args.def psk-args.c psk-args.h
@@ -85,8 +85,8 @@
 
 ocsptool_SOURCES = ocsptool.c ocsptool-common.h ocsptool-common.c \
        socket.c socket.h
-ocsptool_LDADD = ../lib/libgnutls.la libcmd-ocsp.la ../gl/libgnu.la 
-ocsptool_LDADD += $(LIBOPTS_LDADD) $(LTLIBINTL) $(GETADDRINFO_LIB)
+ocsptool_LDADD = ../lib/libgnutls.la libcmd-ocsp.la
+ocsptool_LDADD += $(LIBOPTS_LDADD) ../gl/libgnu.la  $(LTLIBINTL)
$(GETADDRINFO_LIB)
 noinst_LTLIBRARIES += libcmd-ocsp.la
 libcmd_ocsp_la_CFLAGS =
 libcmd_ocsp_la_SOURCES = ocsptool-args.def ocsptool-args.h ocsptool-args.c
@@ -98,8 +98,8 @@
   common.h common.c            \
   certtool-common.h 
 gnutls_serv_LDADD = ../lib/libgnutls.la
-gnutls_serv_LDADD += libcmd-serv.la ../gl/libgnu.la
-gnutls_serv_LDADD += $(LIBOPTS_LDADD) $(LTLIBINTL)
+gnutls_serv_LDADD += libcmd-serv.la
+gnutls_serv_LDADD += $(LIBOPTS_LDADD) ../gl/libgnu.la $(LTLIBINTL)
 gnutls_serv_LDADD += $(LIBSOCKET) $(GETADDRINFO_LIB)
 noinst_LTLIBRARIES += libcmd-serv.la
 libcmd_serv_la_CFLAGS =
@@ -116,7 +116,7 @@
 if ENABLE_DANE
 gnutls_cli_LDADD += ../libdane/libgnutls-dane.la
 endif
-gnutls_cli_LDADD += libcmd-cli.la ../gl/libgnu.la $(LIBOPTS_LDADD) $(LTLIBINTL)
+gnutls_cli_LDADD += libcmd-cli.la $(LIBOPTS_LDADD) ../gl/libgnu.la $(LTLIBINTL)
 gnutls_cli_LDADD += $(LIBSOCKET) $(GETADDRINFO_LIB) $(LIB_CLOCK_GETTIME) \
         $(SERVENT_LIB)
 noinst_LTLIBRARIES += libcmd-cli.la
@@ -128,8 +128,7 @@
 gnutls_cli_debug_SOURCES = cli-debug.c tests.h tests.c \
                socket.c socket.h common.h common.c
 gnutls_cli_debug_LDADD = ../lib/libgnutls.la libcmd-cli-debug.la 
-gnutls_cli_debug_LDADD += ../gl/libgnu.la
-gnutls_cli_debug_LDADD += $(LIBOPTS_LDADD) $(LTLIBINTL)
+gnutls_cli_debug_LDADD += $(LIBOPTS_LDADD) ../gl/libgnu.la $(LTLIBINTL)
 gnutls_cli_debug_LDADD += $(LIBSOCKET) $(GETADDRINFO_LIB)
 noinst_LTLIBRARIES += libcmd-cli-debug.la
 libcmd_cli_debug_la_CFLAGS =
@@ -145,8 +144,8 @@
 libcmd_certtool_la_CFLAGS =
 libcmd_certtool_la_SOURCES = certtool-args.c certtool-args.def
certtool-args.h \
        certtool-cfg.h certtool-cfg.c
-libcmd_certtool_la_LIBADD = ../gl/libgnu.la ../lib/libgnutls.la
-libcmd_certtool_la_LIBADD += $(LIBOPTS_LDADD) $(LTLIBINTL)
+libcmd_certtool_la_LIBADD = ../lib/libgnutls.la
+libcmd_certtool_la_LIBADD += $(LIBOPTS_LDADD) ../gl/libgnu.la $(LTLIBINTL)
 libcmd_certtool_la_LIBADD += $(LTLIBREADLINE)
 libcmd_certtool_la_LIBADD += $(INET_PTON_LIB)
 
@@ -161,8 +160,8 @@
 libcmd_danetool_la_CFLAGS =
 libcmd_danetool_la_SOURCES = danetool-args.c danetool-args.def
danetool-args.h \
        certtool-cfg.h certtool-cfg.c
-libcmd_danetool_la_LIBADD = ../gl/libgnu.la ../lib/libgnutls.la
-libcmd_danetool_la_LIBADD += $(LIBOPTS_LDADD) $(LTLIBINTL)
+libcmd_danetool_la_LIBADD = ../lib/libgnutls.la
+libcmd_danetool_la_LIBADD += $(LIBOPTS_LDADD) ../gl/libgnu.la $(LTLIBINTL)
 libcmd_danetool_la_LIBADD += $(LTLIBREADLINE)
 libcmd_danetool_la_LIBADD += $(INET_PTON_LIB)
 
@@ -172,8 +171,8 @@
 p11tool_SOURCES = p11tool-args.def p11tool.c pkcs11.c certtool-common.c \
        certtool-extras.c p11tool.h common.c
 p11tool_LDADD = ../lib/libgnutls.la
-p11tool_LDADD += libcmd-p11tool.la ../gl/libgnu.la
-p11tool_LDADD += $(LIBOPTS_LDADD) $(LTLIBINTL)
+p11tool_LDADD += libcmd-p11tool.la
+p11tool_LDADD += $(LIBOPTS_LDADD) ../gl/libgnu.la $(LTLIBINTL)
 
 noinst_LTLIBRARIES += libcmd-p11tool.la
 libcmd_p11tool_la_CFLAGS =
@@ -188,8 +187,8 @@
 
 tpmtool_SOURCES = tpmtool-args.def tpmtool.c certtool-common.c
certtool-extras.c common.c
 tpmtool_LDADD = ../lib/libgnutls.la
-tpmtool_LDADD += libcmd-tpmtool.la ../gl/libgnu.la
-tpmtool_LDADD += $(LIBOPTS_LDADD) $(LTLIBINTL)
+tpmtool_LDADD += libcmd-tpmtool.la
+tpmtool_LDADD += $(LIBOPTS_LDADD) ../gl/libgnu.la $(LTLIBINTL)
 
 noinst_LTLIBRARIES += libcmd-tpmtool.la
 libcmd_tpmtool_la_CFLAGS =






reply via email to

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