public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* stunnel build chokes on -no-undefined
@ 2015-05-26 14:55 Andrew Schulman
  2015-05-26 15:38 ` Peter Rosin
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Schulman @ 2015-05-26 14:55 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 1220 bytes --]

In stunnel 5.17, the build of libstunnel.la fails with "can't build shared
library unless -no-undefined is specified":


/bin/sh ../libtool  --tag=CC   --mode=link gcc  -Wl,-no-undefined
-fdebug-prefix-map=/home/andrex/dev/cygwin/stunnel/stunnel-5.17-1.x86_64/build=/usr/src/debug/stunnel-5.17-1
-fdebug-prefix-map=/home/andrex/dev/cygwin/stunnel/stunnel-5.17-1.x86_64/src/stunnel-5.17=/usr/src/debug/stunnel-5.17-1
-Wall -Wextra -Wpedantic -Wformat=2 -Wconversion -Wno-long-long
-Wno-deprecated-declarations -fstack-protector -fPIE -D_FORTIFY_SOURCE=2
-avoid-version -fPIE -pie -o libstunnel.la -rpath /usr/lib env.lo  -lz   -lwrap
libtool:   error: can't build x86_64-unknown-cygwin shared library unless
-no-undefined is specified
Makefile:464: recipe for target 'libstunnel.la' failed


Of course, the libtool command does include -Wl,-no-undefined.  I don't know
much about this, but I do seem to recall that the linker flags should come at
the end, or something like that.

Could anyone please suggest a solution?  I'm attaching stunnel.cygport, and
src/Makefile.am from which the above command was generated.  Please let me know
if there are other files I should provide.

Thanks,
Andrew

[-- Attachment #2: stunnel.cygport --]
[-- Type: application/octet-stream, Size: 999 bytes --]

#
# cygport build script for stunnel
# by Andrew E. Schulman
#

NAME=stunnel
VERSION=5.17
RELEASE=1

# Packaging

SUMMARY="Universal TLS wrapper"
DESCRIPTION="stunnel is a program that allows you to encrypt arbitrary TCP
connections inside TLS (Transport Layer Security, the successor to
Secure Sockets Layer (SSL)).  stunnel can allow you to secure
non-TLS-aware daemons and protocols (like POP, IMAP, LDAP, etc) by
having stunnel provide the encryption, requiring no changes to the
daemon's code."
CATEGORY=Net
HOMEPAGE="http://www.stunnel.org/"

# Sources

SRC_URI="ftp://ftp.stunnel.org/stunnel/archive/5.x/stunnel-${VERSION}.tar.gz"
PATCH_URI="
	stunnel-dirs.patch
	stunnel-exe.patch
	stunnel-localdata.patch
	stunnel-pty.patch
"

# Build

CYGCONF_ARGS=--disable-fips
CFLAGS='-Wl,-no-undefined'

src_install ()
{
	cd "${B}"
	cyginstall

	cd "${D}/usr/share/man"
	for lang in fr pl ; do
		mkdir -p ${lang}/man8
		mv man8/stunnel.${lang}.8 ${lang}/man8/stunnel.8
	done

	dodir /var/lib/stunnel
}

[-- Attachment #3: Makefile.am --]
[-- Type: application/octet-stream, Size: 969 bytes --]

## Process this file with automake to produce Makefile.in

# File lists
common_headers = common.h prototypes.h version.h
common_sources = tls.c str.c file.c client.c log.c options.c protocol.c
common_sources += network.c resolver.c ssl.c ctx.c verify.c sthreads.c
common_sources += fd.c stunnel.c
unix_sources = pty.c libwrap.c ui_unix.c
shared_sources = env.c

# Unix executables
bin_PROGRAMS = stunnel
stunnel_SOURCES = $(common_headers) $(common_sources) $(unix_sources)
bin_SCRIPTS = stunnel3

# Unix shared library
lib_LTLIBRARIES = libstunnel.la
libstunnel_la_SOURCES = $(shared_sources)
libstunnel_la_LDFLAGS = -avoid-version

# Red Hat "by design" bug #82369
stunnel_CPPFLAGS = -I/usr/kerberos/include

# Additional preprocesor definitions
stunnel_CPPFLAGS += -I$(SSLDIR)/include
stunnel_CPPFLAGS += -DLIBDIR='"$(libdir)"'
stunnel_CPPFLAGS += -DCONFDIR='"$(sysconfdir)/stunnel"'

# SSL library
stunnel_LDFLAGS = -L$(SSLDIR)/lib64 -L$(SSLDIR)/lib -lssl -lcrypto

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: stunnel build chokes on -no-undefined
  2015-05-26 14:55 stunnel build chokes on -no-undefined Andrew Schulman
@ 2015-05-26 15:38 ` Peter Rosin
  2015-05-26 16:08   ` Andrew Schulman
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Rosin @ 2015-05-26 15:38 UTC (permalink / raw)
  To: cygwin-apps

On 2015-05-26 16:55, Andrew Schulman wrote:
> In stunnel 5.17, the build of libstunnel.la fails with "can't build shared
> library unless -no-undefined is specified":
> 
> 
> /bin/sh ../libtool  --tag=CC   --mode=link gcc  -Wl,-no-undefined
> -fdebug-prefix-map=/home/andrex/dev/cygwin/stunnel/stunnel-5.17-1.x86_64/build=/usr/src/debug/stunnel-5.17-1
> -fdebug-prefix-map=/home/andrex/dev/cygwin/stunnel/stunnel-5.17-1.x86_64/src/stunnel-5.17=/usr/src/debug/stunnel-5.17-1
> -Wall -Wextra -Wpedantic -Wformat=2 -Wconversion -Wno-long-long
> -Wno-deprecated-declarations -fstack-protector -fPIE -D_FORTIFY_SOURCE=2
> -avoid-version -fPIE -pie -o libstunnel.la -rpath /usr/lib env.lo  -lz   -lwrap
> libtool:   error: can't build x86_64-unknown-cygwin shared library unless
> -no-undefined is specified
> Makefile:464: recipe for target 'libstunnel.la' failed
> 
> 
> Of course, the libtool command does include -Wl,-no-undefined.  I don't know
> much about this, but I do seem to recall that the linker flags should come at
> the end, or something like that.
> 
> Could anyone please suggest a solution?  I'm attaching stunnel.cygport, and
> src/Makefile.am from which the above command was generated.  Please let me know
> if there are other files I should provide.

There is the GNU ld flag --no-undefined (two dashes), and there's the libtool
flag -no-undefined (one dash). They are not the same, and spelling out
-no-undefined does not make libtool feed --no-undefined to the linker.
Nor does libtool look for -Wl,--no-undefined. -Wl,-no-undefined seems to be
some confused hybrid.

The libtool command should almost always include -no-undefined, so you
should probably add that.

Cheers,
Peter

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: stunnel build chokes on -no-undefined
  2015-05-26 15:38 ` Peter Rosin
