Mailing List Archive

rsyslog-3.15.0 compile problem
Greetings, list!
I'm having trouble compiling 3.15.0.

I get the following error on one machine (CentOS 5):
rsyslogd-msg.o: In function `msgDestruct':
/usr/src/redhat/BUILD/rsyslog-3.15.0/msg.c:249: undefined reference to
`__sync_sub_and_fetch_4'

And slightly different error on another machine (Fedora Core 3):
rsyslogd-debug.o(.text+0x183d): In function `dbgEntrFunc':
/usr/src/redhat/BUILD/rsyslog-3.15.0/debug.c:996: undefined reference to
`__sync_fetch_and_add'
rsyslogd-msg.o(.text+0x127): In function `msgDestruct':
/usr/src/redhat/BUILD/rsyslog-3.15.0/msg.c:249: undefined reference to
`__sync_sub_and_fetch'
rsyslogd-msg.o(.text+0xc55): In function `MsgAddRef':
/usr/src/redhat/BUILD/rsyslog-3.15.0/msg.c:449: undefined reference to
`__sync_fetch_and_add'

Has anyone else seen this or know of a workaround or fix? I can't seem
to find any reference in the rsyslog install documentation which says
that I need additional libraries on my system.

Thanks in advance
rsyslog-3.15.0 compile problem [ In reply to ]
2008/4/1, Ben Lentz <BLentz at channing-bete.com>:
> Greetings, list!
> I'm having trouble compiling 3.15.0.
>
> I get the following error on one machine (CentOS 5):
> rsyslogd-msg.o: In function `msgDestruct':
> /usr/src/redhat/BUILD/rsyslog-3.15.0/msg.c:249: undefined reference to
> `__sync_sub_and_fetch_4'

See http://git.michaelbiebl.de/?p=rsyslog.git;a=commitdiff;h=26aa8b09dbc2de1c7bdd97921a273511d585e043

#undef DO_HAVE_ATOMICS 1 should help

Obviously, ./configure should detect this automatically.

Cheers,
Michael

--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
rsyslog-3.15.0 compile problem [ In reply to ]
2008/4/1, Michael Biebl <mbiebl at gmail.com>:
>
> Obviously, ./configure should detect this automatically.

We could steal from here:
http://gcc.gnu.org/ml/libstdc++/2006-07/txt00001.txt



--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
rsyslog-3.15.0 compile problem [ In reply to ]
>
> See http://git.michaelbiebl.de/?p=rsyslog.git;a=commitdiff;h=26aa8b09dbc2de1c7bdd97921a273511d585e043
>
> #undef DO_HAVE_ATOMICS 1 should help
>
> Obviously, ./configure should detect this automatically.
>
>
Thanks!

I'm still getting errors with debug.c It seems that debug.c has a
reference to ATOMIC_INC (line 996) without a set of ifdef
DO_HAVE_ATOMICS around it, so the build still dies.

If I comment that line out, it will compile, but the binary is unusable
"rsyslogd run failed with error -3000."

On a whim, I tried ./configure --disable-debug, no luck. Ugh!
rsyslog-3.15.0 compile problem [ In reply to ]
It's a bug, obviously. I have now fixed it. Please go to atomic.h and
change the ATOMIC_INC macro to be

#define ATOMIC_INC(data) (++(data))

That'll solve the problems. Doing so does not introduce any real
weakness - the code has been tested always with this setting. The
atomics are a recent addition to make it ultra-reliable on all CPU
architectures ... but obviously we need to do more work on the feature
selection than I initially thought...

Thanks for bringing this up, it was just at the right time. I'll pull
that code from today's stable release (that happens when you think you
can add something laaate in the process because it is "unintrusive" ;)).

Rainer


On Tue, 2008-04-01 at 17:25 -0400, Ben Lentz wrote:
> >
> > See http://git.michaelbiebl.de/?p=rsyslog.git;a=commitdiff;h=26aa8b09dbc2de1c7bdd97921a273511d585e043
> >
> > #undef DO_HAVE_ATOMICS 1 should help
> >
> > Obviously, ./configure should detect this automatically.
> >
> >
> Thanks!
>
> I'm still getting errors with debug.c It seems that debug.c has a
> reference to ATOMIC_INC (line 996) without a set of ifdef
> DO_HAVE_ATOMICS around it, so the build still dies.
>
> If I comment that line out, it will compile, but the binary is unusable
> "rsyslogd run failed with error -3000."
>
> On a whim, I tried ./configure --disable-debug, no luck. Ugh!
> _______________________________________________
> rsyslog mailing list
> http://lists.adiscon.net/mailman/listinfo/rsyslog
rsyslog-3.15.0 compile problem [ In reply to ]
Ummm ;) Could you lend me a helping hand? That looks god, but it also
looks like it goes above my autotools horizon ;)

