On Tue, Mar 24, 2020 at 01:43:52PM -0500, Eric Blake wrote:> On 3/21/20 7:06 AM, Richard W.M. Jones wrote: > >Eric: > > > >Yifan Gu has posted a few patches for mingw support. My comments > >below. > > > >https://github.com/gyf304/nbdkit/commit/a37c4ca6546dfc4e96e305af97b62e5a9d6174ca > > > >* I think the SHARED_LDFLAGS idea is good. I pushed a slightly > > different take on the idea here: > > https://github.com/libguestfs/nbdkit/commit/1d634009ab8e43592065ec469df6312400525cc8 > > It's slightly different from what Yifan posted above, because I > > replaced -module -avoid-version -shared with $(SHARED_LDFLAGS), > > adding -no-undefined additionally on mingw. > > Why are we trying to avoid -no-undefined on other platforms?Isn't it because we rely on it, since our plugins need symbols that are undefined at link time such as nbdkit_*? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
On 3/24/20 1:54 PM, Richard W.M. Jones wrote:> On Tue, Mar 24, 2020 at 01:43:52PM -0500, Eric Blake wrote: >> On 3/21/20 7:06 AM, Richard W.M. Jones wrote: >>> Eric: >>> >>> Yifan Gu has posted a few patches for mingw support. My comments >>> below. >>> >>> https://github.com/gyf304/nbdkit/commit/a37c4ca6546dfc4e96e305af97b62e5a9d6174ca >>> >>> * I think the SHARED_LDFLAGS idea is good. I pushed a slightly >>> different take on the idea here: >>> https://github.com/libguestfs/nbdkit/commit/1d634009ab8e43592065ec469df6312400525cc8 >>> It's slightly different from what Yifan posted above, because I >>> replaced -module -avoid-version -shared with $(SHARED_LDFLAGS), >>> adding -no-undefined additionally on mingw. >> >> Why are we trying to avoid -no-undefined on other platforms? > > Isn't it because we rely on it, since our plugins need symbols that > are undefined at link time such as nbdkit_*?Yes, at the moment they do, but do they need to? We could ship libnbdkit which provides just the symbols that plugins can link against, and then link our binary nbdkit against that same library, rather than expecting our plugins to compile undefined until loaded by our binary. In other words, if the fix is by separating our public functions into a shared library for mingw to compile plugins without undefined symbols, why not do the same for all platforms? -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
I think that will break the ABI backward compatibility. On Tue, Mar 24, 2020 at 15:16 Eric Blake <eblake@redhat.com> wrote:> On 3/24/20 1:54 PM, Richard W.M. Jones wrote: > > On Tue, Mar 24, 2020 at 01:43:52PM -0500, Eric Blake wrote: > >> On 3/21/20 7:06 AM, Richard W.M. Jones wrote: > >>> Eric: > >>> > >>> Yifan Gu has posted a few patches for mingw support. My comments > >>> below. > >>> > >>> > https://github.com/gyf304/nbdkit/commit/a37c4ca6546dfc4e96e305af97b62e5a9d6174ca > >>> > >>> * I think the SHARED_LDFLAGS idea is good. I pushed a slightly > >>> different take on the idea here: > >>> > https://github.com/libguestfs/nbdkit/commit/1d634009ab8e43592065ec469df6312400525cc8 > >>> It's slightly different from what Yifan posted above, because I > >>> replaced -module -avoid-version -shared with $(SHARED_LDFLAGS), > >>> adding -no-undefined additionally on mingw. > >> > >> Why are we trying to avoid -no-undefined on other platforms? > > > > Isn't it because we rely on it, since our plugins need symbols that > > are undefined at link time such as nbdkit_*? > > Yes, at the moment they do, but do they need to? We could ship libnbdkit > which provides just the symbols that plugins can link against, and then > link our binary nbdkit against that same library, rather than expecting > our plugins to compile undefined until loaded by our binary. In other > words, if the fix is by separating our public functions into a shared > library for mingw to compile plugins without undefined symbols, why not > do the same for all platforms? > > -- > Eric Blake, Principal Software Engineer > Red Hat, Inc. +1-919-301-3226 > Virtualization: qemu.org | libvirt.org > >
On Tue, Mar 24, 2020 at 02:16:32PM -0500, Eric Blake wrote:> On 3/24/20 1:54 PM, Richard W.M. Jones wrote: > >On Tue, Mar 24, 2020 at 01:43:52PM -0500, Eric Blake wrote: > >>On 3/21/20 7:06 AM, Richard W.M. Jones wrote: > >>>Eric: > >>> > >>>Yifan Gu has posted a few patches for mingw support. My comments > >>>below. > >>> > >>>https://github.com/gyf304/nbdkit/commit/a37c4ca6546dfc4e96e305af97b62e5a9d6174ca > >>> > >>>* I think the SHARED_LDFLAGS idea is good. I pushed a slightly > >>> different take on the idea here: > >>> https://github.com/libguestfs/nbdkit/commit/1d634009ab8e43592065ec469df6312400525cc8 > >>> It's slightly different from what Yifan posted above, because I > >>> replaced -module -avoid-version -shared with $(SHARED_LDFLAGS), > >>> adding -no-undefined additionally on mingw. > >> > >>Why are we trying to avoid -no-undefined on other platforms? > > > >Isn't it because we rely on it, since our plugins need symbols that > >are undefined at link time such as nbdkit_*? > > Yes, at the moment they do, but do they need to? We could ship > libnbdkit which provides just the symbols that plugins can link > against, and then link our binary nbdkit against that same library, > rather than expecting our plugins to compile undefined until loaded > by our binary. In other words, if the fix is by separating our > public functions into a shared library for mingw to compile plugins > without undefined symbols, why not do the same for all platforms?(For non-mingw platforms) this breaks the source API promises rather seriously, so if I understand your proposal correctly I don't think this is a good idea. It's possibly something we can consider for internal plugins, or for the V3 API. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org