After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 666208 - valac doesn't include all required GIR from --pkg switches
valac doesn't include all required GIR from --pkg switches
Status: RESOLVED FIXED
Product: libgee
Classification: Platform
Component: general
git master
Other Linux
: Urgent critical
: ---
Assigned To: libgee-maint
libgee-maint
Depends on:
Blocks:
 
 
Reported: 2011-12-14 23:16 UTC by Daniel Espinosa
Modified: 2012-01-20 16:26 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Daniel Espinosa 2011-12-14 23:16:45 UTC
If valac generates GIR files but doesn't include all --pkg packages required for the code to compile, in this case using g-ir-compiler to create typelib raw fails with segfault (reported on comment to Bug 652391).

You can see generated GIR file in attachment (id=203515) in Bug 652391. In this case valac generates GIR without Gee dependency and doesn't include the line:

<include name="Gee" version="0.8"/>

And if you see the XML include reference to symbols from Gee.
Comment 1 Luca Bruno 2011-12-15 10:18:36 UTC
Libgee has no GIR.
Comment 2 Luca Bruno 2011-12-15 10:19:23 UTC
I'm sorry, it has a GIR but doesn't have gir_namespace and gir_version information in the vapi.
Comment 3 Maciej (Matthew) Piechotka 2011-12-15 14:05:48 UTC
I'll look into this on Saturday (I'm currently during my exam session).

(In reply to comment #2)
> I'm sorry, it has a GIR but doesn't have gir_namespace and gir_version
> information in the vapi.

Hmm. Isn't libgee gir generated by valac?
Comment 4 Luca Bruno 2011-12-15 15:23:15 UTC
(In reply to comment #3)
> I'll look into this on Saturday (I'm currently during my exam session).
> 
> (In reply to comment #2)
> > I'm sorry, it has a GIR but doesn't have gir_namespace and gir_version
> > information in the vapi.
> 
> Hmm. Isn't libgee gir generated by valac?

The _vapi_ needs gir_namespace and gir_version :) Probably those must be set on top of every namespace Gee { }.
Comment 5 Maciej (Matthew) Piechotka 2011-12-19 01:45:22 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > I'll look into this on Saturday (I'm currently during my exam session).
> > 
> > (In reply to comment #2)
> > > I'm sorry, it has a GIR but doesn't have gir_namespace and gir_version
> > > information in the vapi.
> > 
> > Hmm. Isn't libgee gir generated by valac?
> 
> The _vapi_ needs gir_namespace and gir_version :) Probably those must be set on
> top of every namespace Gee { }.

It worst - it seems that it requires to split:

public class Gee.NameOfClass {
    ...
}

into

[CCode (gir_namespace = "Gee", gir_version = "0.8")]
namespace Gee {
    class NameOfClass {
        ...
    }
}

I'm seriously consider adding to gee/Makefile.am:

gee-0.8.vapi: libgee-0.8.la
        sed -i 's:namespace Gee:[CCode (gir_namespace = "Gee", gir_version = "0.8")]\nnamespace Gee:g' gee-0.8.vapi

as 'proper' fix seems to require violate DRY and reformat any code formatting (and this is bad as git merge/git rebase/git blame will stop working).

BTW - since the valac knows version in .gir file why it doesn't simply include it into .vapi?
Comment 6 Maciej (Matthew) Piechotka 2011-12-19 02:58:11 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > I'll look into this on Saturday (I'm currently during my exam session).
> > > 
> > > (In reply to comment #2)
> > > > I'm sorry, it has a GIR but doesn't have gir_namespace and gir_version
> > > > information in the vapi.
> > > 
> > > Hmm. Isn't libgee gir generated by valac?
> > 
> > The _vapi_ needs gir_namespace and gir_version :) Probably those must be set on
> > top of every namespace Gee { }.
> 

Actually it seems that it needs to be specified in first file passed to vala (see bug #666478).
I depend on ordering of compilation to avoid duplication.


commit f52493aa5dd77f6415b0a5daf15a73e1c05a0ac2
Author: Maciej Piechotka <uzytkownik2@gmail.com>
Date:   Mon Dec 19 03:26:37 2011 +0100

    Add gir_namespace and gir_version attributes, fixes bug #666208
    
    Currently they are specified in assemblyinfo.vala which needs to be
    first file passed to vala. See bug # 666478 for details.

commit 472ab29f4c757c7dbfd7c24368f31b3423508384
Author: Maciej Piechotka <uzytkownik2@gmail.com>
Date:   Mon Dec 19 03:26:37 2011 +0100

    Add gir_namespace and gir_version attributes, fixes bug #666208
    
    Currently they are specified in assemblyinfo.vala which needs to be
    first file passed to vala. See bug # 666478 for details.
Comment 7 Colin Walters 2012-01-20 16:00:35 UTC
So this commit landed on the 0.6 branch, but the GIR version there should actually be 1.0, right?
Comment 8 Maciej (Matthew) Piechotka 2012-01-20 16:26:15 UTC
Good spot

commit 3f5b960694867a005a0f4f4f09375b846bcc59ed
Author: Maciej Piechotka <uzytkownik2@gmail.com>
Date:   Fri Jan 20 16:24:51 2012 +0000

    Fix gir_namespace and gir_version attributes, fixes bug #666208