[ovs-discuss] Fwd: Problem with VLOG module init

Ahmed Talha Khan auny87 at gmail.com
Thu Dec 6 19:01:55 UTC 2012


Bingo!!! That was a stupid mis-judgement. My bad. Thanks alot Ben.


On Thu, Dec 6, 2012 at 11:57 PM, Ben Pfaff <blp at nicira.com> wrote:

> I suspect that you forgot to put #include <config.h> at the top of
> xyz.c.
>
> On Thu, Dec 06, 2012 at 11:56:00PM +0500, Ahmed Talha Khan wrote:
> > ---------- Forwarded message ----------
> > From: Ahmed Talha Khan <auny87 at gmail.com>
> > Date: Thu, Dec 6, 2012 at 11:55 PM
> > Subject: Re: [ovs-discuss] Problem with VLOG module init
> > To: Ben Pfaff <blp at nicira.com>
> >
> >
> > Running nm on xyz.o gives blank output
> >
> > [root at TalhaFedoraVbox lib]# nm xyz.o|grep -E 'vlog|VLM'
> > [root at TalhaFedoraVbox lib]#
> >
> >
> > Whereas for the example that you gave on rconn.o
> >
> > [root at TalhaFedoraVbox lib]# nm rconn.o|grep -E 'vlog|VLM'
> > 0000000000000000 D VLM_rconn
> >                  U vlog
> > 0000000000000000 D vlog_module_ptr_rconn
> > [root at TalhaFedoraVbox lib]#
> >
> > The symbol is not present.  Checked with objdump and readelf aswell.
> >
> >
> >
> > On Thu, Dec 6, 2012 at 9:32 PM, Ben Pfaff <blp at nicira.com> wrote:
> >
> > > I don't see anything strange there.  Grasping at straws, what does:
> > >     nm xyz.o | grep -E 'vlog|VLM'
> > > print?  It should be similar to the same thing run on any other .o that
> > > uses vlog, e.g.:
> > >
> > >     blp at blp:~/nicira/ovs(0)$ nm _build/lib/rconn.o|grep -E 'vlog|VLM'
> > >     00000040 D VLM_rconn
> > >              U vlog
> > >     00000000 D vlog_module_ptr_rconn
> > >
> > > On Thu, Dec 06, 2012 at 10:41:42AM +0500, Ahmed Talha Khan wrote:
> > > > PFA config.log
> > > >
> > > >
> > > > On Thu, Dec 6, 2012 at 2:34 AM, Ben Pfaff <blp at nicira.com> wrote:
> > > >
> > > > > Yes, sorry, that's what I meant.
> > > > >
> > > > > On Thu, Dec 06, 2012 at 01:24:43AM +0500, Ahmed Talha Khan wrote:
> > > > > > What exactly do you mean by that? Do you want me to past
> config.log?
> > > > > >
> > > > > >
> > > > > > On Thu, Dec 6, 2012 at 12:50 AM, Ben Pfaff <blp at nicira.com>
> wrote:
> > > > > >
> > > > > > > What's in config.status?
> > > > > > >
> > > > > > > On Wed, Dec 05, 2012 at 11:46:17PM +0500, Ahmed Talha Khan
> wrote:
> > > > > > > > Its Linux with kernel 2.6.35 on Fedora 14 x86_64 machine.
> And yes
> > > > > thats
> > > > > > > > what I though too that only VLOG_DEFINE_THIS_MODULE should
> do the
> > > > > job as
> > > > > > > it
> > > > > > > > creates and the actual module as well as the reference.
> > > > > > > >
> > > > > > > > I see that it is defined like this
> > > > > > > >
> > > > > > > > #define VLOG_DEFINE_THIS_MODULE(MODULE)
> > > > >     \
> > > > > > > >         VLOG_DEFINE_MODULE(MODULE);
> > > > >     \
> > > > > > > >         static struct vlog_module *const THIS_MODULE =
> > > &VLM_##MODULE
> > > > > > > >
> > > > > > > >
> > > > > > > > The 2nd line to create a reference works as its not a compile
> > > issue.
> > > > > The
> > > > > > > > linker cries which means that VLOG_DEFINE_MODULE(MODULE)
> failed
> > > to
> > > > > create
> > > > > > > > the module in the linker section as given by
> > > > > > > >
> > > > > > > > #define VLOG_DEFINE_MODULE(MODULE)
> > > > >    \
> > > > > > > >         VLOG_DEFINE_MODULE__(MODULE)
> > > > >    \
> > > > > > > >         extern struct vlog_module *vlog_module_ptr_##MODULE;
> > > > >    \
> > > > > > > >         struct vlog_module *vlog_module_ptr_##MODULE
> > > > >    \
> > > > > > > >             __attribute__((section("vlog_modules"))) =
> > > &VLM_##MODULE
> > > > > > > >
> > > > > > > >
> > > > > > > > Any ideas now what might have happened? Could be it some
> sort of
> > > a
> > > > > > > version
> > > > > > > > mis-match for the GNU linker "ld"?
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > On Wed, Dec 5, 2012 at 8:35 PM, Ben Pfaff <blp at nicira.com>
> > > wrote:
> > > > > > > >
> > > > > > > > > On Wed, Dec 05, 2012 at 12:29:51PM +0500, Ahmed Talha Khan
> > > wrote:
> > > > > > > > > > I am trying to register one of my own modules for logging
> > > purpose
> > > > > > > but it
> > > > > > > > > > does not seem to work.
> > > > > > > > > >
> > > > > > > > > > In my source file xyz.c included
> > > > > > > > > >
> > > > > > > > > > VLOG_DEFINE_THIS_MODULE(xyz);
> > > > > > > > > >
> > > > > > > > > > and then later in the file i use
> > > > > > > > > >
> > > > > > > > > > VLOG_INFO("some msg printed here")
> > > > > > > > > >
> > > > > > > > > > But when I run make, the linker cries:
> > > > > > > > > >
> > > > > > > > > > undefined reference to `VLM_xyz'.
> > > > > > > > > >
> > > > > > > > > > What am I missing here. Isnt this suppose to be a simple
> > > > > operation?
> > > > > > > > >
> > > > > > > > > Yes, all you should need is the VLOG_DEFINE_THIS_MODULE
> line.
> > > > > > > > >
> > > > > > > > > What kind of system are you using?
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > Regards,
> > > > > > > > -Ahmed Talha Khan
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Regards,
> > > > > > -Ahmed Talha Khan
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Regards,
> > > > -Ahmed Talha Khan
> > >
> > >
> > >
> >
> >
> > --
> > Regards,
> > -Ahmed Talha Khan
> >
> >
> >
> >
> > --
> > Regards,
> > -Ahmed Talha Khan
>
> > _______________________________________________
> > discuss mailing list
> > discuss at openvswitch.org
> > http://openvswitch.org/mailman/listinfo/discuss
>
>


-- 
Regards,
-Ahmed Talha Khan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20121207/ea035c3a/attachment.html>


More information about the discuss mailing list