Skip to contentSkip to conversation

buildtools: remove invalid option for Microsoft linker

PATCH In review Andre Muezerie 3 participants 4 messages Mar 12, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 buildtools: remove invalid option for Microsoft linker

When compiling "drivers" directory with MSVC the errors below popped up:

drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:

    missing ')' before '('

drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')' drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')' drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:
missing ')' before 'const'
drivers/rte_mempool_stack.pmd.c(1): error C2091: function returns function

The fix is to use common macros compatible with MSVC.

---
 buildtools/pmdinfogen.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
buildtools/pmdinfogen.py +3 -2
index dfb89500c0..116f05e7a8 100755
@@ -192,7 +192,7 @@ def dump(self, file):
         dumped = json.dumps(self.__dict__)
         escaped = dumped.replace('"', '\\"')
         print(
-            'const char %s_pmd_info[] __attribute__((used)) = "PMD_INFO_STRING= %s";'
+            'const char %s_pmd_info[] __rte_used = "PMD_INFO_STRING= %s";'
             % (self.name, escaped),
             file=file,
         )
@@ -252,7 +252,8 @@ def open_output(path):
 
 def write_header(output):
     output.write(
-        "static __attribute__((unused)) const char *generator = \"%s\";\n" % sys.argv[0]
+        "#include <rte_common.h>\n"
+        "static __rte_unused const char *generator = \"%s\";\n" % sys.argv[0]
     )
 
 
Signature · 1 line
2.48.1.vfs.0.1
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Andre Muezerie

When compiling "drivers" directory with MSVC the errors below popped up:

drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:

    missing ')' before '('

drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')' drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')' drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:
missing ')' before 'const'
drivers/rte_mempool_stack.pmd.c(1): error C2091: function returns function

Quoted 3 lines

The fix is to use common macros compatible with MSVC.

#2 lore raw
In reply to Andre Muezerie
Quoted 11 lines · Andre Muezerie

When compiling "drivers" directory with MSVC the errors below popped up:

drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:

    missing ')' before '('

drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')' drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')' drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:
missing ')' before 'const'
drivers/rte_mempool_stack.pmd.c(1): error C2091: function returns function

Quoted 3 lines

The fix is to use common macros compatible with MSVC.

Out of curiosity, did you try dpdk-pmdinfo.py on generated binaries?

Signature · 1 line
David Marchand
#3 lore raw
Quoted 13 lines · David Marchand
Quoted 11 lines · Andre Muezerie

When compiling "drivers" directory with MSVC the errors below popped up:

drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:

    missing ')' before '('

drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')' drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')' drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:
missing ')' before 'const'
drivers/rte_mempool_stack.pmd.c(1): error C2091: function returns function

Quoted 5 lines
Quoted 3 lines

The fix is to use common macros compatible with MSVC.

Out of curiosity, did you try dpdk-pmdinfo.py on generated binaries?

That script does not work on Windows. It depends on ldd and ELF binary format to extract info from the binary. I'll see what can be done there.

Quoted 4 lines
Signature · 2 lines
-- 
David Marchand