Background (AKA what I'm really trying to achieve): I am trying to compile a working version of linux-rpcapd (a linux port of WinPcap's Remote Packet CAPture Daemon) for my OpenWRT router (TP-LINK TL-WR941ND, mips, ar71xx).
I have followed the howto, successfully built the toolchain, got a working environment and compiled several working test programs (including a small program that uses functions from string.h). however, when I attempt to compile rpcapd:
kanop@foo:~/md$ STAGING_DIR=/media/casper-rw/openwrt/buildroot/trunk/staging_dir
kanop@foo:~/md$ export STAGING_DIR
kanop@foo:~/md$ PATH=$PATH:/media/casper-rw/openwrt/buildroot/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin
kanop@foo:~/md$ export PATH
kanop@foo:~/md$ make CC=mips-openwrt-linux-uclibc-gcc LD=mips-openwrt-linux-uclibc-ld
mips-openwrt-linux-uclibc-gcc -pthread -D_DEBUG -g -Wall -DHAVE_REMOTE -DHAVE_SNPRINTF -static -Ilibpcap/ -c daemon.c
In file included from daemon.c:37:0:
/media/casper-rw/openwrt/buildroot/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/sys-include/string.h:451:15: error: expected declaration specifiers or '...' before '(' token
/media/casper-rw/openwrt/buildroot/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/sys-include/string.h:451:15: error: expected declaration specifiers or '...' before '(' token
/media/casper-rw/openwrt/buildroot/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/sys-include/string.h:451:15: error: expected declaration specifiers or '...' before '(' token
/media/casper-rw/openwrt/buildroot/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/sys-include/string.h:451:15: error: expected ')' before ',' token
daemon.c: In function 'daemon_AuthUserPwd':
daemon.c:684:2: warning: implicit declaration of function 'crypt' [-Wimplicit-function-declaration]
daemon.c: In function 'daemon_startcapture':
daemon.c:1070:2: warning: pointer targets in passing argument 3 of 'daemon_unpackapplyfilter' differ in signedness [-Wpointer-sign]
daemon.c:68:5: note: expected 'int *' but argument is of type 'uint32 *'
daemon.c: In function 'daemon_updatefilter':
daemon.c:1270:2: warning: pointer targets in passing argument 3 of 'daemon_unpackapplyfilter' differ in signedness [-Wpointer-sign]
daemon.c:1199:5: note: expected 'int *' but argument is of type 'uint32 *'
make: *** [daemon.o] Error 1
I should mention the same code compiles flawlessly under Ubuntu (gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)).
I have also tried the other gcc binary (which seems to be the same version anyway), mips-openwrt-linux-uclibc-gcc-4.6.3, but the results have not changed.
Update:
I have worked around the issue by making a local copy and commenting lines 451-452 in string.h:
extern size_t strlcpy(char *__restrict dst, const char *__restrict src,
size_t n) __THROW __nonnull ((1, 2));
I still get more trouble though. I found out that WinPcap's libpcap fork needs to be compiled seperately and then rpcapd should get linked with it. I followed the same procedure and got a missing header:
mips-openwrt-linux-uclibc-gcc -static -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -DHAVE_REMOTE -c ./pcap-linux.c
mips-openwrt-linux-uclibc-gcc -static -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -DHAVE_REMOTE -c ./pcap-usb-linux.c
mips-openwrt-linux-uclibc-gcc -static -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -DHAVE_REMOTE -c ./pcap-bt-linux.c
./pcap-bt-linux.c:60:33: fatal error: bluetooth/bluetooth.h: No such file or directory
compilation terminated.
make: *** [pcap-bt-linux.o] Error 1
(Last edited by kanop on 11 Oct 2012, 12:31)