<div dir="ltr">I finally have it working! I should have thought of using yumdownloader myself - thanks for that. The other missing piece was needing a supermin appliance binary (guestfs seemed to be trying to use /usr/bin/supermin5 which isn't present for me, and I couldn't work out how to get it to use $PWD/usr/bin/supermin5).<div><br></div><div>Full steps I ended up using:</div><div><br></div><div>yumdownloader --resolve libguestfs libguestfs-tools-c</div><div>for rpm in *.rpm; do</div><div>    rpm2cpio "$rpm" | cpio -idmv</div><div>done</div><div>curl <a href="https://download.libguestfs.org/binaries/appliance/appliance-1.40.1.tar.xz">https://download.libguestfs.org/binaries/appliance/appliance-1.40.1.tar.xz</a> -OL</div><div>tar -xf 

appliance-1.40.1.tar.xz

</div><div>LIBGUESTFS_PATH="$PWD/appliance" LD_LIBRARY_PATH="$PWD/usr/lib64" ./usr/bin/virt-cat -a centos7.qcow2 /root/.bashrc<br></div><div><br></div><div>>> Take a look at m4/guestfs-libraries.m4 and change the AC_CHECK_LIB to PKG_CHECK_MODULES, following examples of other package tests in that file</div><div>> Do you have a patch for this one?</div><div><br></div><div>I've created <a href="https://github.com/libguestfs/libguestfs/pull/66">https://github.com/libguestfs/libguestfs/pull/66</a> with some discussion on the two cases - feel free to edit/decline as you see fit.</div><div><br></div><div>Thanks,</div><div>Lewis</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 2 May 2021 at 14:49, Richard W.M. Jones <<a href="mailto:rjones@redhat.com">rjones@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sun, May 02, 2021 at 02:23:55PM +0100, Lewis Gaul wrote:<br>
> Thanks, once again that seems to have got me past that problem,<br>
<br>
Do you have a patch for this one?<br>
<br>
> only<br>
> for a new one to crop up (this time hivex, which I'm not sure how to<br>
> build or why it's required on Linux). I take it this isn't really an<br>
> expected workflow, trying to get the package to build without being<br>
> able to use a package manager to install the dependencies?<br>
<br>
Hivex is needed to inspect and edit Windows registries, and is a<br>
required dependency nowadays.  It's also only a small C library and is<br>
available in most distros.<br>
<br>
> Searching the output from ./configure, I can't yet see any mention<br>
> of quite a few of the other dependencies listed<br>
> at <a href="https://libguestfs.org/" rel="noreferrer" target="_blank">https://libguestfs.org/</a> guestfs-building.1.html that may be<br>
> problematic, so I'm wondering if it's time to throw in the towel for<br>
> this approach.<br>
><br>
> All I'm looking for really is a way to programmatically edit a<br>
> single file in a qcow2 VM image (which I planned to achieve with<br>
> virt-edit) - is there an easier way to do this? Does virt-edit alone<br>
> require all these dependencies, or would there be a way to build<br>
> just virt-edit without pulling apart the build system?<br>
<br>
> Alternatively, would it be possible/easier to build a static virt-edit binary<br>
> in a CentOS 7 VM that could simply be copied onto this RHEL 7 machine?<br>
> <br>
> I appreciate your help so far and any further suggestions you might have!<br>
<br>
RHEL 7 has libguestfs already.  You don't have root access, but it<br>
should be possible to download what you need as RPMs, unpack them, and<br>
run libguestfs from your home directory.  Something like this:<br>
<br>
$ yumdownloader libguestfs<br>
...<br>
libguestfs-1.40.2-5.el7.x86_64.rpm                         | 2.4 MB   00:01<br>
<br>
$ yumdownloader libguestfs-tools-c<br>
<br>
$ rpm2cpio libguestfs-1.40.2-5.el7.x86_64.rpm | cpio -id<br>
$ rpm2cpio libguestfs-tools-c-1.40.2-5.el7.x86_64.rpm | cpio -id<br>
<br>
$ cd usr/bin/<br>
$ LIBGUESTFS_PATH=$PWD/../lib64/guestfs LD_LIBRARY_PATH=../lib64 ./libguestfs-test-tool <br>
<br>
You might also need to download other dependencies as RPMs and unpack<br>
those in the same way (supermin, hivex, etc)<br>
<br>
Or ask for root to install the package(!)<br>
<br>
Rich.<br>
<br>
-- <br>
Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/~rjones" rel="noreferrer" target="_blank">http://people.redhat.com/~rjones</a><br>
Read my programming and virtualization blog: <a href="http://rwmj.wordpress.com" rel="noreferrer" target="_blank">http://rwmj.wordpress.com</a><br>
Fedora Windows cross-compiler. Compile Windows programs, test, and<br>
build Windows installers. Over 100 libraries supported.<br>
<a href="http://fedoraproject.org/wiki/MinGW" rel="noreferrer" target="_blank">http://fedoraproject.org/wiki/MinGW</a><br>
<br>
</blockquote></div>