@ 2015-05-26 16:08   ` Andrew Schulman
  2015-05-26 21:02     ` Peter Rosin
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Schulman @ 2015-05-26 16:08 UTC (permalink / raw)
  To: cygwin-apps

> The libtool command should almost always include -no-undefined, so you
> should probably add that.

OK, thanks.  So, uh... could you suggest how I would add an option to the
libtool command?  Sorry, I'm just not strong on autotools.  Thanks, Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: stunnel build chokes on -no-undefined
  2015-05-26 16:08   ` Andrew Schulman
@ 2015-05-26 21:02     ` Peter Rosin
  2015-05-27 14:04       ` Andrew Schulman
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Rosin @ 2015-05-26 21:02 UTC (permalink / raw)
  To: cygwin-apps

On 2015-05-26 18:07, Andrew Schulman wrote:
>> The libtool command should almost always include -no-undefined, so you
>> should probably add that.
> 
> OK, thanks.  So, uh... could you suggest how I would add an option to the
> libtool command?  Sorry, I'm just not strong on autotools.  Thanks, Andrew
> 

From a quick peek at the source, you should make this change in src/Makefile.am

-libstunnel_la_LDFLAGS = -avoid-version
+libstunnel_la_LDFLAGS = -avoid-version -no-undefined

and then hope that libstunnel has no undefined symbols that need to be
provided by someone else to link a whole program. Most libraries do not
have such undefined symbols. You can probably send that change upstream.

Where did -Wl,-no-undefined come from?

Cheers,
Peter

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: stunnel build chokes on -no-undefined
  2015-05-26 21:02     ` Peter Rosin
@ 2015-05-27 14:04       ` Andrew Schulman
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Schulman @ 2015-05-27 14:04 UTC (permalink / raw)
  To: cygwin-apps

> From a quick peek at the source, you should make this change in src/Makefile.am
> 
> -libstunnel_la_LDFLAGS = -avoid-version
> +libstunnel_la_LDFLAGS = -avoid-version -no-undefined

Right - thanks.  Yep, that takes care of it.

> and then hope that libstunnel has no undefined symbols that need to be
> provided by someone else to link a whole program. Most libraries do not
> have such undefined symbols. You can probably send that change upstream.
> 
> Where did -Wl,-no-undefined come from?

It was added to CFLAGS in the cygport file.  I don't remember why, but I
probably added it myself some time in the past.  Oops.  I've taken it out again
now.

Thanks a lot for your help.

Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-27 14:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-26 14:55 stunnel build chokes on -no-undefined Andrew Schulman
2015-05-26 15:38 ` Peter Rosin
2015-05-26 16:08   ` Andrew Schulman
2015-05-26 21:02     ` Peter Rosin
2015-05-27 14:04       ` Andrew Schulman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).