Building from source with custom gperf location
Hello, I'm trying to build/install libguestfs (for virt-edit) on a RHEL7 server, where I have no root access. I couldn't find any pre-built binaries online, so have been trying to build from source (downloaded from https://download.libguestfs.org/). I'm using the latest stable version, 1.44.1. I have followed the instructions at https://libguestfs.org/guestfs-building.1.html, but './configure' is failing with: checking for gperf... no configure: error: gperf must be installed Indeed, it seems gperf is not installed. I then built gperf from source and symlinked the binary to '~/bin/gperf', which is on my PATH. The problem is that I can't work out how to get libguestfs's ./configure script to pick up this manually-compiled copy of gperf (which I don't have permissions to place in a standard location under /usr/). Can anyone suggest a solution/workaround? (There may be a similar problem for some of the other external dependencies that are checked after gperf - I couldn't see a way to get configure to continue on failure or equivalent). Thanks in advance, Lewis
On Sat, May 01, 2021 at 02:26:37PM +0100, Lewis Gaul wrote:
Hello,
I'm trying to build/install libguestfs (for virt-edit) on a RHEL7 server, where I have no root access. I couldn't find any pre-built binaries online, so have been trying to build from source (downloaded from https:// download.libguestfs.org/). I'm using the latest stable version, 1.44.1.
I have followed the instructions at https://libguestfs.org/ guestfs-building.1.html, but './configure' is failing with: checking for gperf... no configure: error: gperf must be installed
Indeed, it seems gperf is not installed. I then built gperf from source and symlinked the binary to '~/bin/gperf', which is on my PATH.
The problem is that I can't work out how to get libguestfs's ./configure script to pick up this manually-compiled copy of gperf (which I don't have permissions to place in a standard location under /usr/).
Can anyone suggest a solution/workaround?
I think you should be able to do: ./configure GPERF=$HOME/bin/gperf If not then try fiddling around with m4/guestfs-progs.m4 to see if you can come up with a workable patch. Rich.
(There may be a similar problem for some of the other external dependencies that are checked after gperf - I couldn't see a way to get configure to continue on failure or equivalent).
Thanks in advance, Lewis
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Thanks Rich, that worked. I also had to compile augeas and specify 'AUGEAS_LIBS=~/.local/lib AUGEAS_CFLAGS="-O3"' for it to be picked up. The problem I'm hitting now is: configure: error: libmagic (part of the "file" command) is required. Please install the file devel package I have manually installed the contents of the file-devel RPM and its dependency file-libs into ~/.local/, so I now have libmagic.so under ~/.local/lib64/. Any idea how I can get ./configure to pick this up? I tried LD_LIBRARY_PATH=~/.local/lib64 but this didn't seem to work. I'm hopeful this might be the last piece that's missing! Thanks for your help, Lewis On Sat, 1 May 2021 at 17:07, Richard W.M. Jones <rjones@redhat.com> wrote:
Hello,
I'm trying to build/install libguestfs (for virt-edit) on a RHEL7 server, where I have no root access. I couldn't find any pre-built binaries online, so have been trying to build from source (downloaded from https:// download.libguestfs.org/). I'm using the latest stable version, 1.44.1.
I have followed the instructions at https://libguestfs.org/ guestfs-building.1.html, but './configure' is failing with: checking for gperf... no configure: error: gperf must be installed
Indeed, it seems gperf is not installed. I then built gperf from source and symlinked the binary to '~/bin/gperf', which is on my PATH.
The problem is that I can't work out how to get libguestfs's ./configure
to pick up this manually-compiled copy of gperf (which I don't have
On Sat, May 01, 2021 at 02:26:37PM +0100, Lewis Gaul wrote: script permissions
to place in a standard location under /usr/).
Can anyone suggest a solution/workaround?
I think you should be able to do:
./configure GPERF=$HOME/bin/gperf
If not then try fiddling around with m4/guestfs-progs.m4 to see if you can come up with a workable patch.
Rich.
(There may be a similar problem for some of the other external dependencies that are checked after gperf - I couldn't see a way to get configure to continue on failure or equivalent).
Thanks in advance, Lewis
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
On Sat, May 01, 2021 at 06:04:44PM +0100, Lewis Gaul wrote:
Thanks Rich, that worked.
I also had to compile augeas and specify 'AUGEAS_LIBS=~/.local/lib AUGEAS_CFLAGS="-O3"' for it to be picked up.
The problem I'm hitting now is: configure: error: libmagic (part of the "file" command) is required. Please install the file devel package
I have manually installed the contents of the file-devel RPM and its dependency file-libs into ~/.local/, so I now have libmagic.so under ~/.local/lib64/. Any idea how I can get ./configure to pick this up? I tried LD_LIBRARY_PATH=~ /.local/lib64 but this didn't seem to work.
I think maybe LIBRARY_PATH (not LD_*) might work. Unfortunately m4/guestfs-libraries.m4 is using AC_CHECK_LIB instead of PKG_CHECK_MODULES, so you cannot just set PKG_CONFIG_* environment variables to pick up the right libmagic.pc (which is a bug in libguestfs). Rich.
I'm hopeful this might be the last piece that's missing!
Thanks for your help, Lewis
On Sat, 1 May 2021 at 17:07, Richard W.M. Jones <rjones@redhat.com> wrote:
On Sat, May 01, 2021 at 02:26:37PM +0100, Lewis Gaul wrote: > Hello, > > I'm trying to build/install libguestfs (for virt-edit) on a RHEL7 server, where > I have no root access. I couldn't find any pre-built binaries online, so have > been trying to build from source (downloaded from https:// > download.libguestfs.org/). I'm using the latest stable version, 1.44.1. > > I have followed the instructions at https://libguestfs.org/ > guestfs-building.1.html, but './configure' is failing with: > checking for gperf... no > configure: error: gperf must be installed > > Indeed, it seems gperf is not installed. I then built gperf from source and > symlinked the binary to '~/bin/gperf', which is on my PATH. > > The problem is that I can't work out how to get libguestfs's ./configure script > to pick up this manually-compiled copy of gperf (which I don't have permissions > to place in a standard location under /usr/). > > Can anyone suggest a solution/workaround?
I think you should be able to do:
./configure GPERF=$HOME/bin/gperf
If not then try fiddling around with m4/guestfs-progs.m4 to see if you can come up with a workable patch.
Rich.
> (There may be a similar problem for some of the other external dependencies > that are checked after gperf - I couldn't see a way to get configure to > continue on failure or equivalent). > > Thanks in advance, > Lewis
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/ ~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
LIBRARY_PATH=~/.local/lib64 doesn't seem to work either unfortunately (still unable to find libmagic). Any other ideas (even if I need to edit a file and rerun autoconf or something)? Thanks, Lewis On Sat, 1 May 2021 at 20:01, Richard W.M. Jones <rjones@redhat.com> wrote:
On Sat, May 01, 2021 at 06:04:44PM +0100, Lewis Gaul wrote:
Thanks Rich, that worked.
I also had to compile augeas and specify 'AUGEAS_LIBS=~/.local/lib AUGEAS_CFLAGS="-O3"' for it to be picked up.
The problem I'm hitting now is: configure: error: libmagic (part of the "file" command) is required. Please install the file devel package
I have manually installed the contents of the file-devel RPM and its dependency file-libs into ~/.local/, so I now have libmagic.so under ~/.local/lib64/. Any idea how I can get ./configure to pick this up? I tried LD_LIBRARY_PATH=~ /.local/lib64 but this didn't seem to work.
I think maybe LIBRARY_PATH (not LD_*) might work.
Unfortunately m4/guestfs-libraries.m4 is using AC_CHECK_LIB instead of PKG_CHECK_MODULES, so you cannot just set PKG_CONFIG_* environment variables to pick up the right libmagic.pc (which is a bug in libguestfs).
Rich.
I'm hopeful this might be the last piece that's missing!
Thanks for your help, Lewis
On Sat, 1 May 2021 at 17:07, Richard W.M. Jones <rjones@redhat.com> wrote:
On Sat, May 01, 2021 at 02:26:37PM +0100, Lewis Gaul wrote: > Hello, > > I'm trying to build/install libguestfs (for virt-edit) on a RHEL7 server, where > I have no root access. I couldn't find any pre-built binaries online, so have > been trying to build from source (downloaded from https:// > download.libguestfs.org/). I'm using the latest stable version, 1.44.1. > > I have followed the instructions at https://libguestfs.org/ > guestfs-building.1.html, but './configure' is failing with: > checking for gperf... no > configure: error: gperf must be installed > > Indeed, it seems gperf is not installed. I then built gperf from source and > symlinked the binary to '~/bin/gperf', which is on my PATH. > > The problem is that I can't work out how to get libguestfs's ./configure script > to pick up this manually-compiled copy of gperf (which I don't have permissions > to place in a standard location under /usr/). > > Can anyone suggest a solution/workaround?
I think you should be able to do:
./configure GPERF=$HOME/bin/gperf
If not then try fiddling around with m4/guestfs-progs.m4 to see if you can come up with a workable patch.
Rich.
> (There may be a similar problem for some of the other external dependencies > that are checked after gperf - I couldn't see a way to get configure to > continue on failure or equivalent). > > Thanks in advance, > Lewis
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/ ~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
On Sun, May 02, 2021 at 12:14:19AM +0100, Lewis Gaul wrote:
LIBRARY_PATH=~/.local/lib64 doesn't seem to work either unfortunately (still unable to find libmagic). Any other ideas (even if I need to edit a file and rerun autoconf or something)? ... Unfortunately m4/guestfs-libraries.m4 is using AC_CHECK_LIB instead of PKG_CHECK_MODULES, so you cannot just set PKG_CONFIG_* environment variables to pick up the right libmagic.pc (which is a bug in libguestfs).
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, then re-run "autoconf". 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
Thanks, once again that seems to have got me past that problem, only for a new one to crop up (this time hivex, which I'm not sure how to build or why it's required on Linux). I take it this isn't really an expected workflow, trying to get the package to build without being able to use a package manager to install the dependencies? Searching the output from ./configure, I can't yet see any mention of quite a few of the other dependencies listed at https://libguestfs.org/guestfs-building.1.html that may be problematic, so I'm wondering if it's time to throw in the towel for this approach. All I'm looking for really is a way to programmatically edit a single file in a qcow2 VM image (which I planned to achieve with virt-edit) - is there an easier way to do this? Does virt-edit alone require all these dependencies, or would there be a way to build just virt-edit without pulling apart the build system? Alternatively, would it be possible/easier to build a static virt-edit binary in a CentOS 7 VM that could simply be copied onto this RHEL 7 machine? I appreciate your help so far and any further suggestions you might have! Thanks, Lewis On Sun, 2 May 2021 at 09:28, Richard W.M. Jones <rjones@redhat.com> wrote:
On Sun, May 02, 2021 at 12:14:19AM +0100, Lewis Gaul wrote:
LIBRARY_PATH=~/.local/lib64 doesn't seem to work either unfortunately (still unable to find libmagic). Any other ideas (even if I need to edit a file and rerun autoconf or something)? ... Unfortunately m4/guestfs-libraries.m4 is using AC_CHECK_LIB instead of PKG_CHECK_MODULES, so you cannot just set PKG_CONFIG_* environment variables to pick up the right libmagic.pc (which is a bug in libguestfs).
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, then re-run "autoconf".
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 Sun, May 02, 2021 at 02:23:55PM +0100, Lewis Gaul wrote:
Thanks, once again that seems to have got me past that problem,
Do you have a patch for this one?
only for a new one to crop up (this time hivex, which I'm not sure how to build or why it's required on Linux). I take it this isn't really an expected workflow, trying to get the package to build without being able to use a package manager to install the dependencies?
Hivex is needed to inspect and edit Windows registries, and is a required dependency nowadays. It's also only a small C library and is available in most distros.
Searching the output from ./configure, I can't yet see any mention of quite a few of the other dependencies listed at https://libguestfs.org/ guestfs-building.1.html that may be problematic, so I'm wondering if it's time to throw in the towel for this approach.
All I'm looking for really is a way to programmatically edit a single file in a qcow2 VM image (which I planned to achieve with virt-edit) - is there an easier way to do this? Does virt-edit alone require all these dependencies, or would there be a way to build just virt-edit without pulling apart the build system?
Alternatively, would it be possible/easier to build a static virt-edit binary in a CentOS 7 VM that could simply be copied onto this RHEL 7 machine?
I appreciate your help so far and any further suggestions you might have!
RHEL 7 has libguestfs already. You don't have root access, but it should be possible to download what you need as RPMs, unpack them, and run libguestfs from your home directory. Something like this: $ yumdownloader libguestfs ... libguestfs-1.40.2-5.el7.x86_64.rpm | 2.4 MB 00:01 $ yumdownloader libguestfs-tools-c $ rpm2cpio libguestfs-1.40.2-5.el7.x86_64.rpm | cpio -id $ rpm2cpio libguestfs-tools-c-1.40.2-5.el7.x86_64.rpm | cpio -id $ cd usr/bin/ $ LIBGUESTFS_PATH=$PWD/../lib64/guestfs LD_LIBRARY_PATH=../lib64 ./libguestfs-test-tool You might also need to download other dependencies as RPMs and unpack those in the same way (supermin, hivex, etc) Or ask for root to install the package(!) Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
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). Full steps I ended up using: yumdownloader --resolve libguestfs libguestfs-tools-c for rpm in *.rpm; do rpm2cpio "$rpm" | cpio -idmv done curl https://download.libguestfs.org/binaries/appliance/appliance-1.40.1.tar.xz -OL tar -xf appliance-1.40.1.tar.xz LIBGUESTFS_PATH="$PWD/appliance" LD_LIBRARY_PATH="$PWD/usr/lib64" ./usr/bin/virt-cat -a centos7.qcow2 /root/.bashrc
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 Do you have a patch for this one?
I've created https://github.com/libguestfs/libguestfs/pull/66 with some discussion on the two cases - feel free to edit/decline as you see fit. Thanks, Lewis On Sun, 2 May 2021 at 14:49, Richard W.M. Jones <rjones@redhat.com> wrote:
On Sun, May 02, 2021 at 02:23:55PM +0100, Lewis Gaul wrote:
Thanks, once again that seems to have got me past that problem,
Do you have a patch for this one?
only for a new one to crop up (this time hivex, which I'm not sure how to build or why it's required on Linux). I take it this isn't really an expected workflow, trying to get the package to build without being able to use a package manager to install the dependencies?
Hivex is needed to inspect and edit Windows registries, and is a required dependency nowadays. It's also only a small C library and is available in most distros.
Searching the output from ./configure, I can't yet see any mention of quite a few of the other dependencies listed at https://libguestfs.org/ guestfs-building.1.html that may be problematic, so I'm wondering if it's time to throw in the towel for this approach.
All I'm looking for really is a way to programmatically edit a single file in a qcow2 VM image (which I planned to achieve with virt-edit) - is there an easier way to do this? Does virt-edit alone require all these dependencies, or would there be a way to build just virt-edit without pulling apart the build system?
Alternatively, would it be possible/easier to build a static virt-edit binary in a CentOS 7 VM that could simply be copied onto this RHEL 7 machine?
I appreciate your help so far and any further suggestions you might have!
RHEL 7 has libguestfs already. You don't have root access, but it should be possible to download what you need as RPMs, unpack them, and run libguestfs from your home directory. Something like this:
$ yumdownloader libguestfs ... libguestfs-1.40.2-5.el7.x86_64.rpm | 2.4 MB 00:01
$ yumdownloader libguestfs-tools-c
$ rpm2cpio libguestfs-1.40.2-5.el7.x86_64.rpm | cpio -id $ rpm2cpio libguestfs-tools-c-1.40.2-5.el7.x86_64.rpm | cpio -id
$ cd usr/bin/ $ LIBGUESTFS_PATH=$PWD/../lib64/guestfs LD_LIBRARY_PATH=../lib64 ./libguestfs-test-tool
You might also need to download other dependencies as RPMs and unpack those in the same way (supermin, hivex, etc)
Or ask for root to install the package(!)
Rich.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
participants (2)
-
Lewis Gaul -
Richard W.M. Jones