Could not compile dependency :vintage_net_wifi

I am working through the “Build a Weather Station…” book by Koutmos, Tate & Hunleth and have run into a problem. Everything was working fine. I could ssh to the Pi Zero over WiFi. I got to the part to add a single line {:circuits_i2c, "~> 0.3.8"}, to mix.exs. When I ran the mix deps.get command after that I got and error (seen in the Topic line above). It told me:

==> vintage_net_wifi
Package libnl-genl-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libnl-genl-3.0.pc'
to the PKG_CONFIG_PATH environment variable

Previously the vintage_net_wifi module compiled. I removed the {:circuits_i2c, "~> 0.3.8"} from mix.exs and I still get the same error. I am on Ubuntu 22.04, Elixir 1.17.2, OTP 27 and Nerves 1.11.1. Very frustrating since it had been compiling the vintage_net_wifi module without a problem previous to the change in mix.exs. I have no idea where to get the libnl-genl-3.0 package. Anyone have any suggestions? Thanks

Have you set your MIX_TARGET in your shell session?

2 Likes

OMG. That was it. So simple - yet not. I thought I was still working in the same shell that I set everything up in in the first place where I had exported the MIX_TARGET. I guess I wasn’t.
How did you figure that out? Nothing in the error messages seemed to point to the target not being exported and that was the only module that didn’t compile.
Thanks so much!!!

Since pkg-config was suddenly failing, the only path that could have previously worked was here:

(the # Crosscompiling branch)

Looks like Nerves sets CROSSCOMPILE when MIX_TARGET isn’t :host.