Rainer

> -----Original Message-----
> From: rsyslog-bounces at lists.adiscon.com [mailto:rsyslog-
> bounces at lists.adiscon.com] On Behalf Of Michael Biebl
> Sent: Tuesday, April 01, 2008 11:24 PM
> To: rsyslog-users
> Subject: Re: [rsyslog] rsyslog-3.15.0 compile problem
>
> 2008/4/1, Michael Biebl <mbiebl at gmail.com>:
> >
> > Obviously, ./configure should detect this automatically.
>
> We could steal from here:
> http://gcc.gnu.org/ml/libstdc++/2006-07/txt00001.txt
>
>
>
> --
> Why is it that all of the instruments seeking intelligent life in the
> universe are pointed away from Earth?
> _______________________________________________
> rsyslog mailing list
> http://lists.adiscon.net/mailman/listinfo/rsyslog
rsyslog-3.15.0 compile problem [ In reply to ]
> It's a bug, obviously. I have now fixed it. Please go to atomic.h and
> change the ATOMIC_INC macro to be
>
> #define ATOMIC_INC(data) (++(data))
>
> That'll solve the problems.

Hey Rainer,
Thanks for the help. I still continue to have problems, now at runtime.
I'm patching the source like so:

--- rsyslog-3.15.0/atomic.h.orig 2008-03-31 05:07:24.000000000 -0400
+++ rsyslog-3.15.0/atomic.h 2008-04-02 02:50:54.000000000 -0400
@@ -36,8 +36,8 @@
#define INCLUDED_ATOMIC_H

/* set the following to 1 if we have atomic operations (and #undef it
otherwise) */
-#define DO_HAVE_ATOMICS 1
-#define ATOMIC_INC(data) ((void) __sync_fetch_and_add(&data, 1))
+#undef DO_HAVE_ATOMICS 1
+#define ATOMIC_INC(data) (++(data))
#define ATOMIC_DEC_AND_FETCH(data) __sync_sub_and_fetch(&data, 1)

#endif /* #ifndef INCLUDED_ATOMIC_H */

then:
rsyslogd run failed with error -3000

I've compiled with ggdb and run through the debugger, but I'm not sure
where to set the break points... tried a couple things but nothing
worked. I've also run it with strace, but I can't seem to find any
problems. I believe there's a ton of reasons that it would generate this
message and I'm not sure where to start.
rsyslog-3.15.0 compile problem [ In reply to ]
Hi,

> -----Original Message-----
> From: rsyslog-bounces at lists.adiscon.com [mailto:rsyslog-
> bounces at lists.adiscon.com] On Behalf Of Ben Lentz
> Sent: Wednesday, April 02, 2008 10:35 AM
> To: rsyslog-users
> Subject: Re: [rsyslog] rsyslog-3.15.0 compile problem
>
>
>
> > It's a bug, obviously. I have now fixed it. Please go to atomic.h
and
> > change the ATOMIC_INC macro to be
> >
> > #define ATOMIC_INC(data) (++(data))
> >
> > That'll solve the problems.
>
> Hey Rainer,
> Thanks for the help. I still continue to have problems, now at
runtime.
> I'm patching the source like so:
>
> --- rsyslog-3.15.0/atomic.h.orig 2008-03-31 05:07:24.000000000
-
> 0400
> +++ rsyslog-3.15.0/atomic.h 2008-04-02 02:50:54.000000000 -0400
> @@ -36,8 +36,8 @@
> #define INCLUDED_ATOMIC_H
>
> /* set the following to 1 if we have atomic operations (and #undef it
> otherwise) */
> -#define DO_HAVE_ATOMICS 1
> -#define ATOMIC_INC(data) ((void) __sync_fetch_and_add(&data, 1))
> +#undef DO_HAVE_ATOMICS 1
> +#define ATOMIC_INC(data) (++(data))
> #define ATOMIC_DEC_AND_FETCH(data) __sync_sub_and_fetch(&data, 1)
>
> #endif /* #ifndef INCLUDED_ATOMIC_H */
>

That's fine..

> then:
> rsyslogd run failed with error -3000

