[ovs-dev] adding my own .c file

shiva m anjaneya2 at gmail.com
Wed Dec 21 09:32:27 UTC 2011


Thank you for your reply.

I changed <ofproto.h> to "ofproto.h" still it giving same compilation error.

It seems its not generating shiva.o file, could you please let me know why
its not generating .o files for my independent .c files. Please help me in
this regard

Thanks & Regards,
Shiva



On Wed, Dec 21, 2011 at 12:58 PM, Vikram Dham <vikramdham at hotmail.com>wrote:

>  shiva.c will not compile as the #include preprocessor directive is wrong
> for ofproto.h, correct the #include preprocessor directive to use #include
> "ofproto.h" instead of #include <ofproto.h>
>
>
>
> > > > 2. my shiva.c file
> > > >
> > > >
> > > > #include<stdio.h>
> *> > > #include<ofproto.h>* // change this line to #include "ofproto.h"
>
> > > >
> > > > void test()
> > > > {
> > > > printf("hiiii\n");
> > > >
> > > > }
> > > >
>
> ------------------------------
> Date: Wed, 21 Dec 2011 12:01:54 +0530
> From: anjaneya2 at gmail.com
> To: dev at openvswitch.org
> Subject: Re: [ovs-dev] adding my own .c file
>
>
> I hope It is independent file, only change i made is calling test()
> function from ofproto.c.
>
> Thanks & Regards,
> Shiva
>
> On Wed, Dec 21, 2011 at 11:53 AM, Ben Pfaff <blp at nicira.com> wrote:
>
> The problem isn't obvious, please send your changes as a patch that can
> be applied with "git apply".
>
> On Wed, Dec 21, 2011 at 11:56:31AM +0530, shiva m wrote:
> > Hi.
> >
> > Sorry i did not notice.
> >
> > It seems for my shiva.c file its not generating  shiva.o file and this
> can
> > be verified by observing
> > /usr/src/redhat/BUILD/openvswitch-1.2.2/ofproto path.
> >
> >
> > Compiler error is
> > ofproto/libofproto.a(ofproto.o): In function `ofproto_initialize':
> > /usr/src/redhat/BUILD/openvswitch-1.2.2/ofproto/ofproto.c:181: undefined
> > reference to `test'
> > collect2: ld returned 1 exit status
> > make[2]: *** [tests/test-openflowd] Error 1
> > make[2]: Leaving directory `/usr/src/redhat/BUILD/openvswitch-1.2.2'
> > make[1]: *** [all-recursive] Error 1
> > make[1]: Leaving directory `/usr/src/redhat/BUILD/openvswitch-1.2.2'
> > make: *** [all] Error 2
> > error: Bad exit status from /var/tmp/rpm-tmp.89117 (%build)
> >
> >
> >
> >
> >
> >
> > On Wed, Dec 21, 2011 at 11:34 AM, Ben Pfaff <blp at nicira.com> wrote:
> >
> > > And what compiler errors do you get?
> > >
> > > Also, stop dropping the mailing list or I will stop responding.
> > >
> > > On Wed, Dec 21, 2011 at 11:35:44AM +0530, shiva m wrote:
> > > > Hi Ben,
> > > >
> > > > I changed the following files
> > > >
> > > > 1 ofprot/automake.mk
> > > >
> > > > noinst_LIBRARIES += ofproto/libofproto.a
> > > > ofproto_libofproto_a_SOURCES = \
> > > >         ofproto/collectors.c \
> > > >         ofproto/collectors.h \
> > > >         ofproto/connmgr.c \
> > > >         ofproto/connmgr.h \
> > > >         ofproto/fail-open.c \
> > > >         ofproto/fail-open.h \
> > > >         ofproto/in-band.c \
> > > >         ofproto/in-band.h \
> > > >         ofproto/names.c \
> > > >         ofproto/netflow.c \
> > > >         ofproto/netflow.h \
> > > >         ofproto/ofproto.c \
> > > >         ofproto/ofproto.h \
> > > >         ofproto/ofproto-dpif.c \
> > > >         ofproto/ofproto-dpif-sflow.c \
> > > >         ofproto/ofproto-dpif-sflow.h \
> > > >         ofproto/ofproto-provider.h \
> > > >         ofproto/pktbuf.c \
> > > >         ofproto/pktbuf.h \
> > > >         ofproto/pinsched.c \
> > > >         ofproto/pinsched.h \
> > > >         ofproto/shiva.c     // my addition
> > > >
> > > > 2. my shiva.c file
> > > >
> > > >
> > > > #include<stdio.h>
> > > > #include<ofproto.h>
> > > >
> > > > void test()
> > > > {
> > > > printf("hiiii\n");
> > > >
> > > > }
> > > >
> > > > 3. added my test() function prototype in ofproto.h. few lines from
> > > > ofproto.h are :
> > > >
> > > > int ofproto_run(struct ofproto *);
> > > > void ofproto_wait(struct ofproto *);
> > > > bool ofproto_is_alive(const struct ofproto *);
> > > > void test(); // my addition
> > > >
> > > >
> > > > Please help me what changed i need to make to compile my shiva.c file
> > > with
> > > > OVS1.2.2.
> > > >
> > > > Thanks & Regards,
> > > > Shiva
> > > >
> > > > On Wed, Dec 21, 2011 at 11:18 AM, Ben Pfaff <blp at nicira.com> wrote:
> > > >
> > > > > It's easier for me if you do as I originally asked and show the
> changes
> > > > > you made.
> > > > >
> > > > > On Wed, Dec 21, 2011 at 11:22:01AM +0530, shiva m wrote:
> > > > > > Hi,
> > > > > >
> > > > > > Its a test.c file which has just a function test() which has
> > > > > printf("hi\n")
> > > > > > statement. I am trying to compile by adding my test.c file in
> > > ofproto/
> > > > > > automake.mk and function prototype in ofproto.h. Could you
> please
> > > help
> > > > > me
> > > > > > how to add my c file, where to change and compile it properly
> > > > > >
> > > > > > Thanks & Regards,
> > > > > > Shiva
> > > > > >
> > > > > > On Tue, Dec 20, 2011 at 8:54 PM, Ben Pfaff <blp at nicira.com>
> wrote:
> > > > > >
> > > > > > > On Tue, Dec 20, 2011 at 12:25:53PM +0530, shiva m wrote:
> > > > > > > > I have openvswitch 1.2.2 on xen server 6.0. I added my
> *test.c*
> > > file
> > > > > in *
> > > > > > > > ofproto* folder, included function prototype in ofproto.h
> and *
> > > > > > > test.c*file in
> > > > > > > > ofproto/automake.mk, but i am not able to compile.
> > > > > > > >
> > > > > > > > Could you please let me know how to add my test.c file to
> > > openvswitch
> > > > > > > 1.2.2
> > > > > > > > and compile it properly.
> > > > > > >
> > > > > > > It sounds like you did the right things in outline.  The
> details
> > > must
> > > > > be
> > > > > > > wrong.  So, you should show us the actual changes you made.
> > > > > > >
> > > > >
> > >
>
>
>
> _______________________________________________ dev mailing list
> dev at openvswitch.org http://openvswitch.org/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20111221/f07c921a/attachment-0003.html>


More information about the dev mailing list