<div>Thank you Rich,</div><div><br></div><div>I checked the version and found that it printed an old 1.17.17 version which was deployed before.</div><div>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.</div><div>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.</div><div><br></div><div>thank you again</div><div>      ;)</div><div><includetail><div>    Nok</div><div><br></div><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">------------------ 原始邮件 ------------------</div><div style="font-size: 12px;background:#efefef;padding:8px;"><div><b>发件人:</b> "Richard W.M. Jones"<rjones@redhat.com>;</div><div><b>发送时间:</b> 2012年5月10日(星期四) 晚上11:07</div><div><b>收件人:</b> "Nok"<leolc_2749@qq.com>; <wbr></div><div><b>抄送:</b> "libguestfs"<libguestfs@redhat.com>; <wbr></div><div><b>主题:</b> Re: [Libguestfs]  guestfs_mount_local* api undefined symbols</div></div><div><br></div>On Thu, May 10, 2012 at 09:59:17PM +0800, Nok wrote:<br>> Recently i deployed latest 1.17.40 on rhel6.1.<br><br>Compiled from source, by the looks of it?<br><br>> When i ran a tiny program which was to test the function<br>> guestfs_mount_local() or those similar functions that mounts<br>> locally, Error prompted—undefined symbol guest_mount_local !<br>><br>> Why didn`t this undefined symbol error prompt when the program was<br>> first compiled,but occurred when it was run?<br>><br>> Then i gave guestfish mount local a try in the shell, and found that<br>> ok.I thought it could not be something wrong with the<br>> installation.And then wierd happened—i ran the previous test program<br>> again,and it did mount the vm image on the host local directory! I<br>> doubted whether this was repeatable so i ran it again,and it failed<br>> with the same error “undefined symbol guestfs_mount_local”.<br><br>The symptoms sound like you're compiling your program against<br>libguestfs 1.17.40, but you're running your program against an earlier<br>libguestfs library (maybe the one installed in RHEL 6?).<br><br>> make install<br>> <br>> http://pastebin.com/EExzKbNa<br><br>This installs libguestfs in /usr/local.  The one from RHEL 6 will be<br>in /usr.  You might want to set 'LD_LIBRARY_PATH' so that the<br>program uses the /usr/local copy, ie:<br><br>  LD_LIBRARY_PATH=/usr/local/lib ./prog<br><br>By the way, it's not necessarily safe to mix'n'match libraries,<br>daemons and appliances like you're trying to do here.  The protocol<br>used between the library and the daemon has changed since RHEL 6.2.<br>If you are using libguestfs 1.16.19 (from [1]) then it'll probably<br>work for the majority of features.  Earlier versions, probably not.<br>If you don't want to compile the right daemon + appliance on RHEL 6,<br>you can copy an appliance from a Fedora 17+ machine.  See the<br>instructions here:<br><br>  http://libguestfs.org/libguestfs-make-fixed-appliance.1.html<br>  http://libguestfs.org/download/binaries/appliance/<br><br>Also you can modify your program so it prints out the version of<br>libguestfs that it's using:<br><br>  http://libguestfs.org/guestfs.3.html#guestfs_version<br><br>  #include <stdio.h><br>  #include <inttypes.h><br>  #include <guestfs.h><br><br>  //...<br><br>  guestfs_h *g = guestfs_create ();<br>  struct guestfs_version *vers = guestfs_version (g);<br>  printf ("version = %" PRIi64 ".%" PRIi64 ".%" PRIi64 ".%s",<br>          vers->major, vers->minor, vers->release, vers->extra);<br><br>Rich.<br><br>[1] http://people.redhat.com/~rjones/libguestfs-RHEL-6.3-preview/<br><br>-- <br>Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones<br>Read my programming blog: http://rwmj.wordpress.com<br>Fedora now supports 80 OCaml packages (the OPEN alternative to F#)<br>http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora<br><br></includetail></div>