Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1054657 - On Archbsd which uses Freebsd10 kernel and world the libvirt-glib with enable-introspection does not compile (using gcc or clang)
Summary: On Archbsd which uses Freebsd10 kernel and world the libvirt-glib with enable...
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt-glib
Version: unspecified
Hardware: x86_64
Target Milestone: ---
Assignee: Daniel Berrangé
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2014-01-17 08:26 UTC by claudiu2004
Modified: 2014-01-21 12:15 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-01-21 12:15:40 UTC

Attachments (Terms of Use)

Description claudiu2004 2014-01-17 08:26:20 UTC
Description of problem:
On Archbsd which uses Freebsd10 kernel and world the libvirt-glib with enable-introspection does not compile (using gcc or clang)
uname -a:
FreeBSD r2d2 10.0-PRERELEASE FreeBSD 10.0-PRERELEASE #1 6820566(makepkg)-dirty: Sun Dec 22 12:23:20 CET 2013     wry@wrybsd  x86_64

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. We are using a clean chroot in order to compile each package, this does not get influenced by the settings on the machine 
2.Run  CPPFLAGS+=-I/usr/include LDFLAGS+="-L/usr/lib -lgnutls" ./configure \
                --disable-static \
                --enable-introspection \
gmake , the result below is with V=1
3. Fail to compile

Actual results:
libvirt_glib_1_0_la-libvirt-glib-error.lo libvirt_glib_1_0_la-libvirt-glib-event.lo libvirt_glib_1_0_la-libvirt-glib-main.lo -lvirt -lintl   -lglib-2.0   -lgthread-2.0 -pthread -lglib-2.0
libtool: link: gcc -shared  -fPIC -DPIC  .libs/libvirt_glib_1_0_la-libvirt-glib-error.o .libs/libvirt_glib_1_0_la-libvirt-glib-event.o .libs/libvirt_glib_1_0_la-libvirt-glib-main.o   -L/usr/lib /usr/lib/libgnutls.so -lz -lp11-kit -ltasn1 -lnettle -lhogweed -lgmp -lvirt /usr/lib/libintl.so -lgthread-2.0 -lglib-2.0  -pthread -march=x86-64 -mtune=generic -O2 -Wl,--version-script=./libvirt-glib.sym -pthread   -pthread -Wl,-soname -Wl,libvirt-glib-1.0.so.1 -o .libs/libvirt-glib-1.0.so.1
libtool: link: (cd ".libs" && rm -f "libvirt-glib-1.0.so" && ln -s "libvirt-glib-1.0.so.1" "libvirt-glib-1.0.so")
libtool: link: (cd ".libs" && rm -f "libvirt-glib-1.0.so" && ln -s "libvirt-glib-1.0.so.1" "libvirt-glib-1.0.so")
libtool: link: ( cd ".libs" && rm -f "libvirt-glib-1.0.la" && ln -s "../libvirt-glib-1.0.la" "libvirt-glib-1.0.la" )
/usr/bin/g-ir-scanner \
                --quiet \
                --warn-all \
                --namespace LibvirtGLib \
                --nsversion 1.0 \
                --include GLib-2.0 \
                --identifier-prefix=GVir \
                --symbol-prefix=gvir \
                --library=./libvirt-glib-1.0.la \
                --output LibvirtGLib-1.0.gir \
                -I.. \
                --verbose \
                --pkg=gthread-2.0 \
                --c-include="libvirt-glib/libvirt-glib.h" \
                --pkg-export=libvirt-glib-1.0 \
                ./libvirt-glib.h ./libvirt-glib-error.h ./libvirt-glib-event.h ./libvirt-glib-main.h ./libvirt-glib-error.c ./libvirt-glib-event.c ./libvirt-glib-main.c
