[syslog-ng] linking changes

Balazs Scheidler bazsi at balabit.hu
Wed Mar 2 10:47:02 CET 2011


On Wed, 2011-03-02 at 09:57 +0100, Corinna Vinschen wrote:
> On Mar  1 19:23, Balazs Scheidler wrote:
> > On Thu, 2011-02-24 at 10:59 +0100, Corinna Vinschen wrote:
> > > On Feb 24 10:31, Balazs Scheidler wrote:
> > > > ivykis is not so simple, syslog-ng core depends on that heavily. ivykis
> > > > is compiled as a static library (with -fPIC) and then linked into
> > > > libsyslog-ng.so
> > > > 
> > > > The staticlib is just a convenience library, however I'd like that to be
> > > > created by the ivykis configure/automake stuff, and would like to avoid
> > > > having to rewrite the build system for ivykis. Also, I wouldn't want to
> > > > install ivykis (as a shared object) from the syslog-ng tree, as I could
> > > > perhaps break people's setup if ivykis becomes more widely available.
> > > > (e.g. installed on the system).
> > > > 
> > > > Do you perhaps have an idea how to solve that differently?
> > > 
> > > If you don't provide a shared ivykis lib, building libsyslog-ng.so on
> > > Cygwin will break.  Assuming ivykis builds on Cygwin, which nobody
> > > tested yet either...
> > > 
> > > Off the top my head I can see two ways around the shared/static problem.
> > > 
> > > - Add the ivykis source files to libsyslog_ng_la_SOURCES.
> > > 
> > > - Don't link libsyslog-ng.so against ivykis at all.  Instead,
> > >   build ivykis as a module which gets installed into /usr/lib/syslog-ng
> > >   and use dlopen/dlsym to call its functions.
> > 
> > Hmm... I've attempted to create a completely static syslog-ng binary
> > today, and although I've some doubts that I could do that for all the
> > platforms that syslog-ng supports, it might work for a couple of them. 
> > 
> > So the general idea is:
> >   * everything gets linked into the main syslog-ng binary and
> > libsyslog-ng.so/libivykis.so is not used.
> >   * even some of the selected modules can be linked in, which is a
> > performance win
> > 
> > The issue with that is that the final link probably can't be performed
> > by libtool, I've just manually edited the command line that it emitted.
> > 
> > I guess this can be a good solution for cygwin too, and will probably
> > not be available for all platforms.
> 
> Thanks for the info.  I'm curious how this will work.

well, something along the lines of

--enable-static --disable-shared

and some libtool magic to get all .a files linked into the syslog-ng
binary with -Wl,--whole-archive

This doesn't need PIC compilation (as the .a files will be linked into
the main executable) and can be done even for embedded libraries.

plugin loading would work on platforms where the .so files can use
symbols from the executable:
  * this is the case on Linux
  * this is definitely not the case on AIX
  * on cygwin, if my guess is right, this will not work, so there all
syslog-ng plugins must be linked in statically too.

The alternative is to introduce ivykis as a separate package on cygwin.
Would that be a doable alternative?

-- 
Bazsi



More information about the syslog-ng mailing list