The shadowsocks-libev in repo entware-ng is several versions behind the current release version on github. The latest 2.5.6 comes with fixes and new improvements. One feature, which I like the most, is the attack detection improvement. Since there is no ready-made compiled version I can find for DS116, so I decide to compile the package.
- To start with, we need a Linux based build environment. In the past, I have built an ubuntu server based build VM using vagrant. I will continue to use that VM for this purpose. Make sure the VM has build-tools installed. For ubuntu, do following to install the bulild-essential:
sudo apt-get install build-essential autoconf libtool
- Download the Synology toolchain for DS116 from here. Untar and copy the extracted files to the VM. Setup the extracted bin folder so it is in the execution path, if not, set it up.
export PATH=/<toolchain_path>/bin:$PATH
- Before we can compile the shadowsocks-libev, we need to compile its dependent libraries. Following is the full compile command trace:
# zlib wget http://zlib.net/zlib-1.2.8.tar.gz tar xzvf zlib-1.2.8.tar.gz cd zlib-1.2.8 CC=arm-unknown-linux-gnueabi-gcc CXX=arm-unknown-linux-gnueabi-g++ AR=arm-unknown-linux-gnueabi-ar RANLIB=arm-unknown-linux-gnueabi-ranlib ./configure --prefix=/vagrant/Works/build/zlib make && make install # openssl wget https://github.com/openssl/openssl/archive/OpenSSL_1_0_2j.tar.gz tar xzvf OpenSSL_1_0_2j.tar.gz cd openssl-OpenSSL_1_0_2j CC=arm-unknown-linux-gnueabi-gcc CXX=arm-unknown-linux-gnueabi-g++ AR=arm-unknown-linux-gnueabi-ar RANLIB=arm-unknown-linux-gnueabi-ranlib ./Configure no-asm shared --prefix=/vagrant/Works/build/openssl linux-armv4 make && make install # pcre wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.bz2 tar xjvf pcre-8.39.tar.bz2 cd pcre-8.39 CC=arm-unknown-linux-gnueabi-gcc CXX=arm-unknown-linux-gnueabi-g++ AR=arm-unknown-linux-gnueabi-ar RANLIB=arm-unknown-linux-gnueabi-ranlib ./configure --prefix=/vagrant/Works/build/pcre --host=arm-linux-gnueabi make && make install # shadowsocks wget https://github.com/shadowsocks/shadowsocks-libev/archive/v2.5.6.tar.gz tar xzvf v2.5.6.tar.gz cd shadowsocks-libev-2.5.6 CC=arm-unknown-linux-gnueabi-gcc CXX=arm-unknown-linux-gnueabi-g++ AR=arm-unknown-linux-gnueabi-ar RANLIB=arm-unknown-linux-gnueabi-ranlib ./configure --disable-ssp --disable-documentation --prefix=/vagrant/Works/build/ss --host=arm-linux-gnueabi --with-openssl=/vagrant/Works/build/openssl --with-zlib=/vagrant/Works/build/zlib --with-pcre=/vagrant/Works/build/pcre make && make install
- After successfully compiled the files, we just need to copy the resulting shadowsocks executables in the /vagrant/Works/build/ss/bin directory to DS116 /opt/bin to replace the existing files. Before we do that, we need to stop the running shadowsocks and restart it after the replacement. Check on the log, verify everything works. For detail on configuring the Shadowsocks, please refer to the previous post.
Resources: