Problem compiling C program with libpcap (SDK)

I'm trying to compile a C program (pcap_retrans.c) that uses also another module (cbuffer.c), using the SDK.

I created the following Makefile to compile the program (before the final make that will build the .ipk file) just so I could see if the program has no errors. Thus, I'm trying to achieve the same result as with gcc -o pcap pcap_retrans.c -lpcap cbuffer.c.

path = /home/foo/Desktop/sdk/openwrt-sdk-18.06.4-x86-64_gcc-7.3.0_musl.Linux-x86_64/staging_dir/target-x86_64_musl/usr/lib

path2 = /home/foo/Desktop/sdk/openwrt-sdk-18.06.4-x86-64_gcc-7.3.0_musl.Linux-x86_64/staging_dir/toolchain-x86_64_gcc-7.3.0_musl/lib32
#path2 = /home/foo/Desktop/sdk/openwrt-sdk-18.06.4-x86-64_gcc-7.3.0_musl.Linux-x86_64/staging_dir/target-x86_64_musl/root-x86/lib
#path2 = /home/foo/Desktop/sdk/openwrt-sdk-18.06.4-x86-64_gcc-7.3.0_musl.Linux-x86_64/staging_dir/host/lib

pcap_retrans: pcap_retrans.o cbuffer.o
        $(CC) $(LDFLAGS) -o $@ $^ -L$(path) -lpcap -L$(path2)  -libc

%.o: %.c
        $(CC) -c $(CFLAGS) -o $@ $<

However, when I try to make it always throws this error:

cc  -o pcap_retrans pcap_retrans.o cbuffer.o -L/home/foo/Desktop/sdk/openwrt-sdk-18.06.4-x86-64_gcc-7.3.0_musl.Linux-x86_64/staging_dir/target-x86_64_musl/usr/lib -lpcap - L/home/foo/Desktop/sdk/openwrt-sdk-18.06.4-x86-64_gcc-7.3.0_musl.Linux- x86_64/staging_dir/toolchain-x86_64_gcc-7.3.0_musl/lib32  -libc
/usr/bin/ld: cannot find -libc
collect2: error: ld returned 1 exit status
Makefile:7: recipe for target 'pcap_retrans' failed
make: *** [pcap_retrans] Error 1

I can found libc.so in the 3 path2 variables specified in the Makefile, but everytime I try one of them, it returns this error.
Then, when I make in the root folder of the SDK, no errors occur but the .ipk for my program is nowhere to be found. Help?

Pointing CC and LD to the SDK toolchain should be sufficient. See https://openwrt.org/docs/guide-developer/crosscompile