Skip to contentSkip to conversation

eal/windows: fix mingw build

PATCH In review Bruce Richardson 2 participants 3 messages Nov 22, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal/windows: fix mingw build

When compiling with mingw on Ubuntu 23.10, I get the following compiler error:

../../lib/eal/windows/eal_memory.c:77: error: "MEM_REPLACE_PLACEHOLDER" redefined [-Werror]
77 | #define MEM_REPLACE_PLACEHOLDER 0x00004000

      |
In file included from /usr/share/mingw-w64/include/minwindef.h:163,
                 from /usr/share/mingw-w64/include/windef.h:9,
                 from /usr/share/mingw-w64/include/windows.h:69,
                 from ../../lib/eal/windows/include/rte_windows.h:32,
                 from ../../lib/eal/windows/include/rte_os_shim.h:9,
                 from ../../lib/eal/common/eal_internal_cfg.h:14,
                 from ../../lib/eal/windows/eal_memory.c:11:

/usr/share/mingw-w64/include/winnt.h:5710: note: this is the location of the previous definition
5710 | #define MEM_REPLACE_PLACEHOLDER 0x4000

and a similar error for MEM_RESERVE_PLACEHOLDER. These errors can be fixed by wrapping the two defines in #ifndef .. #endif blocks.

Fixes 2a5d547a4a9b ("eal/windows: implement basic memory management")
---
 lib/eal/windows/eal_memory.c | 5 +++++
 1 file changed, 5 insertions(+)
lib/eal/windows/eal_memory.c +5 -0
index 215d768e2c..64598745de 100644
@@ -74,8 +74,13 @@ static VirtualAlloc2_type VirtualAlloc2_ptr;
 
 #define MEM_COALESCE_PLACEHOLDERS 0x00000001
 #define MEM_PRESERVE_PLACEHOLDER  0x00000002
+
+#ifndef MEM_REPLACE_PLACEHOLDER
 #define MEM_REPLACE_PLACEHOLDER   0x00004000
+#endif
+#ifndef MEM_RESERVE_PLACEHOLDER
 #define MEM_RESERVE_PLACEHOLDER   0x00040000
+#endif
 
 int
 eal_mem_win32api_init(void)
Signature · 1 line
2.40.1
#1 lore raw
Quoted 17 lines · Bruce Richardson

When compiling with mingw on Ubuntu 23.10, I get the following compiler error:

../../lib/eal/windows/eal_memory.c:77: error: "MEM_REPLACE_PLACEHOLDER" redefined [-Werror]
77 | #define MEM_REPLACE_PLACEHOLDER 0x00004000

      |
In file included from /usr/share/mingw-w64/include/minwindef.h:163,
                 from /usr/share/mingw-w64/include/windef.h:9,
                 from /usr/share/mingw-w64/include/windows.h:69,
                 from ../../lib/eal/windows/include/rte_windows.h:32,
                 from ../../lib/eal/windows/include/rte_os_shim.h:9,
                 from ../../lib/eal/common/eal_internal_cfg.h:14,
                 from ../../lib/eal/windows/eal_memory.c:11:

/usr/share/mingw-w64/include/winnt.h:5710: note: this is the location of the previous definition
5710 | #define MEM_REPLACE_PLACEHOLDER 0x4000

Quoted 8 lines

and a similar error for MEM_RESERVE_PLACEHOLDER. These errors can be fixed by wrapping the two defines in #ifndef .. #endif blocks.

Fixes 2a5d547a4a9b ("eal/windows: implement basic memory management")

Probably a duplicate of
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

Signature · 1 line
David Marchand
#2 lore raw
Quoted 22 lines · David Marchand
Quoted 20 lines · Bruce Richardson

When compiling with mingw on Ubuntu 23.10, I get the following compiler error:

../../lib/eal/windows/eal_memory.c:77: error: "MEM_REPLACE_PLACEHOLDER" redefined [-Werror]
77 | #define MEM_REPLACE_PLACEHOLDER 0x00004000

      |
In file included from /usr/share/mingw-w64/include/minwindef.h:163,
                 from /usr/share/mingw-w64/include/windef.h:9,
                 from /usr/share/mingw-w64/include/windows.h:69,
                 from ../../lib/eal/windows/include/rte_windows.h:32,
                 from ../../lib/eal/windows/include/rte_os_shim.h:9,
                 from ../../lib/eal/common/eal_internal_cfg.h:14,
                 from ../../lib/eal/windows/eal_memory.c:11:

/usr/share/mingw-w64/include/winnt.h:5710: note: this is the location of the previous definition
5710 | #define MEM_REPLACE_PLACEHOLDER 0x4000

and a similar error for MEM_RESERVE_PLACEHOLDER. These errors can be fixed by wrapping the two defines in #ifndef .. #endif blocks.

Quoted 9 lines
Quoted 5 lines
Fixes 2a5d547a4a9b ("eal/windows: implement basic memory management")

Probably a duplicate of
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

Yep, duplicate. I'll reject my patch in patchwork. Hopefully the patch above will be merged soon to make this issue go away! :-)

/Bruce