Bug 1054657 - On Archbsd which uses Freebsd10 kernel and world the libvirt-glib with enable-introspection does not compile (using gcc or clang)
On Archbsd which uses Freebsd10 kernel and world the libvirt-glib with enable...
Status: CLOSED NEXTRELEASE
Product: Virtualization Tools
Classification: Community
Component: libvirt-glib (Show other bugs)
unspecified
x86_64 FreeBSD
unspecified Severity high
: ---
: ---
Assigned To: Daniel Berrange
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-01-17 03:26 EST by claudiu2004
Modified: 2014-01-21 07:15 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-01-21 07:15:40 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description claudiu2004 2014-01-17 03:26:20 EST
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):
1.7

How reproducible:
Always.

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 \
                 --with-python=/usr/bin/python2
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:
virt-manager
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'
ERROR
--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 03:44:16 EST
it would be good to raise this portability issue in libvirt list

https://www.redhat.com/mailman/listinfo/libvir-list

if you didn't already !

   thanks for the report,

Daniel
Comment 2 Christophe Fergeau 2014-01-17 09:27:22 EST
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 09:43:47 EST
Hello,

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

This is the PKGBUILD used:
http://sprunge.us/QZQQ

gmake was uset with -j1
Comment 4 claudiu2004 2014-01-17 09:44:18 EST
Hello,

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

This is the PKGBUILD used:
http://sprunge.us/QZQQ

gmake was used with -j1
Comment 5 claudiu2004 2014-01-17 09:50:05 EST
Sorry for the double post

This is the content of libvirt-glib/libvirt-glib-1.0.la after the compilation fails
http://sprunge.us/ScAj
Comment 6 Christophe Fergeau 2014-01-17 10:30:49 EST
A patch similar to https://fedorahosted.org/libosinfo/ticket/11 may be needed.
Comment 7 Daniel Berrange 2014-01-17 11:21:40 EST
Yes, I'll work up a fix for the build process.
Comment 9 claudiu2004 2014-01-17 15:31:26 EST
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 \
              --with-python=/usr/bin/python2
Comment 10 Christophe Fergeau 2014-01-20 05:26:13 EST
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 06:11:39 EST
Hello, 
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"
  done
  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
  gmake
}

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

  gsed -i '1s|#!/usr/bin/env python$|&2|' \
    "$pkgdir"/usr/lib/gobject-introspection/giscanner/*.py
}


And this is the content of the gobject-introspection package:
http://sprunge.us/DLFd

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 03:42:15 EST
Hi,

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 05:02:57 EST
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 \
        $(NULL)
 INTROSPECTION_GIRS += LibvirtGObject-1.0.gir
+INTROSPECTION_COMPILER_ARGS = \
+       --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 06:07:02 EST
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 07:15:40 EST
Fixed in git:
http://libvirt.org/git/?p=libvirt-glib.git;a=commit;h=36913abd20b2ad6fc77f49633d0c30ce93906a79 
Thanks for the thorough testing/investigation!

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