Nice - error codes are defined in rsyslog.h. But of course, -3000 means
"an error occurred". In any case, it's something that fails cleanly...

> I've compiled with ggdb and run through the debugger, but I'm not sure
> where to set the break points... tried a couple things but nothing
> worked. I've also run it with strace, but I can't seem to find any
> problems. I believe there's a ton of reasons that it would generate
> this
> message and I'm not sure where to start.

... that's why you don't see anything in the debugger.

So let's get a bit down on where it really happens. There is debug
support inside rsyslog:

http://www.rsyslog.com/doc-debug.html

It would be best if you do ./configure --enable-rtinst but that's not
strictly necessary. Set RSYSLOG_DEBUG to LogFuncFlow and run rsyslog
interactively with -d -n. You'll get some debug output. That should tell
us something (well, you could even start without seting RSYSLOG_DEBUG, I
think that'll be sufficient and less output).

Rainer
>
> _______________________________________________
> rsyslog mailing list
> http://lists.adiscon.net/mailman/listinfo/rsyslog
rsyslog-3.15.0 compile problem [ In reply to ]
On 04/02/2008 10:35 AM, Ben Lentz wrote:
>
>> It's a bug, obviously. I have now fixed it. Please go to atomic.h and
>> change the ATOMIC_INC macro to be
>>
>> #define ATOMIC_INC(data) (++(data))
>>
>> That'll solve the problems.
>
> Hey Rainer,
> Thanks for the help. I still continue to have problems, now at runtime.
> I'm patching the source like so:
>
> --- rsyslog-3.15.0/atomic.h.orig 2008-03-31 05:07:24.000000000 -0400
> +++ rsyslog-3.15.0/atomic.h 2008-04-02 02:50:54.000000000 -0400
> @@ -36,8 +36,8 @@
> #define INCLUDED_ATOMIC_H
>
> /* set the following to 1 if we have atomic operations (and #undef it
> otherwise) */
> -#define DO_HAVE_ATOMICS 1
> -#define ATOMIC_INC(data) ((void) __sync_fetch_and_add(&data, 1))
> +#undef DO_HAVE_ATOMICS 1
> +#define ATOMIC_INC(data) (++(data))
> #define ATOMIC_DEC_AND_FETCH(data) __sync_sub_and_fetch(&data, 1)
>
> #endif /* #ifndef INCLUDED_ATOMIC_H */
>
> then:
> rsyslogd run failed with error -3000
>
> I've compiled with ggdb and run through the debugger, but I'm not sure
> where to set the break points... tried a couple things but nothing
> worked. I've also run it with strace, but I can't seem to find any
> problems. I believe there's a ton of reasons that it would generate this
> message and I'm not sure where to start.

Hi Ben,

my guess is that rsyslog can't find its libraries (e.g.
/usr/local/lib/rsyslog/lmregexp.so). You'll need to do "make install"
or something like "ln -s $(find /path/to/rsyslog/sources/ -name
"*.so") /usr/[local/]lib/rsyslog".
You can run "strace ./rsyslogd -v" to see where it looks for its
libraries.
rsyslog-3.15.0 compile problem [ In reply to ]
You are probably right. After your message I checked the module loader
and it just returns the generic error code. I'll fix that...

Rainer

