Re: [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@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
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@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@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
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
!!Thanks for the help [option 12 is the blocksize from the new version, tacked into the example code]. Still looks like its linked against the original/old libguestfs. Can I make a new libguestfs.so from the libguestfs.a and point to it locally? sfiala@tyan3:~/libguestfs/libguestfs$ rm -Rf tmp/.guestfs-1000 sfiala@tyan3:~/libguestfs/libguestfs$ ls -la tmp total 12 drwxrwxr-x 2 sfiala sfiala 4096 Mar 29 12:26 . drwxrwxr-x 43 sfiala sfiala 4096 Mar 26 13:40 .. -rw-rw-r-- 1 sfiala sfiala 80 Mar 25 17:16 .gitignore sfiala@tyan3:~/libguestfs/libguestfs$ echo $LIBGUESTFS_DEBUG 1 sfiala@tyan3:~/libguestfs/libguestfs$ echo $LIBGUESTFS_TRACE 1 sfiala@tyan3:~/libguestfs/libguestfs$ ./run /mnt/sf_red/libguest-create-disk libguestfs: trace: set_verbose true libguestfs: trace: set_verbose = 0 libguestfs: trace: set_tmpdir "/home/sfiala/libguestfs/libguestfs/tmp" libguestfs: trace: set_tmpdir = 0 libguestfs: trace: set_cachedir "/home/sfiala/libguestfs/libguestfs/tmp" libguestfs: trace: set_cachedir = 0 libguestfs: trace: set_path "/home/sfiala/libguestfs/libguestfs/appliance" libguestfs: trace: set_path = 0 libguestfs: create: flags = 0, handle = 0x55cba7f8d6e0, program = libguest-create-disk libguestfs: trace: set_trace true libguestfs: trace: set_trace = 0 libguestfs: trace: disk_create "disk.img" "raw" 536870912 libguestfs: trace: disk_create = 0 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) libguestfs: trace: close libguestfs: closing guestfs handle 0x55cba7f8d6e0 (state 0)
On 03/29/2021 12:17 PM Richard W.M. Jones <rjones@redhat.com> wrote:
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
On Mon, Mar 29, 2021 at 12:32:52PM -0600, Stefan Fiala wrote:
!!Thanks for the help
[option 12 is the blocksize from the new version, tacked into the example code]. Still looks like its linked against the original/old libguestfs. Can I make a new libguestfs.so from the libguestfs.a and point to it locally?
I'm not really sure I understand the question. libguestfs when building from source defaults to building a shared library, and the ./run script sets up LD_LIBRARY_PATH (and other environment variables) to use it. I suggest taking a look at the ./run script itself since it's very simple. 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
RE:- libguestfs when building from source defaults to building a shared library. I didnt have libguestfs.so etc. I backtracked looks like I missed the CFLAGS=-fPIC off the ./autogen.sh. Blindingly obvious in 20/20 hindsight. Seems to work now!. Thanks for the help... Just need to figure out how all the appliance building works so I can "test" the created disk image. Stefan
On Mon, Mar 29, 2021 at 12:32:52PM -0600, Stefan Fiala wrote:
!!Thanks for the help
[option 12 is the blocksize from the new version, tacked into the example code]. Still looks like its linked against the original/old libguestfs. Can I make a new libguestfs.so from the libguestfs.a and point to it locally?
I'm not really sure I understand the question. libguestfs when building from source defaults to building a shared library, and the ./run script sets up LD_LIBRARY_PATH (and other environment variables) to use it. I suggest taking a look at the ./run script itself since it's very simple.
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
participants (2)
-
Richard W.M. Jones -
Stefan Fiala