[v2,5/6] config: discover libpcap on Windows
Checks
Commit Message
WinPcap or Npcap, can be installed anywhere.
Add a Meson option to specify SDK path.
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
config/meson.build | 21 ++++++++++++++++++---
meson_options.txt | 6 ++++--
2 files changed, 22 insertions(+), 5 deletions(-)
Comments
On 2/14/2021 2:16 AM, Dmitry Kozlyuk wrote:
> WinPcap or Npcap, can be installed anywhere.
> Add a Meson option to specify SDK path.
>
I am not sure if it is OK to add a meson option for this, can't we use the
default path?
And does this mean we will need to add an option for each dependent library in
Windows? If not, why pcap is special?
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
<...>
2021-02-25 15:02, Ferruh Yigit:
> On 2/14/2021 2:16 AM, Dmitry Kozlyuk wrote:
> > WinPcap or Npcap, can be installed anywhere.
> > Add a Meson option to specify SDK path.
> >
>
> I am not sure if it is OK to add a meson option for this, can't we use the
> default path?
>
> And does this mean we will need to add an option for each dependent library in
> Windows? If not, why pcap is special?
There are some meson options for SDK paths already. Are they exceptions?
IMO, explicit specification is better because it allows switching
dependency versions and library distributions.
I understand that consensus it to keep build matrix size at minimum, but
options to specify SDK path don't change the number of variants what can be
found.
On Thu, Feb 25, 2021 at 07:04:38PM +0300, Dmitry Kozlyuk wrote:
> 2021-02-25 15:02, Ferruh Yigit:
> > On 2/14/2021 2:16 AM, Dmitry Kozlyuk wrote:
> > > WinPcap or Npcap, can be installed anywhere.
> > > Add a Meson option to specify SDK path.
> > >
> >
> > I am not sure if it is OK to add a meson option for this, can't we use the
> > default path?
> >
> > And does this mean we will need to add an option for each dependent library in
> > Windows? If not, why pcap is special?
>
> There are some meson options for SDK paths already. Are they exceptions?
>
Right now, yes, they are exceptions, but there is work underway to remove
them and just replace them with use of pkg-config. Is there some automatic
path discovery mechanism on windows, similar to pkg-config, that can be
used rather than having to add explicit dependency paths?
/bruce
2021-02-25 16:33, Bruce Richardson:
> On Thu, Feb 25, 2021 at 07:04:38PM +0300, Dmitry Kozlyuk wrote:
> > 2021-02-25 15:02, Ferruh Yigit:
> > > On 2/14/2021 2:16 AM, Dmitry Kozlyuk wrote:
> > > > WinPcap or Npcap, can be installed anywhere.
> > > > Add a Meson option to specify SDK path.
> > > >
> > >
> > > I am not sure if it is OK to add a meson option for this, can't we use the
> > > default path?
> > >
> > > And does this mean we will need to add an option for each dependent library in
> > > Windows? If not, why pcap is special?
> >
> > There are some meson options for SDK paths already. Are they exceptions?
> >
> Right now, yes, they are exceptions, but there is work underway to remove
> them and just replace them with use of pkg-config. Is there some automatic
> path discovery mechanism on windows, similar to pkg-config, that can be
> used rather than having to add explicit dependency paths?
pkg-config itself works on Windows if installed and given a PKG_CONFIG_PATH.
Npcap doesn't provide a .pc file, despite libpcap commit 4f6b2b99 having it.
Another quirk is that library is named libpcap.a/wpcap.lib on Unix/Windows.
I can just handle the name difference and assume it's in the search path.
25/02/2021 18:42, Dmitry Kozlyuk:
> 2021-02-25 16:33, Bruce Richardson:
> > On Thu, Feb 25, 2021 at 07:04:38PM +0300, Dmitry Kozlyuk wrote:
> > > 2021-02-25 15:02, Ferruh Yigit:
> > > > On 2/14/2021 2:16 AM, Dmitry Kozlyuk wrote:
> > > > > WinPcap or Npcap, can be installed anywhere.
> > > > > Add a Meson option to specify SDK path.
> > > > >
> > > >
> > > > I am not sure if it is OK to add a meson option for this, can't we use the
> > > > default path?
> > > >
> > > > And does this mean we will need to add an option for each dependent library in
> > > > Windows? If not, why pcap is special?
> > >
> > > There are some meson options for SDK paths already. Are they exceptions?
> > >
> > Right now, yes, they are exceptions, but there is work underway to remove
> > them and just replace them with use of pkg-config. Is there some automatic
> > path discovery mechanism on windows, similar to pkg-config, that can be
> > used rather than having to add explicit dependency paths?
>
> pkg-config itself works on Windows if installed and given a PKG_CONFIG_PATH.
>
> Npcap doesn't provide a .pc file, despite libpcap commit 4f6b2b99 having it.
Please work with them to provide a .pc.
> Another quirk is that library is named libpcap.a/wpcap.lib on Unix/Windows.
> I can just handle the name difference and assume it's in the search path.
Yes please avoid adding a meson option for a path.
2021-03-16 10:16 (UTC+0100), Thomas Monjalon:
> 25/02/2021 18:42, Dmitry Kozlyuk:
> > 2021-02-25 16:33, Bruce Richardson:
> > > On Thu, Feb 25, 2021 at 07:04:38PM +0300, Dmitry Kozlyuk wrote:
> > > > 2021-02-25 15:02, Ferruh Yigit:
> > > > > On 2/14/2021 2:16 AM, Dmitry Kozlyuk wrote:
[...]
> > pkg-config itself works on Windows if installed and given a PKG_CONFIG_PATH.
> >
> > Npcap doesn't provide a .pc file, despite libpcap commit 4f6b2b99 having it.
>
> Please work with them to provide a .pc.
Good idea, but I can't tell how soon they do'll it.
> > Another quirk is that library is named libpcap.a/wpcap.lib on Unix/Windows.
> > I can just handle the name difference and assume it's in the search path.
>
> Yes please avoid adding a meson option for a path.
I have v3 that relies on search paths only with just a library name fixup.
It's blocked by [2] and, transitively, by [1].
[1]: http://patchwork.dpdk.org/project/dpdk/list/?series=15513
[1]: http://patchwork.dpdk.org/project/dpdk/list/?series=15640
@@ -178,9 +178,24 @@ if not pcap_dep.found()
# pcap got a pkg-config file only in 1.9.0
pcap_dep = cc.find_library('pcap', required: false)
endif
-if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
- dpdk_conf.set('RTE_PORT_PCAP', 1)
- dpdk_extra_ldflags += '-lpcap'
+if is_windows
+ # npcap SDK can be installed anywhere
+ pcap_sdk = get_option('pcap_sdk')
+ if pcap_sdk != ''
+ pcap_ldflags = ['-L@0@/Lib/x64'.format(pcap_sdk), '-lwpcap']
+ pcap_dep = declare_dependency(
+ compile_args: ['-I@0@/Include'.format(pcap_sdk)],
+ link_args: pcap_ldflags)
+ endif
+ if pcap_dep.found()
+ dpdk_conf.set('RTE_PORT_PCAP', 1)
+ dpdk_extra_ldflags += pcap_ldflags
+ endif
+else
+ if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
+ dpdk_conf.set('RTE_PORT_PCAP', 1)
+ dpdk_extra_ldflags += '-lpcap'
+ endif
endif
# for clang 32-bit compiles we need libatomic for 64-bit atomic ops
@@ -10,6 +10,8 @@ option('enable_docs', type: 'boolean', value: false,
description: 'build documentation')
option('enable_kmods', type: 'boolean', value: false,
description: 'build kernel modules')
+option('enable_trace_fp', type: 'boolean', value: false,
+ description: 'enable fast path trace points.')
option('examples', type: 'string', value: '',
description: 'Comma-separated list of examples to build by default')
option('flexran_sdk', type: 'string', value: '',
@@ -28,8 +30,8 @@ option('max_lcores', type: 'integer', value: 128,
description: 'maximum number of cores/threads supported by EAL')
option('max_numa_nodes', type: 'integer', value: 32,
description: 'maximum number of NUMA nodes supported by EAL')
-option('enable_trace_fp', type: 'boolean', value: false,
- description: 'enable fast path trace points.')
+option('pcap_sdk', type: 'string', value: '',
+ description: 'Path to libpcap SDK used on Windows')
option('tests', type: 'boolean', value: true,
description: 'build unit tests')
option('use_hpet', type: 'boolean', value: false,