Cross-compiling and linking to existing .so "no symbol"


I have to cross-compile a simple program for openwrt 15.05.1 ramips, that links against libpcap.
I've downloaded the from the package repo, and the toolchain. Then I do

mipsel-openwrt-linux-gcc udpreplay.c -o udpreplay -Ilibpcap/ -L.

I get undefined reference to all pcap functions.

Then when I do

mipsel-openwrt-linux-nm -D udpreplay/

I get no symbols. How come the toolchain does not recognize its own .so?

I really don't get It.... Any idea?

Ps: exact same thing with openwrt 18.06 and libpcap1.9.1
Ps2: exact same thing if I re-cross-compile the library with the SDK instead of downloading it

I found a workaround; compile libpcap.a with the SDK and compile with linking to this .a. But this bug is very strange.