On 4/23/20 1:04 PM, Richard W.M. Jones wrote:
When compiling when an older nbdkit is installed, the build would fail
because certain symbols such as .get_ready were not defined:

   ../../src/libguestfs.org/nbdkit/nbdkit.go:541:8: plugin.get_ready undefined 
(type _Ctype_struct_nbdkit_plugin has no field or method get_ready)

This happens because we were using the installed <nbdkit-plugin.h>
rather than the local copy.

We don't want to modify the *.go files themselves as they might be
copied into other projects.  Instead we can set PKG_CONFIG_PATH to
point to the local nbdkit.pc which will return the correct CFLAGS.

Fixes: commit 1ff44288ae1cf95428283e252edd9474c3fe3b55
Thanks: Dan Berrangé, Eric Blake
---
  plugins/golang/Makefile.am | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/plugins/golang/Makefile.am b/plugins/golang/Makefile.am
index f189184c..d8d19b7a 100644
--- a/plugins/golang/Makefile.am
+++ b/plugins/golang/Makefile.am
@@ -66,18 +66,21 @@ noinst_DATA = \
  examples/dump-plugin/nbdkit-godump-plugin.so: \
            $(plugin_sources) examples/dump-plugin/dumpplugin.go
        cd examples/dump-plugin && \
+       PKG_CONFIG_PATH="$(abs_builddir)/server/local" \

Shouldn't this be more like:

PKG_CONFIG_PATH="$(abs_builddir)/server/local$${PKG_CONFIG_PATH:-:$$PKG_CONFIG_PATH}"

so as to preserve any inherited override locations for other .pc files that might also be needed by cgo?

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

_______________________________________________
Libguestfs mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to