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/EExzKbNaThis 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>
Richard W.M. Jones
2012-May-10 17:19 UTC
[Libguestfs] 回复: guestfs_mount_local* api undefined symbols
On Fri, May 11, 2012 at 01:03:26AM +0800, Nok wrote:> 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.Local builds act a bit differently because they contain a hidden 'RPATH' ELF entry: $ eu-readelf -d ./fish/.libs/lt-guestfish | grep RPATH RPATH Library rpath: [/home/rjones/d/libguestfs/src/.libs:/usr/local/lib] This RPATH entry overrides LD_LIBRARY_PATH: $ LD_LIBRARY_PATH=/usr/lib64 ./fish/.libs/lt-guestfish --version guestfish 1.17.40 For the builds that we provide in Fedora and RHEL, we strip out RPATH: $ eu-readelf -d /usr/bin/guestfish | grep RPATH $ /usr/bin/guestfish --version /usr/bin/guestfish 1.17.36fedora=17,release=2.fc17> 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.Install the 'hivex-devel' and 'libvirt-devel' packages (from RHEL) before ./configure && make. You may be able to do 'yum-builddep libguestfs' to install all the dependencies; or else read the libguestfs.spec file (BuildRequire lines). Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v