g++ applications doesn't compile anymore when dpdk header files are included
Hello,
the g++ complains the following problems when rte_xxxx.h header files are included:
....x86_64-native-linuxapp-gcc/include/rte_common.h:95:59: warning:
invalid conversion from ‘void*’ to ‘rte_mempool_objhdr*’.... this appears in multiple flavours
-as a workaround the '-fpermissive' option of the g++ may be used but
that's not nice.....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;
....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;....x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:104:31: error: use of enum ‘rte_cpu_flag_t’ without previous declaration rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);
-as a workaround the file
'lib/librte_eal/common/include/generic/rte_cpuflags.h' may be modified:
remove or uncomment the following lines:
line 50: //enum rte_cpu_flag_t;
line 55: //enum cpu_register_t;
lines 103/104: //static inline int
//rte_cpu_get_flag_enabled(enum
rte_cpu_flag_t feature);
Best regards
Dirk
Signature · 18 lines
Dirk-Holger Lenz +49 157 848 09099 [email protected] ng 4 T Telecommunication Technology Testing Tools ng4T GmbH Siemensdamm 50 13629 Berlin Germany www.ng4t.com <http://www.ng4t.com/> +49 30 65218530 Berlin-Charlottenburg, HRB 123546 CEO Dr. Andreas Kallmann
Hello Dirk,
We recently resolved a similar problem with rte_cpuflags.h. I'm attaching a git-diff of how we worked around it.
We may submit a patch for this, eventually.
--
Regards,
Robert
Quoted 20 lines
Hello,
the g++ complains the following problems whenrte_xxxx.hheader files are included:
....x86_64-native-linuxapp-gcc/include/rte_common.h:95:59: warning:
invalid conversion from Œvoid*¹ to Œrte_mempool_objhdr*¹.... this appears in multiple flavours
-as a workaround the '-fpermissive' option of the g++ may be used but
that's not nice.....x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:50:6:
error: use of enum Œrte_cpu_flag_t¹ without previous declaration enumrte_cpu_flag_t;
....x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:55:6:
error: use of enum Œcpu_register_t¹ without previous declaration
enumcpu_register_t;....x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:104:31:
error: use of enum Œrte_cpu_flag_t¹ without previous declarationrte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);
-as a workaround the file
'lib/librte_eal/common/include/generic/rte_cpuflags.h' may be modified:
remove or uncomment the following lines:
Quoted 27 lines
line 50: //enum rte_cpu_flag_t; line 55: //enum cpu_register_t; lines 103/104: //static inline int //rte_cpu_get_flag_enabled(enum
rte_cpu_flag_tfeature);Best regards
DirkSignature · 18 lines
Dirk-Holger Lenz +49 157 848 09099 [email protected] ng 4 T Telecommunication Technology Testing Tools ng4T GmbH Siemensdamm 50 13629 Berlin Germany www.ng4t.com <http://www.ng4t.com/> +49 30 65218530 Berlin-Charlottenburg, HRB 123546 CEO Dr. Andreas Kallmann
lib/librte_eal/common/eal_common_cpuflags.c +2 -1
@@ -30,6 +30,7 @@* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define RTE_INSTANTIATE_CPU_FEATURES 1#include <rte_cpuflags.h> /*
@@ -78,7 +79,7 @@ rte_cpu_check_supported(void)fprintf (stderr,"ERROR: This system does not support \"%s\".\n" "Please check that RTE_MACHINE is set correctly.\n" , - cpu_feature_table[compile_time_flags[i]].name); + rte_cpu_feature_table[compile_time_flags[i]].name);exit (1 ); } }
lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h +6 -4
@@ -42,8 +42,6 @@ extern "C" {#include <assert.h> #include <unistd.h> -#include "generic/rte_cpuflags.h" -/* Symbolic values for the entries in the auxiliary table */ #define AT_HWCAP 16#define AT_HWCAP2 26
@@ -96,7 +94,10 @@ enum rte_cpu_flag_t { RTE_CPUFLAG_NUMFLAGS,/**< This should always be the last! */ }; -static const struct feature_entry cpu_feature_table[] = { +#include "generic/rte_cpuflags.h" + +#ifdef RTE_INSTANTIATE_CPU_FEATURES +const struct feature_entry rte_cpu_feature_table[] = { FEAT_DEF(PPC_LE, 0x00000001, 0, REG_HWCAP, 0) FEAT_DEF(TRUE_LE, 0x00000001, 0, REG_HWCAP, 1) FEAT_DEF(PSERIES_PERFMON_COMPAT, 0x00000001, 0, REG_HWCAP, 6)
@@ -132,6 +133,7 @@ static const struct feature_entry cpu_feature_table[] = { FEAT_DEF(HTM, 0x00000001, 0, REG_HWCAP2, 30)FEAT_DEF (ARCH_2_07 ,0x00000001 ,0 ,REG_HWCAP2 ,31 ) }; +#endif /* * Read AUXV software register and get cpu features for Power
@@ -167,7 +169,7 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)/* Flag does not match anything in the feature tables */ return -ENOENT ; - feat = &cpu_feature_table[feature]; + feat = &rte_cpu_feature_table[feature];if (!feat->leaf)/* This entry in the table wasn't filled out! */
lib/librte_eal/common/include/arch/x86/rte_cpuflags.h +6 -4
@@ -43,8 +43,6 @@ extern "C" {#include <errno.h> #include <stdint.h> -#include "generic/rte_cpuflags.h" -enum rte_cpu_flag_t {/* (EAX 01h) ECX features*/ RTE_CPUFLAG_SSE3 =0 ,/**< SSE3 */
@@ -157,7 +155,10 @@ enum cpu_register_t { RTE_REG_EDX, }; -static const struct feature_entry cpu_feature_table[] = { +#include "generic/rte_cpuflags.h" + +#ifdef RTE_INSTANTIATE_CPU_FEATURES +const struct feature_entry rte_cpu_feature_table[] = { FEAT_DEF(SSE3, 0x00000001, 0, RTE_REG_ECX, 0) FEAT_DEF(PCLMULQDQ, 0x00000001, 0, RTE_REG_ECX, 1) FEAT_DEF(DTES64, 0x00000001, 0, RTE_REG_ECX, 2)
@@ -250,6 +251,7 @@ static const struct feature_entry cpu_feature_table[] = {FEAT_DEF (INVTSC ,0x80000007 ,0 ,RTE_REG_EDX ,8 ) }; +#endif static inline void rte_cpu_get_features (uint32_t leaf,uint32_t subleaf,cpuid_registers_t out)
@@ -285,7 +287,7 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)/* Flag does not match anything in the feature tables */ return -ENOENT ; - feat = &cpu_feature_table[feature]; + feat = &rte_cpu_feature_table[feature];if (!feat->leaf)/* This entry in the table wasn't filled out! */
lib/librte_eal/common/include/generic/rte_cpuflags.h +9 -1
@@ -39,6 +39,10 @@* Architecture specific API to determine available CPU features at runtime. */ +#ifdef __cplusplus +extern "C" { +#endif +#include <stdlib.h> #include <stdio.h> #include <errno.h>
@@ -75,7 +79,7 @@ struct feature_entry {/** * An array that holds feature entries */ -static const struct feature_entry cpu_feature_table[]; +extern const struct feature_entry rte_cpu_feature_table[];/** * Execute CPUID instruction and get contents of a specific register
@@ -107,4 +111,8 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);void rte_cpu_check_supported (void ); +#ifdef __cplusplus +} +#endif +#endif /* _RTE_CPUFLAGS_H_ */