Ticket #19577 (closed defect: fixed)
syslog-ng 2.1.4 needs explicit globals.o to create executable
|Reported by:||denis.laplante@…||Owned by:||markd@…|
I have a workaround for what seems like a xCode bug.
syslog-ng version 2.1.4 fails in compilation with MacPorts; specifically "ld" while creating executable fails to load "globals.o" from libsyslog-ng.a.
/usr/bin/gcc-4.0 -O2 -Wall -L/opt/local/lib -o syslog-ng main.o libsyslog-ng.a \
-lresolv -lfl -L/opt/local/lib -lglib-2.0 -lintl -liconv -L/opt/local/lib \
-levtlog -lnet -lwrap
"_configuration", referenced from:
_configuration$non_lazy_ptr in libsyslog-ng.a(cfg.o) _configuration$non_lazy_ptr in libsyslog-ng.a(cfg-grammar.o)
ld: symbol(s) not found
The workaround is to append "globals.o" to command "gcc ... -o syslog-ng ... -lwrap".
I tried (no success) appending libsyslog-ng.a , and upgrading Apple xCode compilation package from 3.1.1 to 3.1.2
The object file is in fact present in the archive and contains "_configuration".
$ nm libsyslog-ng.a libsyslog-ng.a(misc.o): [...] libsyslog-ng.a(cfg.o): [...] U _configuration [...] libsyslog-ng.a(cfg-grammar.o): [...] U _configuration [...] libsyslog-ng.a(globals.o): 00000004 D _allow_severity 00000004 C _configuration 00000000 D _deny_severity 00000004 C _server_mode
One red herring was the error message
ranlib: file: libsyslog-ng.a(afsql.o) has no symbols
Deleting afsql.o from libsyslog-ng.a and re-running ranlib (no errors) did not help. Editing Makefile to remove afsql.o did not help.
I've attached patch-Makefile.in.diff to explicitly add globals.o, which fixes this weird problem.
Another problem I had after installing the binary produced with explicit "globals.o": the "file" source driver goes into a tight loop instead of sleeping between read attempts. See bugzilla.balabit.com ticket 43. I have attached patch-src-logreader.c.diff for convenience, since version 2.1.5 does not yet appear on download site.
Solaris had no trouble with libsyslog-ng.a, even though it also uses ranlib.