HI all: my problem is : I want to use libguestfs on other project. if I just run a test C programm It works well just run : cc prog.c -o prog -lguestfs -I /usr/libguestfs/libguestfs-1.28.10/src/ I write a C programm in my project , after that I run make , it happend: /usr/nitro/libvmi-master/libvmi/.libs/libvmi.so: undefined reference to `guestfs_launch' /usr/nitro/libvmi-master/libvmi/.libs/libvmi.so: undefined reference to `guestfs_close' /usr/nitro/libvmi-master/libvmi/.libs/libvmi.so: undefined reference to `guestfs_inspect_os' /usr/nitro/libvmi-master/libvmi/.libs/libvmi.so: undefined reference to `guestfs_ls' /usr/nitro/libvmi-master/libvmi/.libs/libvmi.so: undefined reference to `guestfs_inspect_get_type' /usr/nitro/libvmi-master/libvmi/.libs/libvmi.so: undefined reference to `guestfs_inspect_get_mountpoints' /usr/nitro/libvmi-master/libvmi/.libs/libvmi.so: undefined reference to `guestfs_inspect_get_major_version' /usr/nitro/libvmi-master/libvmi/.libs/libvmi.so: undefined reference to `guestfs_inspect_get_product_name' /usr/nitro/libvmi-master/libvmi/.libs/libvmi.so: undefined reference to `guestfs_add_drive_opts' I think It's owe to the lack of DLL, so I did some change in Makefile, the change is : - LIBS = -lvirt -LDFLAGS +LDFLAGS = /usr/lib +LIBS = -lguestfs -lvirt but it didn't works! so does anyone know what's the problem? appreciate so much
On Sun, Jun 28, 2015 at 04:32:55AM +0800, fu lirong wrote:> HI all: > my problem is : > I want to use libguestfs on other project. > > if I just run a test C programm It works well > just run : cc prog.c -o prog -lguestfs -I > /usr/libguestfs/libguestfs-1.28.10/src/> - LIBS = -lvirt > -LDFLAGS > +LDFLAGS = /usr/lib > +LIBS = -lguestfs -lvirtYou may need: +LDFLAGS = -L/usr/libguestfs/libguestfs-1.28.10/libs or maybe: +LDFLAGS = -L/usr/libguestfs/libguestfs-1.28.10/libs/.libs depending on how or whether you have installed libguestfs. Note use of the '-L' option to set the linker search path. 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