[Libguestfs] 回复: guestfs_mount_local* api undefined symbols

Nok leolc_2749 at qq.com
Thu May 10 17:03:26 UTC 2012


Thank you Rich,


I checked the version and found that it printed an old 1.17.17 version which was deployed before.
But I remembered i did check the version in guestfish shell and it said 1.17.40 before that,then i totally ignored the fact i had another version involved.
I`ve changed the LD_LIBRARY_PATH and the "undefined symbol" error disappeared.But some "inspection API not available because of compiled without hivex library" pops up.I`ll check this out later.


thank you again
      ;)
    Nok


------------------ 原始邮件 ------------------
发件人: "Richard W.M. Jones"<rjones at redhat.com>;
发送时间: 2012年5月10日(星期四) 晚上11:07
收件人: "Nok"<leolc_2749 at qq.com>; 
抄送: "libguestfs"<libguestfs at redhat.com>; 
主题: Re: [Libguestfs]  guestfs_mount_local* api undefined symbols



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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20120511/0ce2ba50/attachment.htm>


More information about the Libguestfs mailing list