Re: [Libguestfs] [PATCH nbdkit 2/9] build: On Windows only, link all plugins and filters with -lnbdkit.

Eric Blake
2020-08-18T12:57:21Z

On 8/18/20 5:50 AM, Richard W.M. Jones wrote:
> ---

> +++ b/configure.ac
> @@ -457,11 +457,13 @@ AS_CASE([$host_os],
>       [mingw*|msys*|cygwin*], [
>           is_windows=yes
>           NO_UNDEFINED_ON_WINDOWS="-no-undefined"
> +
LINK_LIBNBDKIT_ON_WINDOWS='$(top_builddir)/server/libnbdkit.la'

Cygwin supports linking with undefined symbols, but it does add some
redirection overhead, so I don't see a problem in including Cygwin with
native windows for this case.  But we may need to later distinguish
between Cygwin and native windows for other parts of the porting efforts.

For now, I'm fine with this patch.

> +++ b/filters/ext2/Makefile.am
> @@ -53,8 +53,9 @@ nbdkit_ext2_filter_la_CFLAGS = \
>   	$(EXT2FS_CFLAGS) $(COM_ERR_CFLAGS) \
>   	$(NULL)
>   nbdkit_ext2_filter_la_LIBADD = \
> -	$(EXT2FS_LIBS) $(COM_ERR_LIBS) \
>   	$(top_builddir)/common/utils/libutils.la \
> +	$(LINK_LIBNBDKIT_ON_WINDOWS) \
> +	$(EXT2FS_LIBS) $(COM_ERR_LIBS) \

The reordering is a bit unrelated, but a nice cleanup.

> +++ b/plugins/curl/Makefile.am
> @@ -54,8 +54,9 @@ nbdkit_curl_plugin_la_CFLAGS = \
>   	$(CURL_CFLAGS) \
>   	$(NULL)
>   nbdkit_curl_plugin_la_LIBADD = \
> -	$(CURL_LIBS) \
>   	$(top_builddir)/common/utils/libutils.la \
> +	$(LINK_LIBNBDKIT_ON_WINDOWS) \
> +	$(CURL_LIBS) \

and another one.  I see a few more as well (guestfs, python, ssh, torrent)

> +++ b/plugins/tcl/Makefile.am
> @@ -52,10 +52,13 @@ nbdkit_tcl_plugin_la_CFLAGS = \
>   	$(WARNINGS_CFLAGS) \
>   	$(TCL_CFLAGS) \
>   	$(NULL)
> +nbdkit_tcl_plugin_la_LIBADD = \
> +	$(LINK_LIBNBDKIT_ON_WINDOWS) \
> +	$(TCL_LIBS) \
> +	$(NULL)
>   nbdkit_tcl_plugin_la_LDFLAGS = \
>   	-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
>   	-Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
> -	$(TCL_LIBS) \
>   	$(NULL)

And this one's a good fix (LIBADD affects a different part of the
command line than LDFLAGS).  Is it worth calling out these additional
cleanups as intentional as part of the commit message?

ACK

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org