On Mon, Mar 29, 2021 at 10:44:55AM -0600, Stefan Fiala wrote:
gcc create_disk.c -L lib/.libs -lguestfs -o create_disk builds but when run:- libguestfs: error: add_drive: unknown option 12 (this can happen if a program is compiled against a newer version of libguestfs, then dynamically linked to an older version)
Doesn't that come from using /usr/lib/x86_64-linux-gnu/libguestfs.so [an old (installed) version)?
Did you use the ./run script when running the program? Rich.
There is only a static library in my build tree:- lib/.libs/libguestfs.a [I'm not much good at messing with shared/static libraries] Stefan
On 03/26/2021 10:19 AM Richard W.M. Jones <rjones@redhat.com> wrote:
On Fri, Mar 26, 2021 at 09:57:47AM -0600, Stefan Fiala wrote:
I want to do some work with 4K blocksize devices (real and virtual). I found examples/create_disk.c then found it didn't contain the blocksize option. I have Ubuntu 20.04 guestfish version 1.40.2. I investigated and found a recent checkin 1.45.2 that adds this option.
Do you mean this one?
commit 94843f155aa72d75d693a96f7b11ceb7558837f0 Author: Nikolay Ivanets Date: Tue Feb 11 16:12:24 2020 +0200
lib: add support for disks with 4096 bytes sector size
I then rebuilt libguestfs from scratch using tag V1.45.2. I noted the warning not to "make install" it and stopped.
I don't see how to build create_disk.c against a libguesfs.a version 1.45.2. The faq/etc talk about running a self-compiled program using ./run but not how to make such a program with a different version.
You can just do something like:
gcc create_disk.c -L lib/.libs -lguestfs -o create_disk ./run ./create_disk
Rich.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html