From: "Sanford, Robert" <rsanford@akamai.com>
To: Dirk-Holger Lenz <dirk.lenz@ng4t.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] g++ applications doesn't compile anymore when dpdk header files are included
Date: Wed, 1 Jul 2015 17:32:54 +0000 [thread overview]
Message-ID: <D1B98EE0.A6A2%rsanford@akamai.com> (raw)
In-Reply-To: <55941678.3000806@ng4t.com>
[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]
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
>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
>--
>Dirk-Holger Lenz
>+49 157 848 09099
>dirk.lenz@ng4t.com
> 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
[-- Attachment #2: cpuflags-diff.txt --]
[-- Type: text/plain, Size: 4741 bytes --]
diff --git a/lib/librte_eal/common/eal_common_cpuflags.c b/lib/librte_eal/common/eal_common_cpuflags.c
index 6fd360c..07c1e7b 100644
--- a/lib/librte_eal/common/eal_common_cpuflags.c
+++ b/lib/librte_eal/common/eal_common_cpuflags.c
@@ -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);
}
}
diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h b/lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h
index df45047..3dfa6d2 100644
--- a/lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h
@@ -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! */
diff --git a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
index dd56553..a4a8d19 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
@@ -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! */
diff --git a/lib/librte_eal/common/include/generic/rte_cpuflags.h b/lib/librte_eal/common/include/generic/rte_cpuflags.h
index a04e021..760539f 100644
--- a/lib/librte_eal/common/include/generic/rte_cpuflags.h
+++ b/lib/librte_eal/common/include/generic/rte_cpuflags.h
@@ -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_ */
prev parent reply other threads:[~2015-07-01 17:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-01 16:34 Dirk-Holger Lenz
2015-07-01 17:32 ` Sanford, Robert [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D1B98EE0.A6A2%rsanford@akamai.com \
--to=rsanford@akamai.com \
--cc=dev@dpdk.org \
--cc=dirk.lenz@ng4t.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).