Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <42F07A02.4040308@familiehaase.de> Date: Wed, 03 Aug 2005 10:02:10 +0200 From: "Gerrit P. Haase" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.11) Gecko/20050728 MIME-Version: 1.0 To: Warren Young CC: Cygwin-L Subject: Re: Trouble making .so (undefined symbols) References: <42F02793 DOT 8080109 AT etr-usa DOT com> In-Reply-To: <42F02793.8080109@etr-usa.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Warren Young wrote: > I maintain MySQL++ (http://tangentsoft.net/mysql++/), a C++ API for > MySQL. It builds fine under Cygwin when we create a static library, but > linking fails due to undefined symbols when we ask for a shared object. > > The symptom is the libtool error "libtool: link: warning: undefined > symbols not allowed in i686-pc-cygwin shared libraries" when creating > the shared object itself. I found some messages in the archive saying > that this can be fixed by using the link flag -no-undefined, but that > didn't help. > > Now, libtool just warns here, doesn't return an error code. No .so file > is created in the .libs directory. Also, a mere 8-byte .a file is > created. (It contains "!\n") > > After this point in the MySQL++ build process, several example programs > are built. When linking the first one, we get a spate of errors. I > think this is secondary damage, because it tries to link to that .a > file, but it's basically empty. Naturally g++ can't find any of the > symbol definitions it needs to link the program. > > If you need to play with this to understand what I mean, download the > v2.0 beta 2 source from the URL above...it's LGPL. > > How do I convince libtool to create the bloody .so file? Use the Cygwin autotools (libtool-1.5.18, automake-1.9, autoconf-2.5x) *and* add the flag -no-undefined to libmysqlpp_la_LDFLAGS? And you also need to use a shared libmysqlclient library. Older versions of libtool as included with the tarball don't work. Comments on the tarball: /usr/bin/install -c -m 644 'coldata.h' '/usr/include/coldata.h' /usr/bin/install -c -m 644 'compare.h' '/usr/include/compare.h' /usr/bin/install -c -m 644 'connection.h' '/usr/include/connection.h' [...] /usr/bin/install -c -m 644 'vallist.h' '/usr/include/vallist.h' You should put the headers into a separate directory, e.g. /usr/include/mysql++. Besides that all is fine: $ ls -lRCGF ../.inst ../.inst: usr/ ../.inst/usr: bin/ include/ lib/ ../.inst/usr/bin: cygmysqlpp-2.dll* ../.inst/usr/include: coldata.h defs.h mysql++.h row.h compare.h exceptions.h noexceptions.h sql_string.h connection.h field_names.h null.h stream2string.h const_string.h field_types.h platform.h string_util.h convert.h fields.h qparms.h tiny_int.h custom-macros.h lockable.h query.h type_info.h custom.h manip.h resiter.h vallist.h datetime.h myset.h result.h ../.inst/usr/lib: libmysqlpp.dll.a* libmysqlpp.la* The permissions of the .a and .dll.a files are wrong, I wonder if libtool will ever get this right ;) Send you a patchfile with PM. Gerrit -- =^..^= -- 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/