Discussion:
[Winpcap-users] Error when cross compiling rpcapd in winpcap for mips using crosstools-ng 1.22
Han Jiang
2015-12-14 07:01:02 UTC
Permalink
Hi I was trying to cross compile rpcapd and use on my asus rt-n16 router (
tomato shibby v132 firmware). I followed the tutorial on their official
website.

https://www.winpcap.org/docs/docs_40_2/html/group__remote.html#UNIX

I successfully build my toolchain with crosstools-ng 1.22, ( it works I
compiled some programs to run on my router, ) , but When I compile rpcapd ,
it errors out at this macro definition.

it's in winpcap/wpcap/libpcap/pcap-int.h


#ifndef HAVE_STRLCPY
#define strlcpy(x, y, z) \
(strncpy((x), (y), (z)), \
((z) <= 0 ? 0 : ((x)[(z) - 1] = '\0')), \
strlen((y)))
#endif

the same code compiles fine under linux ( centos 7.0)

the error message is


[***@t450s rpcapd]$ make
mipsel-unknown-linux-uclibc-gcc -pthread -DHAVE_REMOTE -DHAVE_SNPRINTF
-I../ -c daemon.c
In file included from daemon.c:34:0:
../pcap-int.h:452:12: error: expected declaration specifiers or '...'
before '(' token
(wstrncpy((x), (y), (z)), ((z) <= 0 ? 0 : ((x)[(z) - 1] = '\0')),
strlen((y)))
^
../pcap-int.h:452:17: error: expected declaration specifiers or '...'
before '(' token
(wstrncpy((x), (y), (z)), ((z) <= 0 ? 0 : ((x)[(z) - 1] = '\0')),
strlen((y)))
^
../pcap-int.h:452:22: error: expected declaration specifiers or '...'
before '(' token
(wstrncpy((x), (y), (z)), ((z) <= 0 ? 0 : ((x)[(z) - 1] = '\0')),
strlen((y)))
^
../pcap-int.h:452:26: error: expected ')' before ',' token
(wstrncpy((x), (y), (z)), ((z) <= 0 ? 0 : ((x)[(z) - 1] = '\0')),
strlen((y)))
^
daemon.c: In function 'daemon_AuthUserPwd':
daemon.c:684:39: warning: implicit declaration of function 'crypt'
[-Wimplicit-function-declaration]
if (strcmp(usersp->sp_pwdp, (char *) crypt(password, usersp->sp_pwdp) )
!= 0)
^
make: *** [daemon.o] Error 1


my configure for libpcap is

CC=mipsel-unknown-linux-uclibc-gcc CXX=mipsel-unknown-linux-uclibc-g++
AR=mipsel-unknown-linux-uclibc-ar RANLIB=mipsel-unknown-linux-uclibc-ranlib
ac_cv_linux_vers=2 ./configure --prefix=$TARGET_DIR
--host=mipsel-uclibc-linux --with-pcap=linux

and it compiles fine.

How can I get rid of the macro error ? Thanks!

Loading...