Richard W.M. Jones
2021-Mar-29 18:01 UTC
[Libguestfs] question about guestfs_add_drive_opts_blocksize
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 at 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
Richard W.M. Jones
2021-Mar-29 18:15 UTC
[Libguestfs] question about guestfs_add_drive_opts_blocksize
On Mon, Mar 29, 2021 at 07:01:10PM +0100, Richard W.M. Jones wrote:> 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?Also for further information try setting: export LIBGUESTFS_DEBUG=1 export LIBGUESTFS_TRACE=1 Rich.> 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 at 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 > > _______________________________________________ > Libguestfs mailing list > Libguestfs at redhat.com > https://listman.redhat.com/mailman/listinfo/libguestfs-- 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
Richard W.M. Jones
2021-Mar-29 18:17 UTC
[Libguestfs] question about guestfs_add_drive_opts_blocksize
Also you may find it useful to delete the cached appliance between runs. It is usually located in /path/to/libguestfs/tmp/.guestfs-* Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org