Difficulties compiling Vala

I am trying out Vala with the intent to maybe develop an applet for UB.

Everything is still at a very initial state and I am working myself though the vala tuts here.

I am using VS Code (don’t know if this is the best tool), and compiling works ok when I use GTK2 with the command

valac --pkg gtk+-2.0 gtk-hello.vala

But when use GTK3

valac --pkg gtk+-3.0 gtk-hello.vala

I am getting the error

gtk-hello.vala.c:7:10: fatal error: gtk/gtk.h: No such file or directory #include <gtk/gtk.h> #include <gtk/gtk.h>

The vala documentation on the net is scarce, and what I found to solve the issue was installing the libgtk-3-dev library, with:

sudo apt-get install libgtk3.0-dev

But that returns:

Reading state information... Done
Package libgtk-3-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'libgtk-3-dev' has no installation candidate

How do I solve this?

Have you enabled “sources” in the updater-settings? Dont forget to fully update after enabling

oops - noticed a slight typo in the package name

sudo apt install libgtk-3-dev

Tried that package name with the same result :

 Reading package lists... Done
 Building dependency tree       
 Reading state information... Done
 Package libgtk-3-dev is not available, but is referred to by another package.
 This may mean that the package is missing, has been obsoleted, or is 
 only available from another source

 E: Package 'libgtk-3-dev' has no installation candidate

I’m having trouble to find that option …

its on the Ubuntu Software tab.

weird!

Can I please see the full output of:

sudo apt update
sudo apt upgrade
sudo apt install libgtk-3-dev

Sure, thanks for your help :

sudo apt update

Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://ppa.launchpad.net/oguzhaninan/stacer/ubuntu disco InRelease
Hit:3 http://archive.ubuntu.com/ubuntu disco InRelease
Hit:4 http://dl.google.com/linux/chrome/deb stable Release
Hit:5 http://shop.softmaker.com/repo/apt wheezy InRelease
Hit:6 http://archive.ubuntu.com/ubuntu disco-updates InRelease
Hit:7 http://ppa.launchpad.net/tista/plata-theme/ubuntu disco InRelease
Hit:8 http://archive.ubuntu.com/ubuntu disco-backports InRelease
Hit:9 https://deb.torproject.org/torproject.org bionic InRelease
Hit:10 http://archive.ubuntu.com/ubuntu disco-security InRelease
Hit:12 http://ppa.launchpad.net/ubuntubudgie-dev/desktop-icons/ubuntu disco InRelease
Hit:13 http://ppa.launchpad.net/ubuntubudgie/backports/ubuntu disco InRelease
Hit:14 http://ppa.launchpad.net/vala-team/ppa/ubuntu disco InRelease
Reading package lists… Done
Building dependency tree
Reading state information… Done
1 package can be upgraded. Run ‘apt list --upgradable’ to see it.

*********

apt list --upgradable -a

Listing… Done
libreoffice-style-sifr/disco-updates,disco-updates,disco-security,disco-security 1:6.2.6-0ubuntu0.19.04.1 all [upgradable from: 1:6.2.5-0ubuntu0.19.04.1]
N: There are 2 additional versions. Please use the ‘-a’ switch to see them.
rainer@rainer:~$ apt list --upgradable -a
Listing… Done
libreoffice-style-sifr/disco-updates,disco-updates,disco-security,disco-security 1:6.2.6-0ubuntu0.19.04.1 all [upgradable from: 1:6.2.5-0ubuntu0.19.04.1]
libreoffice-style-sifr/now 1:6.2.5-0ubuntu0.19.04.1 all [installed,upgradable to: 1:6.2.6-0ubuntu0.19.04.1]
libreoffice-style-sifr/disco,disco 1:6.2.2-0ubuntu2 all

*********

sudo apt upgrade

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


*********

sudo apt install libgtk-3-dev

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libgtk-3-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libgtk-3-dev' has no installation candidate

odd - have you got the main repo ticked on the software & updates tab?

That’s how the tab looks now : the top box (main) wasn’t checked.

I don’t know if I unchecked the box accidentally, or if it was unchecked from the beginning.

After checking “main”, the system went through a whole lot of updates and upgrades, and installed
libgtk-3-dev successfully.

Now vala compiles GTK3 without a problem.

Thanks for your swift help, David.

1 Like