> -----Original Message-----
> From: rsyslog-bounces at lists.adiscon.com [mailto:rsyslog-
> bounces at lists.adiscon.com] On Behalf Of theinric at redhat.com
> Sent: Wednesday, April 02, 2008 10:47 AM
> To: rsyslog-users
> Subject: Re: [rsyslog] rsyslog-3.15.0 compile problem
>
> On 04/02/2008 10:35 AM, Ben Lentz wrote:
> >
> >> It's a bug, obviously. I have now fixed it. Please go to atomic.h
> and
> >> change the ATOMIC_INC macro to be
> >>
> >> #define ATOMIC_INC(data) (++(data))
> >>
> >> That'll solve the problems.
> >
> > Hey Rainer,
> > Thanks for the help. I still continue to have problems, now at
> runtime.
> > I'm patching the source like so:
> >
> > --- rsyslog-3.15.0/atomic.h.orig 2008-03-31
05:07:24.000000000
> -0400
> > +++ rsyslog-3.15.0/atomic.h 2008-04-02 02:50:54.000000000 -0400
> > @@ -36,8 +36,8 @@
> > #define INCLUDED_ATOMIC_H
> >
> > /* set the following to 1 if we have atomic operations (and #undef
> it
> > otherwise) */
> > -#define DO_HAVE_ATOMICS 1
> > -#define ATOMIC_INC(data) ((void) __sync_fetch_and_add(&data, 1))
> > +#undef DO_HAVE_ATOMICS 1
> > +#define ATOMIC_INC(data) (++(data))
> > #define ATOMIC_DEC_AND_FETCH(data) __sync_sub_and_fetch(&data, 1)
> >
> > #endif /* #ifndef INCLUDED_ATOMIC_H */
> >
> > then:
> > rsyslogd run failed with error -3000
> >
> > I've compiled with ggdb and run through the debugger, but I'm not
> sure
> > where to set the break points... tried a couple things but nothing
> > worked. I've also run it with strace, but I can't seem to find any
> > problems. I believe there's a ton of reasons that it would generate
> this
> > message and I'm not sure where to start.
>
> Hi Ben,
>
> my guess is that rsyslog can't find its libraries (e.g.
> /usr/local/lib/rsyslog/lmregexp.so). You'll need to do "make install"
> or something like "ln -s $(find /path/to/rsyslog/sources/ -name
> "*.so") /usr/[local/]lib/rsyslog".
> You can run "strace ./rsyslogd -v" to see where it looks for its
> libraries.
> _______________________________________________
> rsyslog mailing list
> http://lists.adiscon.net/mailman/listinfo/rsyslog
rsyslog-3.15.0 compile problem [ In reply to ]
> You are probably right. After your message I checked the module loader
> and it just returns the generic error code. I'll fix that...
>
> Rainer
>
>
>> Hi Ben,
>>
>> my guess is that rsyslog can't find its libraries (e.g.
>> /usr/local/lib/rsyslog/lmregexp.so). You'll need to do "make install"
>> or something like "ln -s $(find /path/to/rsyslog/sources/ -name
>> "*.so") /usr/[local/]lib/rsyslog".
>> You can run "strace ./rsyslogd -v" to see where it looks for its
>> libraries.
>>
Yep, you're right. I was expecting:
- Shared library issues at runtime to be visible using ldd(1)
- To at least be able to get command-line help or version (-v)
information from rsyslogd (without loadable modules)
- A nicer error message ;-)

strace ./rsyslogd -v -b -n 2>&1 | grep ENOENT
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or
directory)
open("/usr/lib/rsyslog/lmnet.so", O_RDONLY) = -1 ENOENT (No such file or
directory)

Can the module path (/usr/lib/rsyslog) be specified? Is there a
./configure option that I'm missing at compile time or a command line
parameter to rsyslogd or config file parameter in rsyslog.conf? I've
been through ./configure --help, rsyslogd.8 and rsyslog.conf.5 and can't
seem to find anything?

It's very early in the US and I might just be missing something obvious.
rsyslog-3.15.0 compile problem [ In reply to ]
> >> my guess is that rsyslog can't find its libraries (e.g.
> >> /usr/local/lib/rsyslog/lmregexp.so). You'll need to do "make
> install"
> >> or something like "ln -s $(find /path/to/rsyslog/sources/ -name
> >> "*.so") /usr/[local/]lib/rsyslog".
> >> You can run "strace ./rsyslogd -v" to see where it looks for its
> >> libraries.
> >>
> Yep, you're right. I was expecting:
> - Shared library issues at runtime to be visible using ldd(1)
> - To at least be able to get command-line help or version (-v)
> information from rsyslogd (without loadable modules)
> - A nicer error message ;-)
>
> strace ./rsyslogd -v -b -n 2>&1 | grep ENOENT
> access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or
> directory)
> open("/usr/lib/rsyslog/lmnet.so", O_RDONLY) = -1 ENOENT (No such file
> or
> directory)
>
> Can the module path (/usr/lib/rsyslog) be specified? Is there a
> ./configure option that I'm missing at compile time or a command line
> parameter to rsyslogd or config file parameter in rsyslog.conf? I've
> been through ./configure --help, rsyslogd.8 and rsyslog.conf.5 and
> can't
> seem to find anything?

That's mostly distro-specific and this is where I have very limited
knowledge. But you can set the module path via the environment, use
RSYSLOG_MODDIR=/path/to/modules/ . There is also a -m option to do the
same, but it currently is read too late to help with the core modules.
On my 64Bit system adding --libdir=/lib64 often helped with such
problems when I encountered them. Not sure if that's the right cure...

>
> It's very early in the US and I might just be missing something
> obvious.

You are *really* brave!