Skip to contentSkip to conversation

build eal & ring libraries with MSVC

PATCH In review Tyler Retzlaff 4 participants 6 messages Feb 27, 2024 – Mar 6, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover build eal & ring libraries with MSVC

Enable build of eal & ring library when building with MSVC.

This series depends on 2 other series that seem to be near being accepted for merge.

https://patches.dpdk.org/project/dpdk/list/?series=31229
https://patches.dpdk.org/project/dpdk/list/?series=31230

Since the rc2 deadline is soon this series is being submitted now to solicit feedback. The CI is expected to fail without the above series being merged.

Tyler Retzlaff (2):
build: build eal library with MSVC
build: build ring library with MSVC

 config/meson.build           | 10 +++++++++-
 lib/eal/include/rte_common.h |  2 ++
 lib/meson.build              |  2 ++
 3 files changed, 13 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/2 build: build eal library with MSVC

* MSVC now has limited handling of GCC __extension__ keyword when compiling C so only expand __extension__ empty on MSVC when building with C++.

* When building with MSVC enable the statement expressions compiler extension.

* When building with MSVC enable building of eal library.

---
 config/meson.build           | 7 ++++++-
 lib/eal/include/rte_common.h | 2 ++
 lib/meson.build              | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)
config/meson.build +6 -1
index f8f2149..68186e1 100644
@@ -39,13 +39,18 @@ if is_ms_compiler
     # temporarily disable msvc specific warnings
     # - 4244 compiler detected conversion of integer to smaller type
     # - 4267 compiler detected conversion of size_t to smaller type
-    add_project_arguments('/wd4244', '/wd4267', language: 'c')
+    # - 4146 unary minus applied to unsigned type
+    add_project_arguments('/wd4244', '/wd4267', '/wd4146', language: 'c')
 
     # enable non-locking atomic operations
     add_project_arguments('/experimental:c11atomics', language: 'c')
 
     # enable typeof operator
     add_project_arguments('/d1experimental:typeof', language: 'c')
+
+    # enable statement expressions extension
+    add_project_arguments('/experimental:statementExpressions', language: 'c')
+
 endif
 
 # set the major version, which might be used by drivers and libraries
lib/eal/include/rte_common.h +2 -0
index 1cc1222..99128d8 100644
@@ -38,8 +38,10 @@
 #endif
 
 #ifdef RTE_TOOLCHAIN_MSVC
+#ifdef __cplusplus
 #define __extension__
 #endif
+#endif
 
 /*
  * RTE_TOOLCHAIN_GCC is defined if the target is built with GCC,
lib/meson.build +1 -0
index 4fb01f0..d77bfbc 100644
@@ -73,6 +73,7 @@ if is_ms_compiler
             'log',
             'kvargs',
             'telemetry',
+            'eal',
     ]
 endif
 
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/2 build: build ring library with MSVC

In reply to Tyler Retzlaff

* Use RTE_USE_C11_MEM_MODEL when building with MSVC.

* When building with MSVC enable building of ring library.

---
 config/meson.build | 3 +++
 lib/meson.build    | 1 +
 2 files changed, 4 insertions(+)
config/meson.build +3 -0
index 68186e1..b995ac6 100644
@@ -32,6 +32,9 @@ if is_ms_compiler
     # does not support inline assembly
     dpdk_conf.set('RTE_FORCE_INTRINSICS', 1)
 
+    # force the use of C++11 memory model in lib/ring
+    dpdk_conf.set('RTE_USE_C11_MEM_MODEL', 1)
+
     # suppress warnings raised for using standard library functions
     # the MSVC compiler regards as unsafe but are used by DPDK
     dpdk_conf.set('_CRT_SECURE_NO_WARNINGS', 1)
lib/meson.build +1 -0
index d77bfbc..179a272 100644
@@ -74,6 +74,7 @@ if is_ms_compiler
             'kvargs',
             'telemetry',
             'eal',
+            'ring',
     ]
 endif
 
Signature · 1 line
1.8.3.1
#3 lore raw
In reply to Tyler Retzlaff
Quoted 12 lines · Tyler Retzlaff

Enable build of eal & ring library when building with MSVC.

This series depends on 2 other series that seem to be near being accepted for merge.

https://patches.dpdk.org/project/dpdk/list/?series=31229
https://patches.dpdk.org/project/dpdk/list/?series=31230

Since the rc2 deadline is soon this series is being submitted now to solicit feedback. The CI is expected to fail without the above series being merged.

Quoted 9 lines

Tyler Retzlaff (2):
build: build eal library with MSVC
build: build ring library with MSVC

 config/meson.build           | 10 +++++++++-
 lib/eal/include/rte_common.h |  2 ++
 lib/meson.build              |  2 ++
 3 files changed, 13 insertions(+), 1 deletion(-)
#4 lore raw
In reply to Tyler Retzlaff
Quoted 6 lines · Tyler Retzlaff

Enable build of eal & ring library when building with MSVC.

This series depends on 2 other series that seem to be near being accepted for merge.

Quoted 7 lines

https://patches.dpdk.org/project/dpdk/list/?series=31229
https://patches.dpdk.org/project/dpdk/list/?series=31230

Since the rc2 deadline is soon this series is being submitted now to solicit feedback. The CI is expected to fail without the above series being merged.

Series applied, thanks Tyler.

Btw, I noticed a failure in UNH for MSVC, but it is not reported as such in patchwork.
https://lab.dpdk.org/results/dashboard/patchsets/29302/
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

Is there something to change in how UNH reports for the MSVC job?

Signature · 1 line
David Marchand
#5 lore raw
Quoted 17 lines · David Marchand
Quoted 6 lines · Tyler Retzlaff

Enable build of eal & ring library when building with MSVC.

This series depends on 2 other series that seem to be near being accepted for merge.

Quoted 7 lines

https://patches.dpdk.org/project/dpdk/list/?series=31229
https://patches.dpdk.org/project/dpdk/list/?series=31230

Since the rc2 deadline is soon this series is being submitted now to solicit feedback. The CI is expected to fail without the above series being merged.

Quoted 8 lines

Series applied, thanks Tyler.

Btw, I noticed a failure in UNH for MSVC, but it is not reported as such in patchwork.
https://lab.dpdk.org/results/dashboard/patchsets/29302/
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

Is there something to change in how UNH reports for the MSVC job?

Hi David,

There was a discussion about this on Slack in the infra-issues space. You can see the correct test report here:
https://inbox.dpdk.org/test-report/[email protected]/

Which at the time of the discussion was the latest update for the iol-compile-amd64-testing context sent to patchwork. So this appears to be an anomaly.

Quoted 5 lines

--
David Marchand