Hi Balazs, On Feb 22 15:11, Balazs Scheidler wrote:
What about this patch, e.g. create a static library, which makes pdbtool happy and doesn't introduce another shared object.
Unfortunately it doesn't work on Cygwin. I get the following error when trying to link libdbparser: /bin/sh ../../libtool --tag=CC --mode=link gcc -std=gnu99 -Wno-pointer-sign -g -O2 -Wall -avoid-version -module -no-undefined -o libdbparser.la -rpath /usr/lib/syslog-ng libdbparser_la-dbparser.lo libdbparser_la-dbparser-grammar.lo libdbparser_la-dbparser-parser.lo libdbparser_la-dbparser-plugin.lo ../../lib/libsyslog-ng.la libsyslog-ng-patterndb.a *** Warning: Trying to link with static lib archive libsyslog-ng-patterndb.a. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have *** because the file extensions .a of this argument makes me believe *** that it is just a static archive that I should not use here. To get this working on Cygwin as well, you must create both, a static and a shared libsyslog-ng-patterndb. The static one is for linking against pdbtool, the shared one for linking libdbparser.la. Also, when building pdbtool you have to specify libsyslog-ng-patterndb.a prior to ../../lib/libsyslog-ng.la in the LDADD library list, since when linking PE/COFF binaries, the order of libs given on the gcc command line is followed strictly. There's no backward reference possible. Thus the original order fails to link since functions in libsyslog-ng-patterndb.a reference symbols in ../../lib/libsyslog-ng.la. Below's a matching patch against git HEAD. Thanks, Corinna Signed-off-by: Corinna Vinschen <vinschen@redhat.com> diff --git a/modules/dbparser/Makefile.am b/modules/dbparser/Makefile.am index e35edaf..0b4dda7 100644 --- a/modules/dbparser/Makefile.am +++ b/modules/dbparser/Makefile.am @@ -11,6 +11,14 @@ AM_CPPFLAGS = -I$(top_srcdir)/lib -I../../lib AM_CFLAGS = @CFLAGS_NOWARN_POINTER_SIGN@ export top_srcdir +noinst_LTLIBRARIES = libsyslog-ng-patterndb.la +libsyslog_ng_patterndb_la_SOURCES = radix.c radix.h \ + patterndb.c patterndb.h patterndb-int.h \ + timerwheel.c timerwheel.h \ + patternize.c patternize.h +libsyslog_ng_patterndb_la_LDFLAGS = -no-undefined +libsyslog_ng_patterndb_la_LIBADD = @OPENSSL_LIBS@ @DEPS_LIBS@ ../../lib/libsyslog-ng.la + lib_LIBRARIES = libsyslog-ng-patterndb.a libsyslog_ng_patterndb_a_SOURCES = radix.c radix.h \ patterndb.c patterndb.h patterndb-int.h \ @@ -24,13 +32,13 @@ libdbparser_la_SOURCES = \ dbparser-grammar.y dbparser-parser.c dbparser-parser.h dbparser-plugin.c libdbparser_la_CPPFLAGS = $(AM_CPPFLAGS) -libdbparser_la_LIBADD = ../../lib/libsyslog-ng.la libsyslog-ng-patterndb.a +libdbparser_la_LIBADD = ../../lib/libsyslog-ng.la libsyslog-ng-patterndb.la libdbparser_la_LDFLAGS = -avoid-version -module -no-undefined bin_PROGRAMS = pdbtool pdbtool_SOURCES = pdbtool.c pdbtool_CPPFLAGS = $(AM_CPPFLAGS) @OPENSSL_CFLAGS@ -pdbtool_LDADD = ../../lib/libsyslog-ng.la libsyslog-ng-patterndb.a @OPENSSL_LIBS@ @GLIB_LIBS@ +pdbtool_LDADD = libsyslog-ng-patterndb.a ../../lib/libsyslog-ng.la @OPENSSL_LIBS@ @GLIB_LIBS@ BUILT_SOURCES = dbparser-grammar.y dbparser-grammar.c dbparser-grammar.h EXTRA_DIST = $(BUILT_SOURCES) radix-find.c dbparser-grammar.ym -- Corinna Vinschen Cygwin Project Co-Leader Red Hat