主页 > 路由器 > 交叉编译最新版本shadowsocks for ARM

交叉编译最新版本shadowsocks for ARM

2017年11月23日 交叉编译最新版本shadowsocks for ARM有1条评论 阅读: 1,533 次

配置环境变量
export PATH=$PATH:/opt/ac1200g/asuswrt/release/src-rt-9.x/src/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/bin
export STAGING_DIR=/opt/ac1200g/asuswrt/release/src-rt-9.x/src/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/ac1200g/asuswrt/release/src-rt-9.x/src/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/lib
export CC=arm-uclibc-linux-2.6.36-gcc
export CXX=arm-uclibc-linux-2.6.36-g++
export AR=arm-uclibc-linux-2.6.36-ar
export RANLIB=arm-uclibc-linux-2.6.36-ranlib
编译根目录
/home/yushi/ss
编译后存放位置
/home/yushi/ss/oss
最后编译文件在:
/home/yushi/ss/oss/shadowsocks-libev/bin

1、编译 libsodium
ver=1.0.12
wget --no-check-certificate https://download.libsodium.org/libsodium/releases/libsodium-$ver.tar.gz
tar zxf libsodium-$ver.tar.gz
cd libsodium-$ver
./configure --host=arm-linux --prefix=/home/yushi/ss/oss/libsodium --disable-ssp --disable-shared
make && make install

2、编译 libev

ver=4.24
wget http://dist.schmorp.de/libev/libev-$ver.tar.gz
tar zxf libev-$ver.tar.gz
cd libev-$ver
./configure --host=arm-linux --prefix=/home/yushi/ss/oss/libev --disable-shared
make && make install

3、编译 libudns

git clone https://github.com/shadowsocks/libudns
cd libudns
./autogen.sh
./configure --host=arm-linux --prefix=/home/yushi/ss/oss/libudns
make && make install

4、编译 pcre

ver=8.40
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-$ver.tar.gz
tar zxf pcre-$ver.tar.gz
cd pcre-$ver
./configure --host=arm-linux --prefix=/home/yushi/ss/oss/pcre --disable-shared --enable-utf8 --enable-unicode-properties
make && make install

5、编译 mbedTLS

ver=2.4.0
wget --no-check-certificate https://tls.mbed.org/download/mbedtls-$ver-gpl.tgz
tar zxf mbedtls-$ver-gpl.tgz
cd mbedtls-$ver
sed -i "s/DESTDIR=\/usr\/local/DESTDIR=\/home\/yushi\/ss\/oss\/mbedtls/g" Makefile
CC=arm-linux-gcc AR=arm-linux-ar LD=arm-linux-ld LDFLAGS=-static make install

6、编译c-ares
wget --no-check-certificate https://c-ares.haxx.se/download/c-ares-1.13.0.tar.gz
tar -xzvf c-ares-1.13.0.tar.gz
cd c-ares-1.13.0
./configure LDFLAGS=-static --host=arm-linux-gnueabi --prefix=/home/yushi/ss/oss/ares
make && make install

7、编译 shadowsocks-libev

ver=3.0.2
git clone https://github.com/shadowsocks/shadowsocks-libev
cd shadowsocks-libev
git submodule update --init --recursive
./autogen.sh
LIBS="-lpthread -lm" LDFLAGS="-Wl,-static -static -static-libgcc -L/home/yushi/ss/oss/ares/lib -L/home/yushi/ss/oss/libudns/lib -L/home/yushi/ss/oss/libev/lib" CFLAGS="-I/home/yushi/ss/oss/libudns/include -I/home/yushi/ss/oss/libev/include -I/home/yushi/ss/oss/ares/include" ./configure --host=arm-linux --prefix=/home/yushi/ss/oss/shadowsocks-libev --disable-ssp --disable-documentation --with-mbedtls=/home/yushi/ss/oss/mbedtls --with-pcre=/home/yushi/ss/oss/pcre --with-sodium=/home/yushi/ss/oss/libsodium
make && make install

8、编译 simple-obfs
ver=0.0.2
git clone https://github.com/shadowsocks/simple-obfs
cd simple-obfs
git checkout v$ver -b v$ver
git submodule init && git submodule update
./autogen.sh
LIBS="-lpthread -lm" LDFLAGS="-Wl,-static -static -static-libgcc -L/home/yushi/ss/oss/libsodium/lib -L/home/yushi/ss/oss/libudns/lib -L/home/yushi/ss/oss/libev/lib" CFLAGS="-I/home/yushi/ss/oss/libsodium/include -I/home/yushi/ss/oss/libudns/include -I/home/yushi/ss/oss/libev/include" ./configure --host=arm-linux --prefix=/home/yushi/ss/oss/shadowsocks-libev --disable-ssp --disable-documentation
make && make install

9、压缩
find /home/yushi/ss/oss/shadowsocks-libev/bin ! -name 'ss-nat' -type f | xargs arm-uclibc-strip
find /home/yushi/ss/oss/shadowsocks-libev/bin ! -name 'ss-nat' -type f | xargs upx

评论:1

  1. jason 回复
    2017年12月2日 于 下午2:55

    Where should I do this cross compile? Is it in ddwrt enviroment?

发表评论

电子邮件地址不会被公开。 必填项已用*标注