I'm currently learning Vala, and after going through the basics I wanted to do an actual small project to make it more fun. For this, I thought creating a scope for Unity would be perfect (in this case, a Scope for the Music lens to search MPD).

However, documentation on doing something like this is sparse. Therefore, I hope to be able to put together a tutorial on writing a scope in Vala by first going through it myself with the help of Ask Ubuntu.

What I'm currently stuck on, is how to compile my scope in such a way that I can use Unity's library. I've installed libunity-dev (was this necessary?), however, when I try to compile it, I get the following error:

$ valac --pkg libunity ./unity-scope-mpd.vala
error: Package `libunity' not found in specified Vala API directories or GObject-Introspection GIR directories
Compilation failed: 1 error(s), 0 warning(s)

(Note: I have experience in programming in Java and PHP, but haven't done large projects in the former, so please take that into account in an answer.)



 dpkg -L libunity-dev

shows that the vapi file is actually called unity.vapi. Have you tried

valac --pkg unity ./unity-scope-mpd.vala


In general, the package name should be equal to the pkg-config name. You can do a ls /usr/lib/pkgconfig to see that there's a unity.pc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.