[Libguestfs] guestfs_mount_local* api undefined symbols

Richard W.M. Jones rjones at redhat.com
Thu May 10 15:07:11 UTC 2012


On Thu, May 10, 2012 at 09:59:17PM +0800, Nok wrote:
> Recently i deployed latest 1.17.40 on rhel6.1.

Compiled from source, by the looks of it?

> When i ran a tiny program which was to test the function
> guestfs_mount_local() or those similar functions that mounts
> locally, Error prompted—undefined symbol guest_mount_local !
>
> Why didn`t this undefined symbol error prompt when the program was
> first compiled,but occurred when it was run?
>
> Then i gave guestfish mount local a try in the shell, and found that
> ok.I thought it could not be something wrong with the
> installation.And then wierd happened—i ran the previous test program
> again,and it did mount the vm image on the host local directory! I
> doubted whether this was repeatable so i ran it again,and it failed
> with the same error “undefined symbol guestfs_mount_local”.

The symptoms sound like you're compiling your program against
libguestfs 1.17.40, but you're running your program against an earlier
libguestfs library (maybe the one installed in RHEL 6?).

> make install
> 
> http://pastebin.com/EExzKbNa

This installs libguestfs in /usr/local.  The one from RHEL 6 will be
in /usr.  You might want to set 'LD_LIBRARY_PATH' so that the
program uses the /usr/local copy, ie:

  LD_LIBRARY_PATH=/usr/local/lib ./prog

By the way, it's not necessarily safe to mix'n'match libraries,
daemons and appliances like you're trying to do here.  The protocol
used between the library and the daemon has changed since RHEL 6.2.
If you are using libguestfs 1.16.19 (from [1]) then it'll probably
work for the majority of features.  Earlier versions, probably not.
If you don't want to compile the right daemon + appliance on RHEL 6,
you can copy an appliance from a Fedora 17+ machine.  See the
instructions here:

  http://libguestfs.org/libguestfs-make-fixed-appliance.1.html
  http://libguestfs.org/download/binaries/appliance/

Also you can modify your program so it prints out the version of
libguestfs that it's using:

  http://libguestfs.org/guestfs.3.html#guestfs_version

  #include <stdio.h>
  #include <inttypes.h>
  #include <guestfs.h>

  //...

  guestfs_h *g = guestfs_create ();
  struct guestfs_version *vers = guestfs_version (g);
  printf ("version = %" PRIi64 ".%" PRIi64 ".%" PRIi64 ".%s",
          vers->major, vers->minor, vers->release, vers->extra);

Rich.

[1] http://people.redhat.com/~rjones/libguestfs-RHEL-6.3-preview/

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora




More information about the Libguestfs mailing list