Giter Site home page Giter Site logo

Comments (14)

return42 avatar return42 commented on July 23, 2024

I can confirm this bug.

from mainline.

 avatar commented on July 23, 2024

The problem is that to_utf8() doesn't exist before valac 0.40.
There's a missing build requirement that I have to add to the debian control file to specify valac >= 0.40 instead of just valac. That way on bionic it wouldn't try to compile, it would just say you need a newer valac first.

I don't know how to write a version of those lines that works both before valac 0.40 and after 0.40. The original code from ukuu worked on bionic, but didn't on disco. For disco, it needed to_utf8(). But to_utf8() doesn't exist on bionic. If you could upgrade valac to 0.40 or later on bionic, it would probably work, but I'm not telling you to do that. I don't even know if it's reasonable.

If bionic is an important target, then I guess we need #ifdefs around those lines to include both the old version and the new version in the file. (ugg)

Or maybe I can just build bionic debs from my disco-or-later system. I'll try that as a stop-gap.

If you don't want to wait for me to get to this, here is what you can do:
Here is the diff where to_utf8() was added. Basically, the red lines are bionic compatible (valac < 0.40 compatible), the green are disco compatible.

257127a#diff-3abbf9a37f435777f8600cb9f69d949a

Or maybe you can upgrade valac. I don't know if packages are available for bionic. That might be easiest if debs exist.

from mainline.

cappelikan avatar cappelikan commented on July 23, 2024

from mainline.

return42 avatar return42 commented on July 23, 2024

The problem is that to_utf8() doesn't exist before valac 0.40.

See my PR #14

from mainline.

 avatar commented on July 23, 2024

That gives me:

src/Gtk/TerminalWindow.vala:207.19-207.40: error: Argument 1: Cannot convert from `string' to `unowned char[]?'
                term.feed_child("%s\n".printf(command), -1);
                                ^^^^^^^^^^^^^^^^^^^^^^
src/Gtk/TerminalWindow.vala:207.3-207.45: error: 1 extra arguments for `void Vte.Terminal.feed_child (char[]?)'
                term.feed_child("%s\n".printf(command), -1);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

from mainline.

 avatar commented on July 23, 2024

So, we either need #ifdefs, or only target newer valac. Or vte, I think there was originally some conditional tests for vte 2.90 vs 2.91 or something like that.

from mainline.

 avatar commented on July 23, 2024

... now that's interesting... I just tried to build for bionic i386 on my own system

I updated debian/control to specify "valac (>= 0.40)"

vte 2.91 was the default version and the package name actually includes the version number so no problem there

And it failed to build the same way as OP. It apparently MET the valac >=0.40 requirement, because it actually tried to compile, and then errored the same way as the OP.

I was expecting either it would build on my system because I have current versions of everything, or it would refuse to try to build until I found a way to add a newer valac package to the bionic-base.tar.gz. I was not expecting it to meet all dependencies and then still fail.

So it means I don't know what is the root cause of this error like I thought I did. It's not simply the valac version. (or else, the debian/control file doesn't work like I think it does, which is entirely possible. I don not claim to be even slightly expert in building .deb packages)

from mainline.

 avatar commented on July 23, 2024

I can't find the doc I read somewhere where I got this idea about valac 0.40 and to_utf8. Maybe that's simply wrong, but I'm sure it was something I got from the online vala docs.

from mainline.

 avatar commented on July 23, 2024

Maybe it's glib? to_utf8 is part of glib.
Excerpted from that bionic build attempt, where pbuilder was adding dependencies to the temp build environment...:

I: new cache content 'libglib2.0-0_2.56.4-0ubuntu0.18.04.4_i386.deb' added
I: new cache content 'libglib2.0-dev_2.56.4-0ubuntu0.18.04.4_i386.deb' added
...
I: new cache content 'libvte-2.91-0_0.52.2-1ubuntu1~18.04.2_i386.deb' added
I: new cache content 'libvte-2.91-dev_0.52.2-1ubuntu1~18.04.2_i386.deb' added
...
I: new cache content 'gir1.2-vte-2.91_0.52.2-1ubuntu1~18.04.2_i386.deb' added
I: new cache content 'gir1.2-glib-2.0_1.56.1-1_i386.deb' added
...
I: new cache content 'libvala-0.40-0_0.40.8-0ubuntu1_i386.deb' added
I: new cache content 'valac_0.40.8-0ubuntu1_i386.deb' added

Meanwhile my native host shows these versions available for glib2.0 / glib2.0-dev, with the top one installed:
2.60.4-0ubuntu0.19.04.1 (disco-updates)
2.60.0-1ubuntu0.1 (disco-security)
2.60.0-1 (disco)
2.58.1-2 (cosmic)

So bionic is getting glib2.0-* 2.56, older than cosmic.
Maybe debian/control needs to say glib-2.0-dev (>= 2.58) ?
At least unless/until we make #ifdefs
I'm trying that now...

from mainline.

 avatar commented on July 23, 2024

Ok the updated debian/control is working. Now when I try to build for bonic I get:

The following packages have unmet dependencies:
 pbuilder-satisfydepends-dummy : Depends: libglib2.0-dev (>= 2.58) but 2.56.4-0ubuntu0.18.04.4 is to be installed
Unable to resolve dependencies!  Giving up...
...
Abort.
E: pbuilder-satisfydepends failed.

Good.

Next we can either figure out how to get a newer glib2.0 in bionic, or put #ifdefs in the code.

Or maybe a bionic host can just install a cosmic deb? Maybe not because if building needs a newer glib2.0-dev, then run-time probably also needs the matching newer glib2.0 since it's not building static.

from mainline.

 avatar commented on July 23, 2024

looks like for #if/#else we can test GLIB_MAJOR_VERSION & GLIB_MINOR_VERSION
https://developer.gnome.org/glib/stable/glib-Version-Information.html

from mainline.

 avatar commented on July 23, 2024

Ugh I really do not like vala...
So, if this were a c file, I should be able to do the following:

#if GLIB_CHECK_VERSION(2,58,0)
    string c = command.concat("\n");
    term.feed_child(c.to_utf8());
#else
    term.feed_child("%s\n".printf(command), -1);
#endif

But, it's not a c file it's a vala file, and the valac preprocessor is much more limited, and this macro which glib provides is not usable from a vala file, as far as I can tell.

https://wiki.gnome.org/Projects/Vala/Manual/Preprocessor

It's not possible to define a preprocessor symbol inside the Vala code (like with C). The only way to define a symbol is to feed it through the valac option -D.

So, I'd have to determine the glib version out in the makefile somehow, so I could add some kind of crappy -DGLIB_IS_2_58_OR_NEWER to the valac command line.

Another possible correct way, normally, would be to test for the feature rather than test for a magic version number. like HAVE_TO_UTF8 or some other way to test if to_utf8() exists. But again, that's dynamic c/c++ preprocessor stuff. Valac doesn't know about it, and so you can't use it in a .vala file. At least as far I can tell so far.

from mainline.

 avatar commented on July 23, 2024

I have an ugly hack in there now that seems to be working. I was able to build both native on current and for bionic. Already pushed, but I'll leave this open until you say it's working for you too.

from mainline.

bkw777 avatar bkw777 commented on July 23, 2024

I assume it worked since you never followed up.

from mainline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.