[dpdk-dev] pktgen-2.9.13 not compiling with gcc 4.9 because of -Wdiscarded-qualifiers / 2.9.12 fine

Message ID 1460280328.25322.105.camel@guerby.net (mailing list archive)
State Not Applicable, archived
Headers

Commit Message

Laurent GUERBY April 10, 2016, 9:25 a.m. UTC
  On Sun, 2016-04-10 at 04:59 +0000, Wiles, Keith wrote:
> >Hi,
> >
> >pktgen-2.9.13 is not compiling with gcc 4.9, see below
> >
> >2.9.12 is compiling fine with gcc 4.9, so looks like new
> >IPv6 code recently added is the culprit.
> >
> >I think -Wdiscarded-qualifiers is available only with gcc 5+ 
> >https://gcc.gnu.org/gcc-5/changes.html
> 
> Thanks I have fixed the problem on Ubuntu 15.10 using gcc 4.9 and 5.x plus pushed a new version. Please give it a try.

Hi Keith,

The original error is gone, thanks! But I get another one a bit later
(source up to date from git for pktgen, DPDK 2.2.0 as SDK) :

  CC pktgen-capture.o
In file included from /root/pktgen-dpdk/app/pktgen-seq.h:72:0,
                 from /root/pktgen-dpdk/app/pktgen-port-cfg.h:80,
                 from /root/pktgen-dpdk/app/pktgen-capture.h:77,
                 from /root/pktgen-dpdk/app/pktgen-capture.c:68:
/root/dpdk-2.2.0/x86_64-native-linuxapp-gcc/include/cmdline_parse_ipaddr.h:89:27: error: field ‘hdr’ has incomplete type
  struct cmdline_token_hdr hdr;
                           ^
