On Feb 23 14:52, Balazs Scheidler wrote:
On Wed, 2011-02-23 at 14:31 +0100, Corinna Vinschen wrote:
On Feb 23 14:11, Balazs Scheidler wrote:
Am I missing something else?
Well, yes. As outlined in https://lists.balabit.hu/pipermail/syslog-ng/2011-February/016006.html there are two problems:
- You can't link against a static lib when creating a shared lib. That means, creating libdbparser.so will fail. My patch results in creating a shared libsyslog-ng-patterndb.so for linking libdbparser.so, and a static libsyslog-ng-patterndb.a for linking pdbtool. Marking both libsyslog-ng-patterndb as noinst is just to avoid that both convenience libs are installed.
hmm.. not even with -fPIC ? If I have to duplicate executable code into pdbtool anyway (because of static linking it), I'd rather not have a separate .so which is only loaded by an .so.
-fPIC and -fpic have no effect on Windows. The Windows loader doesn't support position independent code. So, no, it won't work either.
If that's the case, I'd include the same source files into both targets (the .la one and pdbtool one)
- The link order is important when creating binaries on the Windows platform. Since libsyslog-ng-patterndb.a reference symbols in ../../lib/libsyslog-ng.la, you must reorder them on the command line. Not
../../lib/libsyslog-ng.la libsyslog-ng-patterndb.a
but
libsyslog-ng-patterndb.a ../../lib/libsyslog-ng.la
Ok, I've missed that, and changed my Makefile.
My patch fixes both problems. The result should work on all platforms.
Thanks for your efforts, and sorry for missing the point. Hopefully we can close this once and for all :)
No worries. However, something else occured to me a couple of minutes ago. If you apply my patch, you must change noinst_LTLIBRARIES = libsyslog-ng-patterndb.la to lib_LTLIBRARIES = libsyslog-ng-patterndb.la If you keep it in noinst_LTLIBRARIES, the libdbparse.so module will be broken after installtion because it requires libsyslog-ng-patterndb.so to run. Sorry for forgetting that. There are two ways to fix this. - Move libsyslog-ng-patterndb.so to module_LTLIBRARIES and install it. - Don't generate libsyslog-ng-patterndb.so. Instead add the patterndb source files to libdbparser_la_SOURCES, along these lines: diff --git a/modules/dbparser/Makefile.am b/modules/dbparser/Makefile.am index b2ab700..f8a53f4 100644 --- a/modules/dbparser/Makefile.am +++ b/modules/dbparser/Makefile.am @@ -21,7 +21,8 @@ libsyslog_ng_patterndb_a_CFLAGS = $(AM_CFLAGS) -fPIC module_LTLIBRARIES = libdbparser.la libdbparser_la_SOURCES = \ dbparser.c dbparser.h \ - dbparser-grammar.y dbparser-parser.c dbparser-parser.h dbparser-plugin.c + dbparser-grammar.y dbparser-parser.c dbparser-parser.h \ + dbparser-plugin.c $(libsyslog_ng_patterndb_a_SOURCES) libdbparser_la_CPPFLAGS = $(AM_CPPFLAGS) libdbparser_la_LIBADD = ../../lib/libsyslog-ng.la libsyslog-ng-patterndb.a I think this second solution is better. Corinna -- Corinna Vinschen Cygwin Project Co-Leader Red Hat