[Libguestfs] [PATCH nbdkit v3 2/2] golang: Compile against the local nbdkit build, not installed.

Eric Blake eblake at redhat.com
Thu Apr 23 19:57:45 UTC 2020


On 4/23/20 2:50 PM, Eric Blake wrote:

>> PKG_CONFIG_PATH="$(abs_builddir)/server/local$${PKG_CONFIG_PATH:-:$$PKG_CONFIG_PATH}" 
>> \
> 
> Ooops, I typod this one.
> 
> unset foo
> bar=
> blah=set
> echo "pre${foo:-:$foo}"
> echo "pre${bar:-:$bar}"
> echo "pre${bar:-:$blah}"
> 
> shows that :- was the wrong operator.  Better is :+.
> 
> All four sites need it.
> 
> But even then, I'm still getting build failures; and make V=1 shows that 
> PKG_CONFIG_PATH is getting set correctly :(

Okay, I found the problem.  $(abs_builddir) is not the same as 
$(abs_top_builddir).

With this incremental on top of your patch, things start working for me:

diff --git i/plugins/golang/Makefile.am w/plugins/golang/Makefile.am
index 10ccea18..74ad4a72 100644
--- i/plugins/golang/Makefile.am
+++ w/plugins/golang/Makefile.am
@@ -66,21 +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$${PKG_CONFIG_PATH:-:$$PKG_CONFIG_PATH}" 
\
+ 
PKG_CONFIG_PATH="$(abs_top_builddir)/server/local$${PKG_CONFIG_PATH:+:$$PKG_CONFIG_PATH}" 
\
  	GOPATH="$(abs_builddir)" \
  	$(GOLANG) build -o nbdkit-godump-plugin.so -buildmode=c-shared

  examples/minimal/nbdkit-gominimal-plugin.so: \
  	    $(plugin_sources) examples/minimal/minimal.go
  	cd examples/minimal && \
- 
PKG_CONFIG_PATH="$(abs_builddir)/server/local$${PKG_CONFIG_PATH:-:$$PKG_CONFIG_PATH}" 
\
+ 
PKG_CONFIG_PATH="$(abs_top_builddir)/server/local$${PKG_CONFIG_PATH:+:$$PKG_CONFIG_PATH}" 
\
  	GOPATH="$(abs_builddir)" \
  	$(GOLANG) build -o nbdkit-gominimal-plugin.so -buildmode=c-shared

  examples/ramdisk/nbdkit-goramdisk-plugin.so: \
  	    $(plugin_sources) examples/ramdisk/ramdisk.go
  	cd examples/ramdisk && \
- 
PKG_CONFIG_PATH="$(abs_builddir)/server/local$${PKG_CONFIG_PATH:-:$$PKG_CONFIG_PATH}" 
\
+ 
PKG_CONFIG_PATH="$(abs_top_builddir)/server/local$${PKG_CONFIG_PATH:+:$$PKG_CONFIG_PATH}" 
\
  	GOPATH="$(abs_builddir)" \
  	$(GOLANG) build -o nbdkit-goramdisk-plugin.so -buildmode=c-shared

@@ -90,7 +90,7 @@ check_DATA = test/nbdkit-gotest-plugin.so

  test/nbdkit-gotest-plugin.so: $(plugin_sources) test/test.go
  	cd test && \
- 
PKG_CONFIG_PATH="$(abs_builddir)/server/local$${PKG_CONFIG_PATH:-:$$PKG_CONFIG_PATH}" 
\
+ 
PKG_CONFIG_PATH="$(abs_top_builddir)/server/local$${PKG_CONFIG_PATH:+:$$PKG_CONFIG_PATH}" 
\
  	GOPATH="$(abs_builddir)" \
  	$(GOLANG) build -o nbdkit-gotest-plugin.so -buildmode=c-shared



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




More information about the Libguestfs mailing list