sed: stdout: Bad file descriptor
./libvirt-glib-1.0.la: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
linking of temporary binary failed: Command '['gcc', '-o', '/usr/home/builder/package/src/libvirt-glib-0.1.7/libvirt-glib/tmp-introspectJ5jUdU/LibvirtGLib-1.0', '-march=x86-64', '-mtune=generic', '-O2', '-pipe', '-fstack-protector', '--param=ssp-buffer-size=4', '-L/usr/lib', '-lgnutls', '/usr/home/builder/package/src/libvirt-glib-0.1.7/libvirt-glib/tmp-introspectJ5jUdU/LibvirtGLib-1.0.o', '-L.', '-Wl,-rpath=.', './libvirt-glib-1.0.la', '-lgio-2.0', '-lgobject-2.0', '-Wl,--export-dynamic', '-lgmodule-2.0', '-lgthread-2.0', '-pthread', '-lglib-2.0']' returned non-zero exit status 1
gmake[2]: *** [LibvirtGLib-1.0.gir] Error 1
gmake[2]: Leaving directory `/usr/home/builder/package/src/libvirt-glib-0.1.7/libvirt-glib'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/home/builder/package/src/libvirt-glib-0.1.7'
gmake: *** [all] Error 2

Expected results:

Additional info:
I have already built other libvirt components:
:sudo pacman -Ss libvirt
testing/libvirt 1.2.0-1 [installed]
    API for controlling virtualization engines (openvz,kvm,qemu,virtualbox,xen,etc)
testing/libvirt-python 1.2.0-1 [installed]
    libvirt python binding
community/libvirt 1.1.3-1 [installed: 1.2.0-1]
    API for controlling virtualization engines (openvz,kvm,qemu,virtualbox,xen,etc)

When using the --disable-introspection flag it builds without issues, but then when running virt-manager I get this error:
ERROR:root:Could not find any typelib for LibvirtGLib
Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-manager", line 33, in <module>
    from gi.repository import LibvirtGLib
ImportError: cannot import name LibvirtGLib

virt-install works :virt-install
WARNING  KVM acceleration not available, using 'qemu'
--name is required
--ram amount in MB is required
--disk storage must be specified (override with --nodisks)
An install method must be specified
(--location URL, --cdrom CD/ISO, --pxe, --import, --boot hd|cdrom|...)

so are other virt-manager components. 

Thank you for checking this and for doing a very good job.

Comment 1 Daniel Veillard 2014-01-17 08:44:16 UTC
it would be good to raise this portability issue in libvirt list


if you didn't already !

   thanks for the report,


Comment 2 Christophe Fergeau 2014-01-17 14:27:22 UTC
The full build log might be useful. Are you building with -jX? Could be parallel build which is broken. Does libvirt-glib/libvirt-glib-1.0.la exist when this fails? Is it empty?

Comment 3 claudiu2004 2014-01-17 14:43:47 UTC

This is the full log for build: http://sprunge.us/WbGR

This is the PKGBUILD used:

gmake was uset with -j1

Comment 4 claudiu2004 2014-01-17 14:44:18 UTC

This is the full log for build: http://sprunge.us/WbGR

This is the PKGBUILD used:

gmake was used with -j1

Comment 5 claudiu2004 2014-01-17 14:50:05 UTC
Sorry for the double post

This is the content of libvirt-glib/libvirt-glib-1.0.la after the compilation fails

Comment 6 Christophe Fergeau 2014-01-17 15:30:49 UTC
A patch similar to https://fedorahosted.org/libosinfo/ticket/11 may be needed.

Comment 7 Daniel Berrangé 2014-01-17 16:21:40 UTC
Yes, I'll work up a fix for the build process.

Comment 9 claudiu2004 2014-01-17 20:31:26 UTC
Thank you very much, I did apply those patches against libvirt-gobject 1.7 and got the autogen.sh from the git repository, but now I am encounering this issue:
gmake[3]: Entering directory `/usr/home/builder/package/src/libvirt-glib-0.1.7/libvirt-gobject'
/usr/bin/g-ir-compiler  --includedir=. LibvirtGObject-1.0.gir -o LibvirtGObject-1.0.typelib
Could not find GIR file 'LibvirtGConfig-1.0.gir'; check XDG_DATA_DIRS or use --includedir
error parsing file LibvirtGObject-1.0.gir: Failed to parse included gir LibvirtGConfig-1.0
gmake[3]: *** [LibvirtGObject-1.0.typelib] Error 1
gmake[3]: Leaving directory `/usr/home/builder/package/src/libvirt-glib-0.1.7/libvirt-gobject'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/usr/home/builder/package/src/libvirt-glib-0.1.7/libvirt-gobject'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/home/builder/package/src/libvirt-glib-0.1.7'

Used this in place of ./configure

autogen.sh \
              --enable-introspection \

Comment 10 Christophe Fergeau 2014-01-20 10:26:13 UTC
What gobject-introspection version are you using? Did you get more errors/warnings on a build from a clean tree? The g-ir-compiler is the same here, and I don't get this error.

Comment 11 claudiu2004 2014-01-20 11:11:39 UTC
extra/gobject-introspection 1.38.0-1 [installed]
    Introspection system for GObject-based libraries

This is how gobject-introspections is built:
prepare() {
  cd "$srcdir/$pkgname-$pkgver"
  for i in "${_port_patches[@]}"; do
    msg "patch $i"
    patch -p0 -i "$srcdir/$i"
  sed -i '' -e 's|'gcc'|'cc'|g' giscanner/dumper.py

build() {
  cd "$srcdir/$pkgname-$pkgver"
  PYTHON=/usr/bin/python2 ./configure --prefix=/usr --disable-static --enable-doctool

package() {
  cd "$pkgname-$pkgver"
  gmake DESTDIR="$pkgdir" install

  gsed -i '1s|#!/usr/bin/env python$|&2|' \

And this is the content of the gobject-introspection package:

I will dig some more when I will have time maybe I am doing smth wrong. I will checkout the latest git for libvirt-glib to test that also .

Comment 12 claudiu2004 2014-01-21 08:42:15 UTC

The same happens when I use the git version of libvirt-glib and just apply the patches it failes at the same line.
But if I do :
cd libvirt-gobject 
and run :
/usr/bin/g-ir-compiler  --includedir=. --includedir=../libvirt-gconfig/ --includedir=../libvirt-glib LibvirtGObject-1.0.gir -
o LibvirtGObject-1.0.typelib         

I have added /usr/bin/g-ir-compiler  --includedir=. --includedir=../libvirt-gconfig/ --includedir=../libvirt-glib LibvirtGObject-1.0.gir -
o LibvirtGObject-1.0.typelib this gives no error and I can resume the gmake.

I cannot find where in Makefile.am to add those includedirs options but maybe you know.

Comment 13 Christophe Fergeau 2014-01-21 10:02:57 UTC
Ah, I could not reproduce because I had the libvirt-glib gir files already installed on my system, after removing them I hit the same error as yours, and this patch fixes it:

diff --git a/libvirt-gobject/Makefile.am b/libvirt-gobject/Makefile.am
index 4659642..c0258c0 100644
--- a/libvirt-gobject/Makefile.am
+++ b/libvirt-gobject/Makefile.am
@@ -158,6 +158,9 @@ LibvirtGObject_1_0_gir_SCANNERFLAGS = \
        --include-uninstalled $(top_builddir)/libvirt-gconfig/LibvirtGConfig-1.0.gir \
 INTROSPECTION_GIRS += LibvirtGObject-1.0.gir
+       --includedir=$(top_builddir)/libvirt-glib \
+       --includedir=$(top_builddir)/libvirt-gconfig

 girdir = $(datadir)/gir-1.0
 gir_DATA = LibvirtGObject-1.0.gir

Comment 14 claudiu2004 2014-01-21 11:07:02 UTC
Thank you , it compiles as expected, now I will go on and post some issues with virt-manager.

Comment 15 Christophe Fergeau 2014-01-21 12:15:40 UTC
Fixed in git:
Thanks for the thorough testing/investigation!

Note You need to log in before you can comment on or make changes to this bug.