"Cannot find -libpq" when using cross for cross-compiling

89 Views Asked by At

I'm currently trying to cross-compile a rust application (with diesel and postgres) to Ubuntu from Windows. I ran cross build --target x86_64-unknown-linux-gnu, and everything goes smoothly until the very last step when it gives a nasty error:

error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" P...
... ,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
note: /usr/bin/ld: cannot find -lpq
          collect2: error: ld returned 1 exit status

I'm using docker, and I've tried putting libpq.dll basically everywhere. I also installed libpq-dev and libpq5 on my WSL, yet none of that has worked.

I'm not entirely sure what would be affecting this, as I can't find basically anything about this issue. I cut out the giant wall of text note, since it didn't show anything useful. I know that it can't find the libpq.dll/libpq.so, but I don't know where to put those and how to get libpq.so.

Thanks!

0

There are 0 best solutions below