puxxustc / sans

A simple anti-spoofing DNS server
GNU General Public License v3.0
24 stars 8 forks source link

tomato交叉编译问题 #11

Closed houzi- closed 8 years ago

houzi- commented 9 years ago

您好!打扰了! 使用mipsel toolchain编译出现以下状况: houzi@houzi-Lenovo-V3000:~/sans$ --prefix=/usr/ --sysconfdir=/etc bash: --prefix=/usr/: 没有那个文件或目录 houzi@houzi-Lenovo-V3000:~/sans$ --prefix='/usr' --sysconfdir=/etc bash: --prefix=/usr: 没有那个文件或目录 houzi@houzi-Lenovo-V3000:~/sans$ make make all-recursive make[1]: 正在进入目录 /home/houzi/sans' Making all in src make[2]: 正在进入目录/home/houzi/sans/src' gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -pipe -fno-strict-aliasing -Wall -W -Wshadow -Wwrite-strings -Wcast-qual -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c mv -f .deps/main.Tpo .deps/main.Po gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -pipe -fno-strict-aliasing -Wall -W -Wshadow -Wwrite-strings -Wcast-qual -g -O2 -MT async_connect.o -MD -MP -MF .deps/async_connect.Tpo -c -o async_connect.o async_connect.c async_connect.c: In function ‘socks5_send_cb’: async_connect.c:298:32: warning: cast discards ‘attribute((const))’ qualifier from pointer target type [-Wcast-qual] memcpy(buf + 4, &(((struct sockaddrin )ctx->addr)->sin_addr), 4); ^ async_connect.c:299:32: warning: cast discards ‘attribute((const))’ qualifier from pointer target type [-Wcast-qual] memcpy(buf + 8, &(((struct sockaddr_in )ctx->addr)->sin_port), 2); ^ async_connect.c:305:32: warning: cast discards ‘attribute((const))’ qualifier from pointer target type [-Wcast-qual] memcpy(buf + 4, &(((struct sockaddr_in6 )ctx->addr)->sin6_addr), 16); ^ async_connect.c:306:33: warning: cast discards ‘attribute((const))’ qualifier from pointer target type [-Wcast-qual] memcpy(buf + 20, &(((struct sockaddr_in6 )ctx->addr)->sin6_port), 2); ^ mv -f .deps/async_connect.Tpo .deps/async_connect.Po gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -pipe -fno-strict-aliasing -Wall -W -Wshadow -Wwrite-strings -Wcast-qual -g -O2 -MT cache.o -MD -MP -MF .deps/cache.Tpo -c -o cache.o cache.c mv -f .deps/cache.Tpo .deps/cache.Po gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -pipe -fno-strict-aliasing -Wall -W -Wshadow -Wwrite-strings -Wcast-qual -g -O2 -MT conf.o -MD -MP -MF .deps/conf.Tpo -c -o conf.o conf.c mv -f .deps/conf.Tpo .deps/conf.Po gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -pipe -fno-strict-aliasing -Wall -W -Wshadow -Wwrite-strings -Wcast-qual -g -O2 -MT dns.o -MD -MP -MF .deps/dns.Tpo -c -o dns.o dns.c dns.c: In function ‘ns_mkquery’: dns.c:157:26: warning: to be safe all intermediate pointers in cast from ‘u_char _’ to ‘const uchar *’ must be ‘const’ qualified [-Wcast-qual](const u_char )dnptrs, ^ dns.c:158:26: warning: to be safe all intermediate pointers in cast from ‘uchar *’ to ‘const uchar *’ must be ‘const’ qualified [-Wcast-qual](const u_char )lastdnptr); ^ mv -f .deps/dns.Tpo .deps/dns.Po gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -pipe -fno-strict-aliasing -Wall -W -Wshadow -Wwrite-strings -Wcast-qual -g -O2 -MT dnsmsg.o -MD -MP -MF .deps/dnsmsg.Tpo -c -o dnsmsg.o dnsmsg.c mv -f .deps/dnsmsg.Tpo .deps/dnsmsg.Po gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -pipe -fno-strict-aliasing -Wall -W -Wshadow -Wwrite-strings -Wcast-qual -g -O2 -MT event.o -MD -MP -MF .deps/event.Tpo -c -o event.o event.c mv -f .deps/event.Tpo .deps/event.Po gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -pipe -fno-strict-aliasing -Wall -W -Wshadow -Wwrite-strings -Wcast-qual -g -O2 -MT log.o -MD -MP -MF .deps/log.Tpo -c -o log.o log.c mv -f .deps/log.Tpo .deps/log.Po gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -pipe -fno-strict-aliasing -Wall -W -Wshadow -Wwrite-strings -Wcast-qual -g -O2 -MT query.o -MD -MP -MF .deps/query.Tpo -c -o query.o query.c mv -f .deps/query.Tpo .deps/query.Po gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -pipe -fno-strict-aliasing -Wall -W -Wshadow -Wwrite-strings -Wcast-qual -g -O2 -MT sans.o -MD -MP -MF .deps/sans.Tpo -c -o sans.o sans.c mv -f .deps/sans.Tpo .deps/sans.Po gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -pipe -fno-strict-aliasing -Wall -W -Wshadow -Wwrite-strings -Wcast-qual -g -O2 -MT utils.o -MD -MP -MF .deps/utils.Tpo -c -o utils.o utils.c mv -f .deps/utils.Tpo .deps/utils.Po gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -pipe -fno-strict-aliasing -Wall -W -Wshadow -Wwrite-strings -Wcast-qual -g -O2 -MT resolv.o -MD -MP -MF .deps/resolv.Tpo -c -o resolv.o resolv.c resolv.c: In function ‘dn_comp’: resolv.c:1259:29: warning: to be safe all intermediate pointers in cast from ‘uchar *’ to ‘const uchar *’ must be ‘const’ qualified [-Wcast-qual](const u_char *)dnptrs, ^ resolv.c:1260:29: warning: to be safe all intermediate pointers in cast from ‘u_char _’ to ‘const u_char ’ must be ‘const’ qualified [-Wcast-qual](const u_char )lastdnptr); ^ mv -f .deps/resolv.Tpo .deps/resolv.Po /bin/bash ../libtool --tag=CC --mode=link gcc -std=gnu99 -pipe -fno-strict-aliasing -Wall -W -Wshadow -Wwrite-strings -Wcast-qual -g -O2 -static -o sans main.o async_connect.o cache.o conf.o dns.o dnsmsg.o event.o log.o query.o sans.o utils.o resolv.o
libtool: link: gcc -std=gnu99 -pipe -fno-strict-aliasing -Wall -W -Wshadow -Wwrite-strings -Wcast-qual -g -O2 -o sans main.o async_connect.o cache.o conf.o dns.o dnsmsg.o event.o log.o query.o sans.o utils.o resolv.o make[2]:正在离开目录 /home/houzi/sans/src' make[2]: 正在进入目录/home/houzi/sans' make[2]:正在离开目录 /home/houzi/sans' make[1]:正在离开目录/home/houzi/sans' houzi@houzi-Lenovo-V3000:~/sans$

没有生成执行文件和配置文件!

puxxustc commented 9 years ago

交叉编译命令是 ./configure --host=arm-unknown-linux-gnueabihf --prefix=/usr --sysconfdir=/etc,一行,因为太长,README.md 里用了续行符。其实已经编译成功了,可执行文件为 src/sans,配置文件在 sans/contrib/sample 里。

houzi- commented 9 years ago

@XiaoxiaoPu 在tomato mips平台运行上出现以下格式错误:(tomato arm上同样也是如此) root@unknown:/# /opt/usr/sans -V /opt/usr/sans: line 1: syntax error: unexpected end of file (expecting ")") root@unknown:/# /opt/usr/sans --help /opt/usr/sans: line 1: syntax error: unexpected end of file (expecting ")")

puxxustc commented 9 years ago

执行 file /opt/usr/sans 看一下,正确的结果应该是这样的:sans: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked, interpreter /lib/ld-uClibc.so.0, not stripped

houzi- commented 9 years ago

@XiaoxiaoPu 还是一样!

puxxustc commented 9 years ago

file /opt/usr/sans 的结果发一下

puxxustc commented 9 years ago

你把哪个文件复制到路由器了?

houzi- commented 9 years ago

嗯!