libtool: static libs where shared can't be built

Charles Wilson cygwin@cwilson.fastmail.fm
Fri Nov 11 05:24:00 GMT 2005


Yaakov S (Cygwin Ports) wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I have a libtool library that has undefined symbols by design, so I need
> to build it static.  But that seems to be impossible:
> 
> 1) Simply omit '-no-undefined':
> 
> 2) Add '-no-undefined -static' to LDFLAGS:
> 
> Either way I get empty static libs.  Is there any way to make this work?

First what does "/bin/sh ../libtool --version" say, when you run it in 
your build directory?  If it doesn't say 1.5.20, then you need to 
re-libtoolize your project.

Second, the "right" way to do this is the following:

1) since you have undefined symbols, you shouldn't lie to libtool by 
saying "-no-undefined'.  On cygwin/mingw, that SHOULD be enough to 
ensure that only a static library is built.  However, you'd still get a 
shared library on other platforms.

2) If you want static only, for all platforms, but just for this 
particular library, then if you're using automake --- use 
target-specific LDFLAGS:

libkscreensaver_la_LDFLAGS = -static [other flags like -version-info]

(or otherwise pass -static [but NOT -no-undefined] to libtool)

3) Now, this is assuming that libkscreensaver is intended to be an 
installed library.  If not, the 'info libtool' and search for 
'convenience library'

--
Chuck

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list