Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#19577 closed defect (fixed)

syslog-ng 2.1.4 needs explicit globals.o to create executable

Reported by: denis.laplante@… Owned by: markd@…
Priority: Normal Milestone:
Component: ports Version: 1.7.1
Keywords: xCode Cc:
Port: syslog-ng


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.

Error message:

/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

Undefined symbols:

"_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 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 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.

Attachments (2) (499 bytes) - added by denis.laplante@… 7 years ago.
patch to to force load of globals.o
patch-src-logreader.c.diff (551 bytes) - added by denis.laplante@… 7 years ago.
Patch from

Download all attachments as: .zip

Change History (5)

Changed 7 years ago by denis.laplante@…

patch to to force load of globals.o

Changed 7 years ago by denis.laplante@…

comment:1 Changed 7 years ago by jmroot (Joshua Root)

  • Owner changed from macports-tickets@… to markd@…

comment:2 Changed 7 years ago by markd@…

  • Resolution set to fixed
  • Status changed from new to closed

Many thanks for the Makefile patch. The logreader patch was not necessary since it made it into the source by now.

comment:3 Changed 7 years ago by markd@…

Also passing the Makefile patch upstream so there will hopefully be a fix in the source for that on OS X also.

Note: See TracTickets for help on using tickets.