Skip to content

How to build

Yancey Wang edited this page Jan 26, 2022 · 12 revisions

Native build (non-cross build)

install build tools

for linux (debian)
sudo apt-get install build-essential
for linux (centos)
sudo yum groupinstall 'Development Tools'
for mac
brew install gcc
for bsd
pkg install lang/gcc49
ln -s /usr/local/bin/g++49 /usr/local/bin/g++
for windows

install cygwin + gcc or msys2+mingw-w32/mingw-w64 .

It cant be done in a single command, so you have to use google for help.

note

Install mingw-w32/mingw-w64 compiler inside cywin is also supposed to work, but it is not tested.

get the code

git clone https://github.com/wangyu-/UDPspeeder.git
cd UDPspeeder

build

for linux
make
for mac
make mac
for freebsd
make freebsd
for windows (cygwin)
make cygwin
for windows (mingw-w64/mingw-w32 + msys2)
to build a normal version
make mingw
to build the special wepoll verion:

build and install this special pached libev first: https://github.com/wangyu-/files/files/2119317/libev-mingw-with-wepoll.zip (this file was from here, with a few modifications)

then run:

make mingw_wepoll

cross build for specific target

Currently, only targets for linux cross build are provided. If you want to cross build for windows/mac/bsd, you have to take a look at the makefile and help yourself.

download cross compile tool chain

find it on downloads.openwrt.org according to your openwrt version and cpu model.

for example, my tplink wdr4310 runs chaos_calmer 15.05,its with ar71xx cpu,download the following package.

http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/OpenWrt-SDK-15.05-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2

unzip it to any dir,such as :/home/wangyu/OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2

cd into staging_dir ,toolchain-xxxxx ,bin .find the soft link with g++ suffix. in my case ,its mips-openwrt-linux-g++ ,check for its full path:

/home/wangyu/Desktop/OpenWrt-SDK-15.05-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-g++
compile

modify first line of makefile to:

cc_cross=/home/wangyu/Desktop/OpenWrt-SDK-15.05-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-g++

run make cross,the just generated tinymapper_cross is the binary,compile done. copy it to your router to run.

make cross generates non-static binary. If you have any problem on running it,try to compile a static binary by using make cross2 or make cross3.If your toolchain supports static compiling, usually one of them will succeed. The generated file is still named tinymapper_cross.

Build a full release (include all binaries supported in the makefile)

  1. make sure your linux is amd64 version

  2. clone the repo

  3. download toolchains from https://github.com/wangyu-/files/releases/tag/toolchains_backup, and extract them to the right position (according to the makefile)

  4. if you want to build windows binary as well, install i686-w64-mingw32-g++-posix (on ubuntu 18 or 20 it can be done by just apt install mingw-w64)

  5. if you want to build mac binary as well, install https://github.com/tpoechtrager/osxcross (as known as o64-clang++ in the makefile)

  6. run make release