This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Trouble making .so (undefined symbols)


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 "!<arch>\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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]