Search code examples
compiler-errorsvalalibsoup

Vala Compiler Cannot find soup.h from Library Libsoup 2.4


When i am compiling my program, i always get this error:

fatal error: 'libsoup/soup.h' file not found

The Compile command i am using is:

valac --pkg glib-2.0 --pkg libsoup-2.4 Main.vala

My OS is MacOS Sierra 10.12 and when i look into the Vala API Folder, there is a libsoup-2.4 file at: /opt/local/share/vala-0.36/vapi And i have no idea from where this issue is coming. I already searched on google without success. Notice the code is just the sample code for vala from: https://wiki.gnome.org/Projects/Vala/LibSoupSample


Solution

  • You need to install libsoup; only the Vala bindings (libsoup-2.4.vapi) come with Vala, not the library itself or the development headers.

    Notice that the error mentions libsoup/soup.h (a C header) being missing, not libsoup-2.4.vapi; it's actually coming from the C compiler, not the Vala compiler (Vala is transpiled to C, not compiled directly to machine code).