/root/dpdk-2.2.0/x86_64-native-linuxapp-gcc/include/cmdline_parse_ipaddr.h:96:26: error: unknown type name ‘cmdline_parse_token_hdr_t’
 int cmdline_parse_ipaddr(cmdline_parse_token_hdr_t *tk, const char
*srcbuf,
                          ^
/root/dpdk-2.2.0/x86_64-native-linuxapp-gcc/include/cmdline_parse_ipaddr.h:98:29: error: unknown type name ‘cmdline_parse_token_hdr_t’
 int cmdline_get_help_ipaddr(cmdline_parse_token_hdr_t *tk, char
*dstbuf,
                             ^
/root/dpdk-2.2.0/mk/internal/rte.compile-pre.mk:126: recipe for target
'pktgen-capture.o' failed
make[2]: *** [pktgen-capture.o] Error 1
/root/dpdk-2.2.0/mk/rte.extapp.mk:42: recipe for target 'all' failed
make[1]: *** [all] Error 2
/root/dpdk-2.2.0/mk/rte.extsubdir.mk:46: recipe for target 'app' failed
make: *** [app] Error 2

This is fixed by this patch:

root@dpdk3:~/pktgen-dpdk/app# git diff
Then it fails linking:

  LD pktgen
/usr/bin/ld: cannot find -llua
collect2: error: ld returned 1 exit status

I tried a few things and got this link working but then I got errors
about implicit declaration of function ‘lua_putstring’  and this is a
macro in 5.3.0 but not present in 5.3.2, a bit more lua transition work
is probably needed :).

Sincerely,

Laurent

> >
> >Sincerely,
> >
> >Laurent
> >
> >root@dpdk3:~/pktgen-2.9.13# make
> >== lib
> >== common
> >  CC wr_copyright_info.o
> >  CC wr_port_config.o
> >  CC wr_core_info.o
> >  CC wr_lscpu.o
> >  CC wr_utils.o
> >  CC wr_coremap.o
> >  CC wr_pcap.o
> >In file included from /root/pktgen-2.9.13/lib/common/wr_pcap.c:122:0:
> >/root/pktgen-2.9.13/lib/common/wr_inet.h:755:9: error: unknown option
> >after ‘#pragma GCC diagnostic’ kind [-Werror=pragmas]
> > #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
> >         ^
> >/root/pktgen-2.9.13/lib/common/wr_inet.h: In function ‘inet_ntop6’:
> >/root/pktgen-2.9.13/lib/common/wr_inet.h:758:2: error: return discards
> >‘const’ qualifier from pointer target type [-Werror]
> >  return inet_ntop(AF_INET6, ip6, buff, len);
> >  ^
> >cc1: all warnings being treated as errors
> >/root/dpdk-2.2.0/mk/internal/rte.compile-pre.mk:126: recipe for target
> >'wr_pcap.o' failed
> >make[3]: *** [wr_pcap.o] Error 1
> >/root/dpdk-2.2.0/mk/rte.extlib.mk:44: recipe for target 'all' failed
> >make[2]: *** [all] Error 2
> >/root/dpdk-2.2.0/mk/rte.extsubdir.mk:46: recipe for target 'common'
> >failed
> >make[1]: *** [common] Error 2
> >/root/dpdk-2.2.0/mk/rte.extsubdir.mk:46: recipe for target 'lib' failed
> >make: *** [lib] Error 2
> >
> >
> >
> 
> 
> Regards,
> Keith
> 
> 
> 
>
  

Comments

Wiles, Keith April 10, 2016, 5:47 p.m. UTC | #1
>On Sun, 2016-04-10 at 04:59 +0000, Wiles, Keith wrote:

>> >Hi,

>> >

>> >pktgen-2.9.13 is not compiling with gcc 4.9, see below

>> >

>> >2.9.12 is compiling fine with gcc 4.9, so looks like new

>> >IPv6 code recently added is the culprit.

>> >

>> >I think -Wdiscarded-qualifiers is available only with gcc 5+ 

>> >https://gcc.gnu.org/gcc-5/changes.html

>> 

>> Thanks I have fixed the problem on Ubuntu 15.10 using gcc 4.9 and 5.x plus pushed a new version. Please give it a try.

>

>Hi Keith,

>

>The original error is gone, thanks! But I get another one a bit later

>(source up to date from git for pktgen, DPDK 2.2.0 as SDK) :

>

>  CC pktgen-capture.o

>In file included from /root/pktgen-dpdk/app/pktgen-seq.h:72:0,

>                 from /root/pktgen-dpdk/app/pktgen-port-cfg.h:80,

>                 from /root/pktgen-dpdk/app/pktgen-capture.h:77,

>                 from /root/pktgen-dpdk/app/pktgen-capture.c:68:

>/root/dpdk-2.2.0/x86_64-native-linuxapp-gcc/include/cmdline_parse_ipaddr.h:89:27: error: field ‘hdr’ has incomplete type

>  struct cmdline_token_hdr hdr;

>                           ^

>/root/dpdk-2.2.0/x86_64-native-linuxapp-gcc/include/cmdline_parse_ipaddr.h:96:26: error: unknown type name ‘cmdline_parse_token_hdr_t’

> int cmdline_parse_ipaddr(cmdline_parse_token_hdr_t *tk, const char

>*srcbuf,

>                          ^

>/root/dpdk-2.2.0/x86_64-native-linuxapp-gcc/include/cmdline_parse_ipaddr.h:98:29: error: unknown type name ‘cmdline_parse_token_hdr_t’

> int cmdline_get_help_ipaddr(cmdline_parse_token_hdr_t *tk, char

>*dstbuf,

>                             ^

>/root/dpdk-2.2.0/mk/internal/rte.compile-pre.mk:126: recipe for target

>'pktgen-capture.o' failed

>make[2]: *** [pktgen-capture.o] Error 1

>/root/dpdk-2.2.0/mk/rte.extapp.mk:42: recipe for target 'all' failed

>make[1]: *** [all] Error 2

>/root/dpdk-2.2.0/mk/rte.extsubdir.mk:46: recipe for target 'app' failed

>make: *** [app] Error 2

>

>This is fixed by this patch:

>

>root@dpdk3:~/pktgen-dpdk/app# git diff

>diff --git a/app/pktgen-seq.h b/app/pktgen-seq.h

>index a48fbe0..ba787ff 100644

>--- a/app/pktgen-seq.h

>+++ b/app/pktgen-seq.h

>@@ -69,6 +69,7 @@

> #define _PKTGEN_SEQ_H_

> 

> #include <rte_ether.h>

>+#include <cmdline_parse.h>

> #include <cmdline_parse_ipaddr.h>

> #include <wr_inet.h>

> 

>Then it fails linking:

>

>  LD pktgen

>/usr/bin/ld: cannot find -llua

>collect2: error: ld returned 1 exit status

>

>I tried a few things and got this link working but then I got errors

>about implicit declaration of function ‘lua_putstring’  and this is a

>macro in 5.3.0 but not present in 5.3.2, a bit more lua transition work

>is probably needed :).

>

>Sincerely,

>

>Laurent

>

>> >

>> >Sincerely,

>> >

>> >Laurent

>> >

>> >root@dpdk3:~/pktgen-2.9.13# make

>> >== lib

>> >== common

>> >  CC wr_copyright_info.o

>> >  CC wr_port_config.o

>> >  CC wr_core_info.o

>> >  CC wr_lscpu.o

>> >  CC wr_utils.o

>> >  CC wr_coremap.o

>> >  CC wr_pcap.o

>> >In file included from /root/pktgen-2.9.13/lib/common/wr_pcap.c:122:0:

>> >/root/pktgen-2.9.13/lib/common/wr_inet.h:755:9: error: unknown option

>> >after ‘#pragma GCC diagnostic’ kind [-Werror=pragmas]

>> > #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"

>> >         ^

>> >/root/pktgen-2.9.13/lib/common/wr_inet.h: In function ‘inet_ntop6’:

>> >/root/pktgen-2.9.13/lib/common/wr_inet.h:758:2: error: return discards

>> >‘const’ qualifier from pointer target type [-Werror]

>> >  return inet_ntop(AF_INET6, ip6, buff, len);

>> >  ^

>> >cc1: all warnings being treated as errors

>> >/root/dpdk-2.2.0/mk/internal/rte.compile-pre.mk:126: recipe for target

>> >'wr_pcap.o' failed

>> >make[3]: *** [wr_pcap.o] Error 1

>> >/root/dpdk-2.2.0/mk/rte.extlib.mk:44: recipe for target 'all' failed

>> >make[2]: *** [all] Error 2

>> >/root/dpdk-2.2.0/mk/rte.extsubdir.mk:46: recipe for target 'common'

>> >failed

>> >make[1]: *** [common] Error 2

>> >/root/dpdk-2.2.0/mk/rte.extsubdir.mk:46: recipe for target 'lib' failed

>> >make: *** [lib] Error 2


Try out the dev branch on dpdk.org and see if that fixes the problems.

>> >

>> >

>> >

>> 

>> 

>> Regards,

>> Keith

>> 

>> 

>> 

>> 

>

>

>



Regards,
Keith
  

Patch

diff --git a/app/pktgen-seq.h b/app/pktgen-seq.h
index a48fbe0..ba787ff 100644
--- a/app/pktgen-seq.h
+++ b/app/pktgen-seq.h
@@ -69,6 +69,7 @@ 
 #define _PKTGEN_SEQ_H_
 
 #include <rte_ether.h>
+#include <cmdline_parse.h>
 #include <cmdline_parse_ipaddr.h>
 #include <wr_inet.h>