rohc team mailing list archive
-
rohc team
-
Mailing list archive
-
Message #00041
Re: Error using the ROHC compressor
Hi Didier,
Thanks for your reply. Apologies for the delayed response; I hadn't accessed
my list mail in a while.
> > $ gcc packetforwardrohc.c -o packetforwardrohc -I/usr/include
> > -L/usr/lib -lpcap `libnet-config --defines --cflags --libs`
> > -lrohc_comp -lrohc_common -lm
> >
> > In file included from headers.h:8,
> > from packetforwardrohc.c:50:
> > /home/josie/rohc-1.2.0/src/comp/rohc_comp.h:197: warning: ‘struct
> > ip_packet’ declared inside parameter list
> > /home/josie/rohc-1.2.0/src/comp/rohc_comp.h:197: warning: its scope
> > is only this definition or declaration, which is probably not what
> > you want /home/josie/rohc-1.2.0/src/comp/rohc_comp.h:205: warning:
> > ‘struct ip_packet’ declared inside parameter list
> > /home/josie/rohc-1.2.0/src/comp/rohc_comp.h:210: warning: ‘struct
> > ip_packet’ declared inside parameter list
> > /home/josie/rohc-1.2.0/src/comp/rohc_comp.h:279: warning: ‘struct
> > ip_packet’ declared inside parameter list
> > /home/josie/rohc-1.2.0/src/comp/rohc_comp.h:280: warning: ‘struct
> > ip_packet’ declared inside parameter list
> > /home/josie/rohc-1.2.0/src/comp/rohc_comp.h:290: warning: ‘struct
> > ip_packet’ declared inside parameter list
> > In file included from packetforwardrohc.c:50:
> > headers.h:14:1: warning: "ETHER_ADDR_LEN" redefined
> > In file included from /usr/include/libnet.h:57,
> > from packetforwardrohc.c:49:
> > /usr/include/net/ethernet.h:52:1: warning: this is the location of the
> > previous definition
> > packetforwardrohc.c: In function ‘got_packet’:
> > packetforwardrohc.c:535: warning: passing argument 2 of
> > ‘rohc_compress’ discards qualifiers from pointer target type
> > /usr/lib/gcc/i486-linux-gnu/4.2.4/../../../../lib/crt1.o: In function
> > `_start':
> > (.text+0x18): undefined reference to `main'
> > collect2: ld returned 1 exit status
>
> GCC reports a problem in the file
> "/home/josie/rohc-1.2.0/src/comp/rohc_comp.h", it means you try to
> include this file in your code. You should not include this file
> that way.
>
> You should first install the ROHC library binaries and headers on
> your system from the sources and then build your program with the
> installed binaries and headers (and not the ones you may found in the
> source directory).
>
> The ROHC headers (rohc_comp.h among others) should be installed on your
> system if you followed the steps described at
> https://answers.launchpad.net/rohc/+faq/635. Check that the
> file /usr/include/rohc_comp.h exist. If not, install the library first.
>
I realised that I had included the '/home/...../src/... .h' in a second of
the program's files, so I deleted this second set.
Then, in your program (packetforwardrohc.c), simply put the 2 following
> lines at the top of the code:
> #include <rohc.h>
> #include <rohc_comp.h>
>
I also made the changes above, from what I initially had, which was
#include "rohc.h"
#include "rohc_comp.h"
When I compiled again there were fewer errors:
$ gcc -o packetforwardrohc packetforwardrohc.c -lrohc_decomp -lrohc_comp
-lrohc_common -lm -lnet -lpcap
packetforwardrohc.c: In function ‘got_packet’:
packetforwardrohc.c:540: warning: passing argument 2 of ‘rohc_compress’
discards qualifiers from pointer target type
/usr/lib/gcc/i486-linux-gnu/4.2.4/../../../../lib/crt1.o: In function
`_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
> A simple program example for using the ROHC compression is attached to
> this message. You may build it with the following GCC command :
> $ gcc -o simple_rohc_program -g -Wall \
> -lrohc_common -lrohc_comp -lm \
> simple_rohc_program.c
>
Thanks a lot, the simple program is running perfectly, and I'll use it to
help debug my program.
Regards,
Josephine
Follow ups
References