zfl9 / ipt2socks

将 iptables/nftables 传入的透明代理流量转为 socks5 流量的实用工具
GNU Affero General Public License v3.0
447 stars 103 forks source link

在openwrt 19.07.3 sdk下编译错误 #23

Closed j3l11234 closed 4 years ago

j3l11234 commented 4 years ago

在openwrt 19.07.3 sdk下编译错误

make[3]: Entering directory '/data00/home/j3l11234/openwrt/openwrt/package/custom/openwrt-ipt2socks'
rm -f /data00/home/j3l11234/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/ipt2socks/ipt2socks-1.1.2-cfbc2189356aba7fcafb0bc961a95419f313d8a7/.built
touch /data00/home/j3l11234/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/ipt2socks/ipt2socks-1.1.2-cfbc2189356aba7fcafb0bc961a95419f313d8a7/.built_check
CFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -iremap/data00/home/j3l11234/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/ipt2socks/ipt2socks-1.1.2-cfbc2189356aba7fcafb0bc961a95419f313d8a7:ipt2socks-1.1.2-cfbc2189356aba7fcafb0bc961a95419f313d8a7 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/data00/home/j3l11234/openwrt/openwrt/staging_dir/target-mipsel_24kc_musl/usr/include -I/data00/home/j3l11234/openwrt/openwrt/staging_dir/target-mipsel_24kc_musl/include -I/data00/home/j3l11234/openwrt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/usr/include -I/data00/home/j3l11234/openwrt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/include/fortify -I/data00/home/j3l11234/openwrt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/include " CXXFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -iremap/data00/home/j3l11234/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/ipt2socks/ipt2socks-1.1.2-cfbc2189356aba7fcafb0bc961a95419f313d8a7:ipt2socks-1.1.2-cfbc2189356aba7fcafb0bc961a95419f313d8a7 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/data00/home/j3l11234/openwrt/openwrt/staging_dir/target-mipsel_24kc_musl/usr/include -I/data00/home/j3l11234/openwrt/openwrt/staging_dir/target-mipsel_24kc_musl/include -I/data00/home/j3l11234/openwrt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/usr/include -I/data00/home/j3l11234/openwrt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/include/fortify -I/data00/home/j3l11234/openwrt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/include " LDFLAGS="-L/data00/home/j3l11234/openwrt/openwrt/staging_dir/target-mipsel_24kc_musl/usr/lib -L/data00/home/j3l11234/openwrt/openwrt/staging_dir/target-mipsel_24kc_musl/lib -L/data00/home/j3l11234/openwrt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/usr/lib -L/data00/home/j3l11234/openwrt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/lib -znow -zrelro " make  -C /data00/home/j3l11234/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/ipt2socks/ipt2socks-1.1.2-cfbc2189356aba7fcafb0bc961a95419f313d8a7/. AR="mipsel-openwrt-linux-musl-gcc-ar" AS="mipsel-openwrt-linux-musl-gcc -c -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -iremap/data00/home/j3l11234/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/ipt2socks/ipt2socks-1.1.2-cfbc2189356aba7fcafb0bc961a95419f313d8a7:ipt2socks-1.1.2-cfbc2189356aba7fcafb0bc961a95419f313d8a7 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD=mipsel-openwrt-linux-musl-ld NM="mipsel-openwrt-linux-musl-gcc-nm" CC="mipsel-openwrt-linux-musl-gcc" GCC="mipsel-openwrt-linux-musl-gcc" CXX="mipsel-openwrt-linux-musl-g++" RANLIB="mipsel-openwrt-linux-musl-gcc-ranlib" STRIP=mipsel-openwrt-linux-musl-strip OBJCOPY=mipsel-openwrt-linux-musl-objcopy OBJDUMP=mipsel-openwrt-linux-musl-objdump SIZE=mipsel-openwrt-linux-musl-size CROSS="mipsel-openwrt-linux-musl-" ARCH="mipsel" ;
make[4]: Entering directory '/data00/home/j3l11234/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/ipt2socks/ipt2socks-1.1.2-cfbc2189356aba7fcafb0bc961a95419f313d8a7'
mipsel-openwrt-linux-musl-gcc -std=c99 -Wall -Wextra -O3 -pthread -c ipt2socks.c -o ipt2socks.o
cc1: note: someone does not honour COPTS correctly, passed 0 times
ipt2socks.c: In function 'tcp_stream_payload_forward_cb':
ipt2socks.c:729:25: warning: implicit declaration of function 'splice'; did you mean 'pipe'? [-Wimplicit-function-declaration]
         ssize_t nrecv = splice(self_watcher->fd, NULL, self_pipefd[1], NULL, TCP_SPLICE_MAXLEN, SPLICE_F_MOVE | SPLICE_F_NONBLOCK);
                         ^~~~~~
                         pipe
ipt2socks.c:729:97: error: 'SPLICE_F_MOVE' undeclared (first use in this function)
         ssize_t nrecv = splice(self_watcher->fd, NULL, self_pipefd[1], NULL, TCP_SPLICE_MAXLEN, SPLICE_F_MOVE | SPLICE_F_NONBLOCK);
                                                                                                 ^~~~~~~~~~~~~
ipt2socks.c:729:97: note: each undeclared identifier is reported only once for each function it appears in
ipt2socks.c:729:113: error: 'SPLICE_F_NONBLOCK' undeclared (first use in this function); did you mean 'SOCK_NONBLOCK'?
         ssize_t nrecv = splice(self_watcher->fd, NULL, self_pipefd[1], NULL, TCP_SPLICE_MAXLEN, SPLICE_F_MOVE | SPLICE_F_NONBLOCK);
                                                                                                                 ^~~~~~~~~~~~~~~~~
                                                                                                                 SOCK_NONBLOCK
Makefile:28: recipe for target 'ipt2socks.o' failed
make[4]: *** [ipt2socks.o] Error 1
zfl9 commented 4 years ago

22

zfl9 commented 4 years ago

我做个兼容吧。手动选择SPLICE和普通实现方式。

small-5 commented 4 years ago

我做了一个patch,可以编译成功,但未具体测试使用是否正常

001-fix-splice.txt

j3l11234 commented 4 years ago

用了新的 openwrt-ipt2socks之后编译过了,目前看起来是可以正常使用。

zfl9 commented 4 years ago

周末把这个patch合到master。

zfl9 commented 4 years ago

尝试着合并了这个补丁,测了下能正常编译(我只有glibc环境。。)见最新release版本。