2014-11-07 10:51 GMT+01:00 singh.janmejay <[email protected]>:

> I spent an hour looking at this today.
>
> This:
>
> gcc -std=gnu99 -g3 -ggdb -export-dynamic -o rt_init
> ../tools/rsyslogd-smtradfile.o ../tools/rsyslogd-pidfile.o
> ../tools/rsyslogd-iminternal.o ../tools/rsyslogd-omfile.o
> ../tools/rsyslogd-pmrfc3164.o ../tools/rsyslogd-omfwd.o
> ../tools/rsyslogd-omshell.o ../tools/rsyslogd-omdiscard.o
> ../tools/rsyslogd-syslogd.o ../tools/rsyslogd-smfwd.o
> ../tools/rsyslogd-smfile.o ../tools/rsyslogd-omusrmsg.o
> ../tools/rsyslogd-smtradfwd.o ../tools/rsyslogd-ompipe.o
> ../tools/rsyslogd-pmrfc5424.o rt_init-rt-init.o rt_init-runtime-dummy.o -lz
> -lpthread -L../grammar/.libs -lgrammar
> -L/home/janmejay/projects/flipkart/rsyslog/liblogging/../install.dir/lib
> -llogging-stdlog -L../runtime/.libs -lrsyslog
> -L/home/janmejay/projects/flipkart/rsyslog/install.dir/lib -lestr -ljson-c
> -luuid -L../runtime/.libs -lrsyslog -L../grammar/.libs -lgrammar -ldl
>
> run from tests dir, seems to do fine except for symbols defined in
> tools/rsyslogd.c.
>
> I basically took what make was running, and started running it myself
> directly using gcc to decrease the time required to test my changes
> (modifying automake file and running was too long for quickly iterating on
> this).
>
>
thanks


> But the basic change I did was reorderd to bring rsyslog and grammer to the
> end. At that point it wanted functions such as modInitFile, modInitPipe
> etc, which were defined by various files in tools dir. So I just picked up
> all *.o files except rsyslogd-rsyslogd.o (which has another main, which
> messes up the linker. Also added -ldl for dl* functions.
>
>
do you have any idea how I can do this in autoconf so that I can integrate
it into the build system?

Rainer

> Now rsyslogd-syslogd.o wants symbols like forkRsyslog, which are defined in
> rsyslogd.c, so we basically need to separate main (and other functions that
> only main will want) out to a separate file, so we can make syslogd.o
> happy.
>
>
> On Mon, Nov 3, 2014 at 2:38 PM, Rainer Gerhards <[email protected]>
> wrote:
>
> > Hi all,
> >
> > after the discussion on unit tests I tried to add some. Some years ago,
> we
> > had a very small set of "unit tests". These (two actually) were really
> > almost nothing, BUT a skeleton to build better ones. And this skeleton I
> > wanted to use, as it covers the initialization of the runtime (test
> > rt_init).
> >
> > Unfortunately, I don't get them even to link. IIRC, that was also the
> > reason why they were removed from the testbench some time ago. I've tried
> > for several hours now and googled a lot, but I can't find a solution to
> > make them build. So any help would be appreciated.
> >
> > The code is available in branch
> >
> >   https://github.com/rsyslog/rsyslog/tree/master-unittests
> >
> > When I try to build the rt_init test, I get this:
> >
> > rger@ubuntu1404esp:~/proj/rsyslog/tests$ make rt_init
> >   CCLD     rt_init
> > /usr/bin/ld: ../runtime/.libs/librsyslog.a(librsyslog_la-msg.o):
> undefined
> > reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5'
> > /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing
> > from command line
> > collect2: error: ld returned 1 exit status
> > make: *** [rt_init] Error 1
> >
> > After what I could find out, this seems to be related to the order of
> > -lpthread in the linker options. That's because the gnu linker is
> > order-dependent. In theory, this should be fixable by moving -lpthread to
> > the end of the linker libs. If I do that, I get a myriad of unresolved
> > externals for the rsyslog runtime library. I than begun putting libs in
> > different orders in the linker call, but I always get one error or the
> > other.
> >
> > The interesting thing is that rsyslogd itself builds **successfully**
> with
> > the **same** linker options in the **same** order. I even tried to move
> > rt_init out of the tests directory into tools, where syslogd resides, and
> > add rt_init to that Makefile. Again, rsyslogd builds, but rt_init fails.
> >
> > Quite honestly, I don't have any more idea. And the bad thing is that if
> I
> > can't get rt_init to build, I probably cannot write any unit test at all
> > (because most, especially those that do notable work, require the rsyslog
> > runtime to be initialized).
> >
> > Help with this problem would be deeply appreciated. Again, it's a blocker
> > for any unit test.
> >
> > Thanks,
> > Rainer
> > _______________________________________________
> > rsyslog mailing list
> > http://lists.adiscon.net/mailman/listinfo/rsyslog
> > http://www.rsyslog.com/professional-services/
> > What's up with rsyslog? Follow https://twitter.com/rgerhards
> > NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad
> > of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you
> > DON'T LIKE THAT.
> >
>
>
>
> --
> Regards,
> Janmejay
> http://codehunk.wordpress.com
> _______________________________________________
> rsyslog mailing list
> http://lists.adiscon.net/mailman/listinfo/rsyslog
> http://www.rsyslog.com/professional-services/
> What's up with rsyslog? Follow https://twitter.com/rgerhards
> NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad
> of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you
> DON'T LIKE THAT.
>
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to