Open PlushBeaver opened 3 years ago
Example file:
prefix="C:/Program Files/Npcap"
Name: libpcap
Version: 1.10
Description: Platform-independent network traffic capture library
Cflags: -I${prefix}/Include
Libs: -L${prefix}/Lib/x64 -lwpcap
Or, if it's feasible to change installation layout, this way $prefix
could be calculated automatically:
C:/Program Files/Npcap/
Include/
x64/
Lib/
wpcap.lib
pkgconfig/
libpcap.pc
x86/
(ditto)
Probably 32-bit and 64-bit folder should have their own .pc files, so that they are selected by PKG_CONFIG_PATH.
So is there a convention used on UN*Xes to deal with cross-building (which includes building for 32-bit on 64-bit and building for 64-bit on 32-bit)? If so, the same convention should probably be used on Windows (there's nothing inherently special about Npcap here; that would apply to all libraries).
On Unices binaries are installed to prefixes like /lib/i686-linux-gnu
or /lib/x86_64-linux-gnu
and so do *.pc
files. Pkg-config searches packages by filename without .pc
in PKG_CONFIG_PATH
, which contains paths under appropriate prefix. So Npcap only has to place libpcap.pc
(this exact name) in different folders for x86 and x64.
Bump. Is there a decision if Npcap will integrate pkg-config support? If it will, shall directory layout be changed? How can I help besides providing libpcap.pc above?
Thanks for the suggestion. So far we haven't received many requests for this, but this issue is a good place for people to comment if they are interested in pkg-config support for Npcap and why. Npcap OEM customers can also request it through their support channel and we will tally those requests as well. Also, does upstream libpcap support this?
Upstream libpcap supports pkg-config from 1.9.0. My use case is Npcap being an optional dependency of DPDK on Windows. DPDK uses pkg-config as the primary dependency locator on all platforms.
Also, does upstream libpcap support this?
"This" meaning what?
Both autotools and CMake builds of libpcap will, if you do make install
with autotools or whatever builds the install
target with CMake, install a libpcap.pc
file.
For an autotools file, it will be installed in $(DESTDIR)$(libdir)/pkgconfig/libpcap.pc
; that would only install under lib/i686-linux-gnu
or /lib/x86_64-linux-gnu
if DESTDIR
and libdir
are set appropriately when ./configure
is run; it doesn't, as far as I know, do so automatically. Note that
On Unices binaries are installed to prefixes like
/lib/i686-linux-gnu
or/lib/x86_64-linux-gnu and
so do*.pc
files.
may be true of some UN*Xes but not all. On multi-architecture systems:
.pc
files for separate target architectures./usr/lib
for 32-bit libraries and /usr/lib/{sparcv9,amd64}
for 64-bit libraries, and has pkgconfig
directories under both of them for .pc
files./usr/lib
for 64-bit libraries and /usr/lib32
for 32-bit libraries; it doesn't (yet?) natively provide pkg-config, but if it ever does (which would probably happen by picking up OpenBSD's non-GPL reimplementation), they'd probably have pkgconfig
under those directories. I don't know what the other BSDs do.So the answer to "So is there a convention used on UNXes to deal with cross-building (which includes building for 32-bit on 64-bit and building for 64-bit on 32-bit)?" appears to be "No, there isn't a convention, there are several of them, and which one is used depends on the UN\X you're using."
This means that Npcap isn't constrained by what various UN*Xes have done. It should do whatever works best in Windows build environments.
The current installation layout for the SDK is
C:/{wherever you install it}/
Include/
Lib/
Packet.lib
wpcap.lib
x64/
Packet.lib
wpcap.lib
I don't know what issues modifying the installation layout to the proposed layout would cause for existing projects.
(Update: on Windows, pkg-config can detect prefix if file is placed inside ${prefix}/lib/pkgconfig.)
So where is the Windows pkg-config port, including the documentation where that's mentioned?
may be true of some UN*Xes but not all.
Thanks a lot for enlightening, I stand corrected.
(Update: on Windows, pkg-config can detect prefix if file is placed inside ${prefix}/lib/pkgconfig.)
So where is the Windows pkg-config port, including the documentation where that's mentioned?
It's not a port, pkg-config upstream supports Windows. Official binaries are here:
Documentation for the mentioned feature: https://gitlab.freedesktop.org/pkg-config/pkg-config/-/blob/master/README.win32#L17
pkg-config tool can work on Windows and libpcap upstream has
libpcap.pc
. Can npcap SDK provide this file on Windows? It would eliminatelibpcap.a
/wpcap.lib
difference for cross-platform projects that use pkg-config, e.g. via meson build system.Probably 32-bit and 64-bit folder should have their own .pc files, so that they are selected by
PKG_CONFIG_PATH
. Prefix path can be set to some recommended location to install SDK, likeC:\Program Files\Npcap
. (Update: on Windows, pkg-config can detect prefix if file is placed inside${prefix}/lib/pkgconfig
.)