Use system level dependencies during Snap build

Hello I have few build dependencies in a part. Whenever I build my C library using make it links all the dependency paths from ~/parts/part_name/install/usr/lib/x86_64-linux-gnu/* but all of my build dependencies are installed in /usr/lib/x86_64-linux-gnu/*. Due to this I am getting dependency issues during Snapcraft override-build. How do I make sure /usr/lib/x86_64-linux-gnu/* path is used during Snapcraft override-build?

Specifically is missing in ~/parts/part_name/install/lib/x86_64-linux-gnu/ (the path used by Snapcraft during override-build) but present inside /usr/lib/x86_64-linux-gnu/. I checked with dpkg -L and the build dependencies are all getting installed at /usr/lib/* but during build time Snapcraft only uses header files from ~/parts/part_name/install/lib/x86_64-linux-gnu/ which I found out from the Makefile generated by configure script.

Turns out Snapcraft overrides env variables like CXXFLAGS and LDFLAGS on its own to set -isystem directories. Resetting them fixed the issue.

1 Like