DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] build: propagate Windows system dependencies to pkg-config
@ 2021-08-19 23:14 Dmitry Kozlyuk
  2021-08-20 16:08 ` William Tu
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Kozlyuk @ 2021-08-19 23:14 UTC (permalink / raw)
  To: dev
  Cc: Dmitry Kozlyuk, talshn, stable, William Tu, Bruce Richardson,
	Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam,
	Tal Shnaiderman

Windows EAL depends on some system libraries. They were linked using
add_project_link_arguments('-l<LIB>'), which prevented meson from adding
them to Libs.private of pkg-config file. As a result, applications using
pkg-config to find DPDK hit link errors, for example:

    librte_eal.a(eal_windows_eal_debug.c.obj) : error LNK2019: unresolved
    external symbol __imp_SymInitialize referenced in function
    rte_dump_stack

Reference required libraries in EAL using ext_deps meson variable.
bus/pci and net/pcap depend on lib/eal and will pull them automatically.
Drop advapi32 dependency, as MinGW locates VirtualAlloc2() dynamically.

Fixes: 2a5d547a4a9b ("eal/windows: implement basic memory management")
Fixes: c91717eb75c8 ("eal/windows: support exit and panic")
Cc: talshn@nvidia.com
Cc: stable@dpdk.org

Reported-by: William Tu <u9012063@gmail.com>
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 config/meson.build          | 14 ++------------
 lib/eal/windows/meson.build | 10 ++++++++++
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index e80421003b..3d5e1e33e7 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -339,7 +339,8 @@ if is_freebsd
 endif
 
 if is_windows
-    # VirtualAlloc2() is available since Windows 10 / Server 2016.
+    # VirtualAlloc2() is available since Windows 10 / Server 2019.
+    # It's essential for EAL, so we don't support older versions.
     add_project_arguments('-D_WIN32_WINNT=0x0A00', language: 'c')
 
     # Use MinGW-w64 stdio, because DPDK assumes ANSI-compliant formatting.
@@ -351,17 +352,6 @@ if is_windows
     if cc.get_id() == 'clang'
         add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: 'c')
     endif
-
-    add_project_link_arguments('-lws2_32', language: 'c')
-
-    # Contrary to docs, VirtualAlloc2() is exported by mincore.lib
-    # in Windows SDK, while MinGW exports it by advapi32.a.
-    if is_ms_linker
-        add_project_link_arguments('-lmincore', language: 'c')
-    endif
-
-    add_project_link_arguments('-ladvapi32', '-lsetupapi', language: 'c')
-    add_project_link_arguments('-ldbghelp', language: 'c')
 endif
 
 if get_option('b_lto')
diff --git a/lib/eal/windows/meson.build b/lib/eal/windows/meson.build
index fc12fefd0d..845e406ca1 100644
--- a/lib/eal/windows/meson.build
+++ b/lib/eal/windows/meson.build
@@ -24,3 +24,13 @@ sources += files(
 )
 
 dpdk_conf.set10('RTE_EAL_NUMA_AWARE_HUGEPAGES', true)
+
+ext_deps += [
+        cc.find_library('dbghelp'),
+        cc.find_library('setupapi'),
+        cc.find_library('ws2_32'),
+]
+if is_ms_linker
+        # Contrary to docs, VirtualAlloc2() is exported by mincore.lib.
+        ext_deps += cc.find_library('mincore')
+endif
-- 
2.29.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] build: propagate Windows system dependencies to pkg-config
  2021-08-19 23:14 [dpdk-dev] [PATCH] build: propagate Windows system dependencies to pkg-config Dmitry Kozlyuk
@ 2021-08-20 16:08 ` William Tu
  2021-09-14 13:59   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: William Tu @ 2021-08-20 16:08 UTC (permalink / raw)
  To: Dmitry Kozlyuk
  Cc: dpdk-dev, Tal Shnaiderman, stable, Bruce Richardson,
	Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam,
	Tal Shnaiderman

On Thu, Aug 19, 2021 at 4:15 PM Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> wrote:
>
> Windows EAL depends on some system libraries. They were linked using
> add_project_link_arguments('-l<LIB>'), which prevented meson from adding
> them to Libs.private of pkg-config file. As a result, applications using
> pkg-config to find DPDK hit link errors, for example:
>
>     librte_eal.a(eal_windows_eal_debug.c.obj) : error LNK2019: unresolved
>     external symbol __imp_SymInitialize referenced in function
>     rte_dump_stack
>
> Reference required libraries in EAL using ext_deps meson variable.
> bus/pci and net/pcap depend on lib/eal and will pull them automatically.
> Drop advapi32 dependency, as MinGW locates VirtualAlloc2() dynamically.
>
> Fixes: 2a5d547a4a9b ("eal/windows: implement basic memory management")
> Fixes: c91717eb75c8 ("eal/windows: support exit and panic")
> Cc: talshn@nvidia.com
> Cc: stable@dpdk.org
>
> Reported-by: William Tu <u9012063@gmail.com>
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> ---

Thanks for the fix.
I've tested on my Windows environment and it works ok.
the libdpdk.pc shows the required libraries.

Acked-by: William Tu <u9012063@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] build: propagate Windows system dependencies to pkg-config
  2021-08-20 16:08 ` William Tu
@ 2021-09-14 13:59   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2021-09-14 13:59 UTC (permalink / raw)
  To: Dmitry Kozlyuk
  Cc: dev, Tal Shnaiderman, stable, Bruce Richardson,
	Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam,
	Tal Shnaiderman, William Tu

20/08/2021 18:08, William Tu:
> On Thu, Aug 19, 2021 at 4:15 PM Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> wrote:
> >
> > Windows EAL depends on some system libraries. They were linked using
> > add_project_link_arguments('-l<LIB>'), which prevented meson from adding
> > them to Libs.private of pkg-config file. As a result, applications using
> > pkg-config to find DPDK hit link errors, for example:
> >
> >     librte_eal.a(eal_windows_eal_debug.c.obj) : error LNK2019: unresolved
> >     external symbol __imp_SymInitialize referenced in function
> >     rte_dump_stack
> >
> > Reference required libraries in EAL using ext_deps meson variable.
> > bus/pci and net/pcap depend on lib/eal and will pull them automatically.
> > Drop advapi32 dependency, as MinGW locates VirtualAlloc2() dynamically.
> >
> > Fixes: 2a5d547a4a9b ("eal/windows: implement basic memory management")
> > Fixes: c91717eb75c8 ("eal/windows: support exit and panic")
> > Cc: talshn@nvidia.com
> > Cc: stable@dpdk.org
> >
> > Reported-by: William Tu <u9012063@gmail.com>
> > Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> > ---
> 
> Thanks for the fix.
> I've tested on my Windows environment and it works ok.
> the libdpdk.pc shows the required libraries.
> 
> Acked-by: William Tu <u9012063@gmail.com>

Converted to Tested-by.

Applied, thanks



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-14 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 23:14 [dpdk-dev] [PATCH] build: propagate Windows system dependencies to pkg-config Dmitry Kozlyuk
2021-08-20 16:08 ` William Tu
2021-09-14 13:59   ` Thomas Monjalon

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).