[dpdk-dev] [PATCH] fix build warning and failure in Suse11

Yong Liu yong.liu at intel.com
Wed Mar 18 08:10:41 CET 2015


Suse11 SP3 default gcc version is 4.3.4, some options not support on this version.

error: implicit declaration of function ‘_mm_alignr_epi8’
solution: include tmmintrin.h when enable SSE3

error: unrecognized command line option "-Wno-unused-but-set-variable"
solution: add version check in fm10k Makefile

error: enic_main.c:845: error: initialized field overwritten
solution: change struct initialization code

error: ‘testfn_pci_cmd’ defined but not used
solution: add __attribute__((unused)) before function definition

error: unrecognized command line option "-fno-var-tracking-assignments"
solution: add version check in app/test/Makefile

error: implicit declaration of function ‘pread’
solution: add _GNU_SOURCE flag when compile eal_pci_uio and eal_interrupts

signed-off-by: Marvin Liu <yong.liu at intel.com>

diff --git a/app/test/Makefile b/app/test/Makefile
index 9f0262c..4aca77c 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -152,9 +152,11 @@ CFLAGS += -D_GNU_SOURCE
 
 # Disable VTA for memcpy test
 ifeq ($(CC), gcc)
+ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
 CFLAGS_test_memcpy.o += -fno-var-tracking-assignments
 CFLAGS_test_memcpy_perf.o += -fno-var-tracking-assignments
 endif
+endif
 
 # this application needs libraries first
 DEPDIRS-y += lib
diff --git a/app/test/test.h b/app/test/test.h
index 5450986..13f6592 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -169,7 +169,7 @@ struct test_command {
 void add_test_command(struct test_command *t);
 
 #define REGISTER_TEST_COMMAND(t) \
-static void testfn_##t(void);\
+static void __attribute__((unused))testfn_##t(void);\
 void __attribute__((constructor, used)) testfn_##t(void)\
 {\
 	add_test_command(&t);\
diff --git a/lib/librte_eal/common/include/rte_common_vect.h b/lib/librte_eal/common/include/rte_common_vect.h
index 54ec70f..df3dce4 100644
--- a/lib/librte_eal/common/include/rte_common_vect.h
+++ b/lib/librte_eal/common/include/rte_common_vect.h
@@ -50,6 +50,10 @@
 #include <emmintrin.h>
 #endif
 
+#ifdef __SSE3__
+#include <tmmintrin.h>
+#endif
+
 #if defined(__SSE4_2__) || defined(__SSE4_1__)
 #include <smmintrin.h>
 #endif
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 23c2d48..21875b8 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -102,6 +102,8 @@ CFLAGS_eal_pci_vfio.o := -D_GNU_SOURCE
 CFLAGS_eal_common_whitelist.o := -D_GNU_SOURCE
 CFLAGS_eal_common_options.o := -D_GNU_SOURCE
 CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
+CFLAGS_eal_pci_uio.o := -D_GNU_SOURCE
+CFLAGS_eal_interrupts.o := -D_GNU_SOURCE
 
 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
diff --git a/lib/librte_pmd_enic/enic_main.c b/lib/librte_pmd_enic/enic_main.c
index c66f139..0892b3e 100644
--- a/lib/librte_pmd_enic/enic_main.c
+++ b/lib/librte_pmd_enic/enic_main.c
@@ -840,10 +840,12 @@ static int enic_set_rsskey(struct enic *enic)
 	dma_addr_t rss_key_buf_pa;
 	union vnic_rss_key *rss_key_buf_va = NULL;
 	static union vnic_rss_key rss_key = {
-		.key[0] = {.b = {85, 67, 83, 97, 119, 101, 115, 111, 109, 101}},
-		.key[1] = {.b = {80, 65, 76, 79, 117, 110, 105, 113, 117, 101}},
-		.key[2] = {.b = {76, 73, 78, 85, 88, 114, 111, 99, 107, 115}},
-		.key[3] = {.b = {69, 78, 73, 67, 105, 115, 99, 111, 111, 108}},
+		.key = {
+			[0] = {.b = {85, 67, 83, 97, 119, 101, 115, 111, 109, 101}},
+			[1] = {.b = {80, 65, 76, 79, 117, 110, 105, 113, 117, 101}},
+			[2] = {.b = {76, 73, 78, 85, 88, 114, 111, 99, 107, 115}},
+			[3] = {.b = {69, 78, 73, 67, 105, 115, 99, 111, 111, 108}},
+		}
 	};
 	int err;
 	u8 name[NAME_MAX];
diff --git a/lib/librte_pmd_fm10k/Makefile b/lib/librte_pmd_fm10k/Makefile
index 998bf23..52fc315 100644
--- a/lib/librte_pmd_fm10k/Makefile
+++ b/lib/librte_pmd_fm10k/Makefile
@@ -62,13 +62,18 @@ else
 #
 # CFLAGS for gcc
 #
-ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
-CFLAGS     += -Wno-deprecated
-endif
 CFLAGS_BASE_DRIVER = -Wno-unused-parameter -Wno-unused-value
 CFLAGS_BASE_DRIVER += -Wno-strict-aliasing -Wno-format-extra-args
-CFLAGS_BASE_DRIVER += -Wno-unused-variable -Wno-unused-but-set-variable
+CFLAGS_BASE_DRIVER += -Wno-unused-variable
 CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers
+
+ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
+CFLAGS     += -Wno-deprecated
+endif
+
+ifeq ($(shell test $(GCC_VERSION) -ge 46 && echo 1), 1)
+CFLAGS_BASE_DRIVER += -Wno-unused-but-set-variable
+endif
 endif
 
 #
-- 
1.9.3



More information about the dev mailing list