gir generation fails

Bug #821449 reported by Pim Vullers
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Euclide
Fix Released
High
Unassigned

Bug Description

When building euclide on Gentoo, using an ebuild, this is done in a sandbox. The call to ldconfig starting the gir generation causes an access violation (modification of /etc/ld.so.cache). Commenting out this line in the CMakeLists file results in an 'library not found' by the g-ir-scanner.

This is a similar problem as I reported for granite:
https://bugs.launchpad.net/granite/+bug/820342

My guess is that the ldconfig call was added to solve the 'library not found' issue, but how it's done now
is not ideal. If you have any solutions please let me know, I'm happy to test them.

In the mean time I'll look at how other packages (using Gentoo ebuilds) solve this problem.

Revision history for this message
Pim Vullers (pimvullers) wrote :
Revision history for this message
xapantu (xapantu) wrote : Re: [Bug 821449] Re: gir generation fails

The current system to generate the gir is based on the installed libs,
but it is a bad solution, because it can't be done if (like on gentoo,
if I recall correctly), we compile and install the software without the
root rights, or not in the system dirs. It would be the same problem
with a ppa I think.

So, it must be changed, maybe we can generate the GIR with valac (the
main problem is that g-ir-scanner is mostly used with the autotools, not
with CMake -.-).

Changed in euclide:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Pim Vullers (pimvullers) wrote :
Download full text (3.7 KiB)

I just checked on of the (not so big) packages on my system that also builds gir files (lightdm). It seems that the autotools build these based on a .la file instead of the .so library. So it might be an idea to try this.

Partial build log of lightdm, featuring (1) linking of the .so shared object file (2) creation of the .la static library archive file (3) running g-ir-scanner/compiler:

(1)
libtool: link: gcc -shared -fPIC -DPIC .libs/liblightdm_gobject_1_la-greeter.o .libs/liblightdm_gobject_1_la-system.o .libs/liblightdm_gobject_1_la-language.o .libs/liblightdm_gobject_1_la-layout.o .libs/liblightdm_gobject_1_la-power.o .libs/liblightdm_gobject_1_la-session.o .libs/liblightdm_gobject_1_la-user.o /usr/lib64/libgio-2.0.so -L/usr/lib64 -lresolv /usr/lib64/libgmodule-2.0.so -lxklavier /usr/lib64/libgobject-2.0.so -lffi /usr/lib64/libgthread-2.0.so /usr/lib64/libglib-2.0.so -lrt /usr/lib64/libxml2.so -licui18n -licuuc -licudata -lpthread -ldl -lz -lm -lX11 -pthread -O2 -pthread -pthread -Wl,-soname -Wl,liblightdm-gobject-1.so.0 -o .libs/liblightdm-gobject-1.so.0.0.0

(2)
libtool: link: (cd ".libs" && rm -f "liblightdm-gobject-1.so.0" && ln -s "liblightdm-gobject-1.so.0.0.0" "liblightdm-gobject-1.so.0")
libtool: link: (cd ".libs" && rm -f "liblightdm-gobject-1.so" && ln -s "liblightdm-gobject-1.so.0.0.0" "liblightdm-gobject-1.so")
libtool: link: ar cru .libs/liblightdm-gobject-1.a liblightdm_gobject_1_la-greeter.o liblightdm_gobject_1_la-system.o liblightdm_gobject_1_la-language.o liblightdm_gobject_1_la-layout.o liblightdm_gobject_1_la-power.o liblightdm_gobject_1_la-session.o liblightdm_gobject_1_la-user.o
libtool: link: ranlib .libs/liblightdm-gobject-1.a
libtool: link: ( cd ".libs" && rm -f "liblightdm-gobject-1.la" && ln -s "../liblightdm-gobject-1.la" "liblightdm-gobject-1.la" )

(3)
/usr/bin/g-ir-scanner --add-include-path=. --namespace=LightDM --nsversion=1 --libtool="/bin/sh ../libtool" --include=GObject-2.0 --library=liblightdm-gobject-1.la --identifier-prefix=LightDM greeter.c system.c language.c layout.c power.c session.c user.c lightdm/greeter.h lightdm/system.h lightdm/language.h lightdm/layout.h lightdm/power.h lightdm/session.h lightdm/user.h liblightdm-gobject-1.la --output LightDM-1.gir
g-ir-scanner: compile: gcc -Wall -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -c -o /tmp/lightdm-0.9.2/liblightdm-gobject/tmp-introspectF0TNsW/LightDM-1.o /tmp/lightdm-0.9.2/liblightdm-gobject/tmp-introspectF0TNsW/LightDM-1.c
g-ir-scanner: link: /bin/sh ../libtool --mode=link --tag=CC gcc -o /tmp/lightdm-0.9.2/liblightdm-gobject/tmp-introspectF0TNsW/LightDM-1 -export-dynamic -L. liblightdm-gobject-1.la -pthread -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 /tmp/lightdm-0.9.2/liblightdm-gobject/tmp-introspectF0TNsW/LightDM-1.o
libtool: link: gcc -o /tmp/lightdm-0.9.2/liblightdm-gobject/tmp-introspectF0TNsW/.libs/LightDM-1 -pthread /tmp/lightdm-0.9.2/liblightdm-gobject/tmp-introspectF0TNsW/LightDM-1.o -Wl,--export-dynamic -L. ./.libs/liblightdm-gobject-1.so -L/usr/lib64 -lxklavier /usr/lib64/libxml2.so -licui18n -licuuc -licudata -lm -lX...

Read more...

Revision history for this message
Pim Vullers (pimvullers) wrote :

Just had a look at http://www.cmake.org/Wiki/CMake_FAQ#Library_questions and it seems that tis, building both static and shared library, is not supported by CMake. Or at least not by CMake macros (or whatever they are called), since they cannot make it build system independent. Since these apps are (as far as I know) only intended for Linux I think we can do by manually adding the commands to build the static version from the object files (like the autotools do) and perform gir generation on it.

Revision history for this message
Pim Vullers (pimvullers) wrote :

Searching the web I found that Poppler (http://poppler.freedesktop.org/) uses cmake as well as gobject introspection. As far as I can see they even have macros for this, so this might be interesting for the elementary projects to look at and reuse their work.

Revision history for this message
xapantu (xapantu) wrote :

Wow, thanks a lot, they have some nice modules, I will look at them, I
am sure they will solve our problem :)

Revision history for this message
Pim Vullers (pimvullers) wrote :

Just attached a patch to https://bugs.launchpad.net/granite/+bug/820342 which solves this problem for granite, as you are also a dev there, please have a look at it (and apply is you're satisfied with it). In the mean time I'll create a similar patch for euclide.

Revision history for this message
Pim Vullers (pimvullers) wrote :

The attached patch fixes gir generation on my system. Have a look at it, and if you like it, please commit to tree.

Revision history for this message
xapantu (xapantu) wrote :

Thanks a lot, it works fine :)

I have just committed it to the branch, this patch is really
appreciated :)

Le samedi 06 août 2011 à 10:44 +0000, Pim Vullers a écrit :
> The attached patch fixes gir generation on my system. Have a look at it,
> and if you like it, please commit to tree.
>
> ** Patch added: "fix gir generation"
> https://bugs.launchpad.net/euclide/+bug/821449/+attachment/2257881/+files/euclide-introspection.patch
>

xapantu (xapantu)
Changed in euclide:
status: Confirmed → Fix Committed
Changed in euclide:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.