[dpdk-dev] Issues with rte_hash_crc.h when compiling with C++

Pavel Odintsov pavel.odintsov at gmail.com
Tue May 5 10:08:37 CEST 2015


I fixed this issue with very dirty hacks.

I commented mentioned here lines in file
/usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:

//enum rte_cpu_flag_t;
//enum cpu_register_t;
// static const struct feature_entry cpu_feature_table[];
//static inline int
//rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);

And everything compiled OK. But I thought C++ tests and compatibility
is should for dpdk.

On Tue, May 5, 2015 at 10:57 AM, Pavel Odintsov
<pavel.odintsov at gmail.com> wrote:
> Hello!
>
> Could anybody help me with this issue? :(
>
> In this file widely used enum forward declarations which completely
> incompatible with C++ and need some rewrite.
>
> On Wed, Apr 29, 2015 at 3:17 PM, Pavel Odintsov
> <pavel.odintsov at gmail.com> wrote:
>> Hello!
>>
>> I have C++ application compiles and works nice. But when I include
>> rte_hash_crc.h header everything goes away.
>>
>>   CC main.o
>> In file included from
>> /usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_cpuflags.h:46:0,
>>                  from
>> /usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_hash_crc.h:48,
>>                  from /root/interceptor/main.cpp:25:
>> /usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:50:6:
>> error: use of enum ‘rte_cpu_flag_t’ without previous declaration
>>  enum rte_cpu_flag_t;
>>       ^
>> /usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:55:6:
>> error: use of enum ‘cpu_register_t’ without previous declaration
>>  enum cpu_register_t;
>>       ^
>> /usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:79:35:
>> error: uninitialized const ‘cpu_feature_table’ [-fpermissive]
>>  static const struct feature_entry cpu_feature_table[];
>>                                    ^
>> /usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:64:8:
>> note: ‘const struct feature_entry’ has no user-provided default
>> constructor
>>  struct feature_entry {
>>         ^
>> /usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:65:11:
>> note: and the implicitly-defined constructor does not initialize
>> ‘uint32_t feature_entry::leaf’
>>   uint32_t leaf;    /**< cpuid leaf */
>>            ^
>> /usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:79:53:
>> error: storage size of ‘cpu_feature_table’ isn’t known
>>  static const struct feature_entry cpu_feature_table[];
>>                                                      ^
>> /usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:101:31:
>> error: use of enum ‘rte_cpu_flag_t’ without previous declaration
>>  rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);
>>                                ^
>> In file included from
>> /usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_hash_crc.h:48:0,
>>                  from /root/interceptor/main.cpp:25:
>> /usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_cpuflags.h:
>> In function ‘int rte_cpu_get_flag_enabled(rte_cpu_flag_t)’:
>> /usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_cpuflags.h:278:53:
>> error: conflicting declaration of C function ‘int
>> rte_cpu_get_flag_enabled(rte_cpu_flag_t)’
>>  rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)
>>                                                      ^
>> In file included from
>> /usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_cpuflags.h:46:0,
>>                  from
>> /usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_hash_crc.h:48,
>>                  from /root/interceptor/main.cpp:25:
>> /usr/src/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:101:1:
>> note: previous declaration ‘int rte_cpu_get_flag_enabled(int)’
>>  rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);
>>  ^
>> /usr/src/dpdk-2.0.0/mk/internal/rte.compile-pre.mk:145: recipe for
>> target 'main.o' failed
>> make[1]: *** [main.o] Error 1
>> /usr/src/dpdk-2.0.0/mk/rte.extapp.mk:42: recipe for target 'all' failed
>> make: *** [all] Error 2
>>
>> I prepared my environment with this manual:
>> http://www.stableit.ru/2015/04/how-to-code-for-dpdk-with-c.html
>>
>> Could anybody help me with this header file and C++?
>>
>> --
>> Sincerely yours, Pavel Odintsov
>
>
>
> --
> Sincerely yours, Pavel Odintsov



-- 
Sincerely yours, Pavel Odintsov


More information about the dev mailing list