How to use `libxml2` headers in a package?

I am trying to build Canon printer driver on my repo for this issue but stuck with missing header.

data_process.c:28:10: fatal error: libxml/parser.h: No such file or directory
 #include <libxml/parser.h>

I found the missing header in (using nix-build '<nixpkgs>' -A and inspect the result-dev directory)

but when I try to use it in the expression capt.nix at line #62 it failed with

/nix/store/7r0yjzdjc2lymjszcxcv220z7hkvzw70-stdenv-linux/setup: line 1338: -I/nix/store/im853gaq498i1pha0lhvzjlylh2sjbwq-libxml2-2.9.9-dev/include/libxml2: No such file or directory


Short story: you are missing quotes around the env var definition, so the include is taken as the executable by bash.

       autoreconf -fi
       LDFLAGS=-L${cndrvcups-common}/usr/lib \
         LIBS='-lpthread -lgdk-x11-2.0 -lgobject-2.0 -lglib-2.0 -latk-1.0 -lgdk_pixbuf-2.0' \
-        CPPFLAGS=-I${cndrvcups-common}/usr/include -I${}/include/libxml2 \
+        CPPFLAGS="-I${cndrvcups-common}/usr/include -I${}/include/libxml2" \
         ./ --prefix=$out/usr --disable-static

Then, I got a bit carried away, with cleanups and fixing the source code for a missing include… All of this can be seen on your repo, at A whole bunch of changes, based on a small initial fix. by layus · Pull Request #2 · wizzup/canon-capt · GitHub

Please ask if anything is unclear in that changeset.


Thank you :heart:, I will continue the process there.