[[PageOutline]] * [http://wiki.openwrt.org/about/toolchain OpenWrt Buildroot – About - OpenWrt Wiki] * [http://d.hatena.ne.jp/sdkt4a/20080814/1218655463 OpenWrtのクロスコンパイル環境をDebianに構築してhello,worldするよ! - sdkt4aの日記] * [https://wiki.projectmeshnet.org/Build_for_OpenWRT Build for OpenWRT - meshwiki] * [http://d.hatena.ne.jp/nyaxt/20120212#1329014697 FON2100E openwrt backfire 10.03.1用クロスコンパイル環境の構築 2012-02-12 - nyaxtのPC作業ログ] = target system = * /proc/cpuinfo {{{ system type : Atheros AR7161 rev 2 machine : Buffalo WZR-HP-AG300H processor : 0 cpu model : MIPS 24Kc V7.4 BogoMIPS : 452.19 wait instruction : yes microsecond timers : yes tlb_entries : 16 extra interrupt vector : yes hardware watchpoint : yes, count: 4, address/irw mask: [0x0ff8, 0x0ffc, 0x0ff8, 0x0ff8] ASEs implemented : mips16 shadow register sets : 1 kscratch registers : 0 core : 0 VCED exceptions : not available VCEI exceptions : not available }}} == host system type == * mitty@starseed:~$ wget "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" -O config.guess * mitty@starseed:~$ wget "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" -O config.sub * mitty@starseed:~$ chmod +x config.* * mitty@starseed:~$ ./config.guess {{{ ./config.guess: unable to guess system type This script, last modified 2012-06-17, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD and http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD If the version you run (./config.guess) is already up to date, please send the following data and any information you think might be pertinent to in order to provide the needed information to handle your system. config.guess timestamp = 2012-06-17 uname -m = mips uname -r = 3.3.6 uname -s = Linux uname -v = #1 Thu May 17 02:19:20 PDT 2012 /usr/bin/uname -p = /bin/uname -X = hostinfo = /bin/universe = /usr/bin/arch -k = /bin/arch = /usr/bin/oslevel = /usr/convex/getsysinfo = UNAME_MACHINE = mips UNAME_RELEASE = 3.3.6 UNAME_SYSTEM = Linux UNAME_VERSION = #1 Thu May 17 02:19:20 PDT 2012 }}} = buildroot = * Ubuntu 12.04 LTS x86_64 * mitty@precise:~$ sudo aptitude install subversion build-essential libncurses5-dev zlib1g-dev gawk gcc-multilib flex git-core gettext libssl-dev xsltproc bison * mitty@precise:~$ mkdir openwrt * mitty@precise:~/openwrt$ svn co svn://svn.openwrt.org/openwrt/trunk/ {{{ (snip) U trunk Checked out revision 32026. }}} * mitty@precise:~/openwrt/trunk$ wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/config * mitty@precise:~/openwrt$ cp config trunk/.config * mitty@precise:~/openwrt/trunk$ make prereq {{{ Collecting package info: done Collecting target info: done Checking 'working-make'... ok. Checking 'case-sensitive-fs'... ok. Checking 'getopt'... ok. Checking 'fileutils'... ok. Checking 'working-gcc'... ok. Checking 'working-g++'... ok. Checking 'ncurses'... ok. Checking 'zlib'... ok. Checking 'gawk'... ok. Checking 'flex'... ok. Checking 'unzip'... ok. Checking 'bzip2'... ok. Checking 'patch'... ok. Checking 'perl'... ok. Checking 'python'... ok. Checking 'wget'... ok. Checking 'git'... ok. Checking 'gnutar'... ok. Checking 'svn'... ok. Checking 'gnu-find'... ok. Checking 'getopt-extended'... ok. Checking 'non-root'... ok. }}} * mitty@precise:~/openwrt/trunk$ make -j 5 V=99 2>&1 | tee build.log | grep -i error {{{ (snip) make[2]: [package/rootfs-prepare] Error 2 (ignored) Compression errors: 0 [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wpe72.bin.lzma is too big make[5]: [install] Error 1 (ignored) Compression errors: 0 [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wp543.bin.lzma is too big make[5]: [install] Error 1 (ignored) [mkmylofw] Error: file /home/mitty/openwrt/trunk/build_dir/linux-ar71xx_generic/tmp/vmlinux-wpe72.bin.lzma is too big make[5]: [install] Error 1 (ignored) make[3]: [/home/mitty/openwrt/trunk/bin/ar71xx/OpenWrt-ImageBuilder-ar71xx_generic-for-Linux-x86_64.tar.bz2] Error 1 (ignored) make[3]: [/home/mitty/openwrt/trunk/bin/ar71xx/OpenWrt-ImageBuilder-ar71xx_generic-for-Linux-x86_64.tar.bz2] Error 1 (ignored) }}} * mitty@precise:~/openwrt$ cat > test.c {{{#!cc #include int main(void) { printf("char -> %ld\n", sizeof(char)); printf("short -> %ld\n", sizeof(short)); printf("int -> %ld\n", sizeof(int)); printf("long -> %ld\n", sizeof(long)); printf("long long -> %ld\n", sizeof(long long)); printf("float -> %ld\n", sizeof(float)); printf("double -> %ld\n", sizeof(double)); printf("long double -> %ld\n", sizeof(long double)); return 0; } }}} * mitty@precise:~/openwrt$ gcc test.c -o test.x86 * mitty@precise:~/openwrt$ ./trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-gcc test.c -o test {{{ mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined }}} * mitty@precise:~/openwrt$ file test test.x86 {{{ test: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), with unknown capability 0x41000000 = 0xf676e75, with unknown capability 0x10000 = 0x70403, not stripped test.x86: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x53177842cbc614b1f4c71bae24df294892906443, not stripped }}} * mitty@precise:~/openwrt$ ./test.x86 {{{ char -> 1 short -> 2 int -> 4 long -> 8 long long -> 8 float -> 4 double -> 8 long double -> 16 }}} * mitty@precise:~/openwrt$ ./test {{{ bash: ./test: cannot execute binary file }}} * mitty@starseed:~$ uname -a {{{ Linux starseed 3.3.6 #1 Thu May 17 02:19:20 PDT 2012 mips GNU/Linux }}} * mitty@starseed:~$ ./test {{{ char -> 1 short -> 2 int -> 4 long -> 4 long long -> 8 float -> 4 double -> 8 long double -> 8 }}} = build others = == utvpn == * mitty@precise:~/openwrt/trunk/package$ svn co https://lab.mitty.jp/svn/lab/trunk/Dev/utvpn/utvpn-unix-v101-7101-public utvpn * mitty@precise:~/openwrt/trunk/package/utvpn$ ./configure {{{ ------------------------------------------------------------- SoftEther UT-VPN for Unix Copyright (C) 2004-2010 SoftEther Corporation. Copyright (C) 2004-2010 University of Tsukuba, Japan. Copyright (C) 2003-2010 Daiyuu Nobori. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. ------------------------------------------------------------- Please select your Operating System below: 1: Linux 2: FreeBSD 3: Solaris 4: Mac OS X Which is your operating system (1-4): 1 Please select your CPU Bits below: 1: 32-bit 2: 64-bit Which is the bits of your CPU (1-2): 1 Makefile is generated. Please execute 'make' to build UT-VPN. }}} * mitty@precise:~/openwrt/trunk/package/utvpn$ sha1sum Makefile makefiles/linux_32bit_ja.mak {{{ 5d63c1cbb04ef9a3ecc6d4b8f1150cac20fbfa9d Makefile 5d63c1cbb04ef9a3ecc6d4b8f1150cac20fbfa9d makefiles/linux_32bit_ja.mak }}} * Makefileは単純にcpしているだけ * mitty@precise:~/openwrt/trunk/package/utvpn$ svn cp makefiles/linux_32bit_ja.mak Makefile === build with gcc for mips === * mitty@precise:~/openwrt/trunk/package/utvpn$ export PATH=$PATH:~/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/ * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld {{{ mips-openwrt-linux-gcc -DNDEBUG -DVPN_SPEED -DUNIX -DUNIX_LINUX -D_REENTRANT -DREENTRANT -D_THREAD_SAFE -D_THREADSAFE -DTHREAD_SAFE -DTHREADSAFE -I./src/ -I./src/Cedar/ -I./src/Mayaqua/ -O2 -fsigned-char -c src/Mayaqua/Cfg.c -o tmp/objs/Mayaqua/Cfg.o mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined In file included from src/Mayaqua/Cfg.c:90:0: ./src/Mayaqua/Mayaqua.h:219:31: fatal error: readline/readline.h: No such file or directory compilation terminated. make: *** [tmp/objs/Mayaqua/Cfg.o] Error 1 }}} * mitty@precise:~$ sudo aptitude install -R libssl-dev libreadline-dev libncurses-dev * mitty@precise:~/openwrt/trunk/package/utvpn$ export STAGING_DIR=~/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld {{{ (snip) mips-openwrt-linux-gcc tmp/as/Ham.a -O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -o output/ham/ham /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lssl /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lcrypto /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lreadline /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lncurses /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lz collect2: ld returned 1 exit status }}} === rebuild after libraries were installed === * make install [#zlib], [#openssl], [#ncurses] and [#readline] * mitty@precise:~/openwrt/trunk/package/utvpn$ make clean * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld {{{ mips-openwrt-linux-gcc tmp/as/Ham.a -O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -o output/ham/ham tmp/as/Ham.a(Internat.o): In function `IconvWideToStrInternal': Internat.c:(.text+0x634): undefined reference to `iconv_open' Internat.c:(.text+0x648): undefined reference to `iconv_open' tmp/as/Ham.a(Internat.o): In function `IconvStrToWideInternal': Internat.c:(.text+0x66c): undefined reference to `iconv_open' Internat.c:(.text+0x680): undefined reference to `iconv_open' tmp/as/Ham.a(Internat.o): In function `IconvFreeInternal': Internat.c:(.text+0x690): undefined reference to `iconv_close' tmp/as/Ham.a(Internat.o): In function `UnixUniToStr': Internat.c:(.text+0x7b0): undefined reference to `iconv' tmp/as/Ham.a(Internat.o): In function `InitInternational': Internat.c:(.text+0xb68): undefined reference to `iconv_close' Internat.c:(.text+0xbcc): undefined reference to `iconv_close' tmp/as/Ham.a(Internat.o): In function `UnixStrToUni': Internat.c:(.text+0x37e4): undefined reference to `iconv' collect2: ld returned 1 exit status make: *** [output/ham/ham] Error 1 }}} === make install iconv === * mitty@precise:~/openwrt$ wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz * mitty@precise:~/openwrt/libiconv-1.14$ CC=mips-openwrt-linux-gcc ./configure --prefix=$STAGING_DIR --host=mips-openwrt-linux * mitty@precise:~/openwrt/libiconv-1.14$ make * mitty@precise:~/openwrt/libiconv-1.14$ make install * mitty@precise:~/openwrt/trunk/package/utvpn$ make clean * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld {{{ mips-openwrt-linux-gcc tmp/as/Ham.a -O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -o output/ham/ham tmp/as/Ham.a(Internat.o): In function `IconvWideToStrInternal': Internat.c:(.text+0x634): undefined reference to `iconv_open' (snip) }}} === fix source === * mitty@precise:~/openwrt/trunk/package/utvpn$ vim src/Mayaqua/Mayaqua.h {{{#!diff Index: src/Mayaqua/Mayaqua.h =================================================================== --- src/Mayaqua/Mayaqua.h (revision 147) +++ src/Mayaqua/Mayaqua.h (working copy) @@ -221,6 +221,8 @@ //#include #ifdef UNIX_LINUX +#include +/* typedef void *iconv_t; iconv_t iconv_open (__const char *__tocode, __const char *__fromcode); size_t iconv (iconv_t __cd, char **__restrict __inbuf, @@ -228,6 +230,7 @@ char **__restrict __outbuf, size_t *__restrict __outbytesleft); int iconv_close (iconv_t __cd); +*/ #else // UNIX_LINUX #include #endif // UNIX_LINUX }}} * mitty@precise:~/openwrt/trunk/package/utvpn$ vim Makefile {{{#!diff Index: Makefile =================================================================== --- Makefile (revision 147) +++ Makefile (working copy) @@ -27,16 +27,16 @@ OPTIONS_COMPILE_DEBUG=-D_DEBUG -DDEBUG -DUNIX -DUNIX_LINUX -D_REENTRANT -DREENTRANT -D_THREAD_SAFE -D_THREADSAFE -DTHREAD_SAFE -DTHREADSAFE -I./src/ -I./src/Cedar/ -I./src/Mayaqua/ -g -fsigned-char -OPTIONS_LINK_DEBUG=-g -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz +OPTIONS_LINK_DEBUG=-g -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -liconv OPTIONS_COMPILE_RELEASE=-DNDEBUG -DVPN_SPEED -DUNIX -DUNIX_LINUX -D_REENTRANT -DREENTRANT -D_THREAD_SAFE -D_THREADSAFE -DTHREAD_SAFE -DTHREADSAFE -I./src/ -I./src/Cedar/ -I./src/Mayaqua/ -O2 -fsigned-char -OPTIONS_LINK_RELEASE=-O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz +OPTIONS_LINK_RELEASE=-O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -liconv -INSTALL_BINDIR=/usr/bin/ -INSTALL_UTVPNSERVER_DIR=/usr/utvpnserver/ -INSTALL_UTVPNCLIENT_DIR=/usr/utvpnclient/ -INSTALL_UTVPNCMD_DIR=/usr/utvpncmd/ +INSTALL_BINDIR=$(PREFIX)/usr/bin/ +INSTALL_UTVPNSERVER_DIR=$(PREFIX)/usr/utvpnserver/ +INSTALL_UTVPNCLIENT_DIR=$(PREFIX)/usr/utvpnclient/ +INSTALL_UTVPNCMD_DIR=$(PREFIX)/usr/utvpncmd/ ifeq ($(DEBUG),YES) OPTIONS_COMPILE=$(OPTIONS_COMPILE_DEBUG) @@ -307,6 +307,7 @@ @mkdir -p $(INSTALL_UTVPNSERVER_DIR) cp output/utvpnserver/hamcore.utvpn $(INSTALL_UTVPNSERVER_DIR)hamcore.utvpn cp output/utvpnserver/utvpnserver $(INSTALL_UTVPNSERVER_DIR)utvpnserver + @mkdir -p $(INSTALL_BINDIR) echo "#!/bin/sh" > $(INSTALL_BINDIR)utvpnserver echo $(INSTALL_UTVPNSERVER_DIR)utvpnserver '"$$@"' >> $(INSTALL_BINDIR)utvpnserver echo 'exit $$?' >> $(INSTALL_BINDIR)utvpnserver @@ -317,6 +318,7 @@ cp output/utvpnclient/hamcore.utvpn $(INSTALL_UTVPNCLIENT_DIR)hamcore.utvpn cp output/utvpnclient/utvpnclient $(INSTALL_UTVPNCLIENT_DIR)utvpnclient echo "#!/bin/sh" > $(INSTALL_BINDIR)utvpnclient + @mkdir -p $(INSTALL_BINDIR) echo $(INSTALL_UTVPNCLIENT_DIR)utvpnclient '"$$@"' >> $(INSTALL_BINDIR)utvpnclient echo 'exit $$?' >> $(INSTALL_BINDIR)utvpnclient chmod 755 $(INSTALL_BINDIR)utvpnclient @@ -325,6 +327,7 @@ @mkdir -p $(INSTALL_UTVPNCMD_DIR) cp output/utvpncmd/hamcore.utvpn $(INSTALL_UTVPNCMD_DIR)hamcore.utvpn cp output/utvpncmd/utvpncmd $(INSTALL_UTVPNCMD_DIR)utvpncmd + @mkdir -p $(INSTALL_BINDIR) echo "#!/bin/sh" > $(INSTALL_BINDIR)utvpncmd echo $(INSTALL_UTVPNCMD_DIR)utvpncmd '"$$@"' >> $(INSTALL_BINDIR)utvpncmd echo 'exit $$?' >> $(INSTALL_BINDIR)utvpncmd }}} * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld * mitty@precise:~/openwrt/trunk/package/utvpn$ make install PREFIX=~/tmp {{{ cp output/utvpnserver/hamcore.utvpn /home/mitty/tmp/usr/utvpnserver/hamcore.utvpn cp output/utvpnserver/utvpnserver /home/mitty/tmp/usr/utvpnserver/utvpnserver echo "#!/bin/sh" > /home/mitty/tmp/usr/bin/utvpnserver echo /home/mitty/tmp/usr/utvpnserver/utvpnserver '"$@"' >> /home/mitty/tmp/usr/bin/utvpnserver echo 'exit $?' >> /home/mitty/tmp/usr/bin/utvpnserver chmod 755 /home/mitty/tmp/usr/bin/utvpnserver cp output/utvpnclient/hamcore.utvpn /home/mitty/tmp/usr/utvpnclient/hamcore.utvpn cp output/utvpnclient/utvpnclient /home/mitty/tmp/usr/utvpnclient/utvpnclient echo "#!/bin/sh" > /home/mitty/tmp/usr/bin/utvpnclient echo /home/mitty/tmp/usr/utvpnclient/utvpnclient '"$@"' >> /home/mitty/tmp/usr/bin/utvpnclient echo 'exit $?' >> /home/mitty/tmp/usr/bin/utvpnclient chmod 755 /home/mitty/tmp/usr/bin/utvpnclient cp output/utvpncmd/hamcore.utvpn /home/mitty/tmp/usr/utvpncmd/hamcore.utvpn cp output/utvpncmd/utvpncmd /home/mitty/tmp/usr/utvpncmd/utvpncmd echo "#!/bin/sh" > /home/mitty/tmp/usr/bin/utvpncmd echo /home/mitty/tmp/usr/utvpncmd/utvpncmd '"$@"' >> /home/mitty/tmp/usr/bin/utvpncmd echo 'exit $?' >> /home/mitty/tmp/usr/bin/utvpncmd chmod 755 /home/mitty/tmp/usr/bin/utvpncmd -------------------------------------------------------------------- Installation completed successfully. Please execute 'utvpnserver start' to run UT-VPN Server Background Service. Or please execute 'utvpnclient start' to run UT-VPN Client Background Service. And please execute 'utvpncmd' to run UT-VPN Command-Line Utility to configure UT-Server or UT-VPN Client. -------------------------------------------------------------------- }}} * mitty@precise:~$ mv tmp utvpn-unix-v101-7101-public.mips * mitty@precise:~$ tar czf utvpn-unix-v101-7101-public.mips.tar.gz utvpn-unix-v101-7101-public.mips * mitty@starseed:~/utvpn-unix-v101-7101-public.mips/usr/utvpncmd$ ./utvpncmd {{{ Bus error }}} * うまく動かない * [http://wiki.livedoor.jp/taiki_kondo/d/UT-VPN/Debian UT-VPN/Debian - 判ってるよねWiki - livedoor Wiki(ウィキ)] * [http://blog.falconsrv.net/2012/05/ut-vpnubuntu-1204.html Falcon’s Diary: UT-VPNのビルド方法(Ubuntu 12.04)] == zlib == * [http://www.crosscompile.org/static/pages/ZLib.html How to Cross Compile Zlib Compression Library - Step by Step Guide (crosscompile.org)] * mitty@precise:~$ export PATH=$PATH:~/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/ * mitty@precise:~$ export STAGING_DIR=~/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ * mitty@precise:~/openwrt$ wget http://zlib.net/zlib-1.2.7.tar.gz * mitty@precise:~/openwrt/zlib-1.2.7$ ./configure --prefix=$STAGING_DIR * mitty@precise:~/openwrt/zlib-1.2.7$ vim Makefile {{{#!diff --- Makefile.old 2012-06-17 20:05:08.485384996 +0900 +++ Makefile 2012-06-17 20:16:36.692585953 +0900 @@ -16,7 +16,7 @@ # To install in $HOME instead of /usr/local, use: # make install prefix=$HOME -CC=gcc +CC=mips-openwrt-linux-gcc CFLAGS=-O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 @@ -27,8 +27,8 @@ SFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN LDFLAGS= TEST_LDFLAGS=-L. libz.a -LDSHARED=gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map -CPP=gcc -E +LDSHARED=mips-openwrt-linux-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map +CPP=mips-openwrt-linux-gcc -E STATICLIB=libz.a SHAREDLIB=libz.so @@ -36,9 +36,9 @@ SHAREDLIBM=libz.so.1 LIBS=$(STATICLIB) $(SHAREDLIBV) -AR=ar +AR=mips-openwrt-linux-ar ARFLAGS=rc -RANLIB=ranlib +RANLIB=mips-openwrt-linux-ranlib LDCONFIG=ldconfig LDSHAREDLIBC=-lc TAR=tar }}} * mitty@precise:~/openwrt/zlib-1.2.7$ make * mitty@precise:~/openwrt/zlib-1.2.7$ make install {{{ cp libz.a /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib chmod 644 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib/libz.a cp libz.so.1.2.7 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib chmod 755 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib/libz.so.1.2.7 cp zlib.3 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//share/man/man3 chmod 644 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//share/man/man3/zlib.3 cp zlib.pc /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib/pkgconfig chmod 644 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib/pkgconfig/zlib.pc cp zlib.h zconf.h /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//include chmod 644 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//include/zlib.h /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//include/zconf.h }}} == openssl == * [http://www.crosscompile.org/static/pages/OpenSSL.html How to Cross Compile OpenSSL a Step by Step Guide (crosscompile.org)] * mitty@precise:~/openwrt$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz * mitty@precise:~/openwrt/openssl-1.0.1c$ vim Makefile {{{#!diff --- Makefile.old 2012-05-11 00:18:25.000000000 +0900 +++ Makefile 2012-06-17 20:29:26.155761089 +0900 @@ -26,10 +26,10 @@ # for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/. # Normally it is left empty. INSTALL_PREFIX= -INSTALLTOP=/usr/local/ssl +INSTALLTOP=/home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ # Do not edit this manually. Use Configure --openssldir=DIR do change this! -OPENSSLDIR=/usr/local/ssl +OPENSSLDIR=/home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ # NO_IDEA - Define to build without the IDEA algorithm # NO_RC4 - Define to build without the RC4 algorithm @@ -59,15 +59,15 @@ # equal 4. # PKCS1_CHECK - pkcs1 tests. -CC= cc +CC= mips-openwrt-linux-gcc CFLAG= -O DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_STORE PEX_LIBS= EX_LIBS= EXE_EXT= ARFLAGS= -AR= ar $(ARFLAGS) r -RANLIB= /usr/bin/ranlib +AR= mips-openwrt-linux-ar $(ARFLAGS) r +RANLIB= mips-openwrt-linux-ranlib NM= nm PERL= /usr/bin/perl TAR= tar }}} * mitty@precise:~/openwrt/openssl-1.0.1c$ make * mitty@precise:~/openwrt/openssl-1.0.1c$ make install * mitty@precise:~$ file openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/openssl {{{ openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/openssl: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), with unknown capability 0x41000000 = 0xf676e75, with unknown capability 0x10000 = 0x70403, not stripped }}} == ncurses == * mitty@precise:~/openwrt$ wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz * mitty@precise:~/openwrt/ncurses-5.9$ CC=mips-openwrt-linux-gcc ./configure --prefix=$STAGING_DIR {{{ checking for egrep... grep -E Configuring NCURSES 5.9 ABI 5 (Sun Jun 17 21:04:38 JST 2012) checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu Configuring for linux-gnu checking for prefix... /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ checking for gcc... mips-openwrt-linux-gcc checking for C compiler default output... a.out checking whether the C compiler works... configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. }}} === configure with host=mips-unknown-linux-gnu === * mitty@precise:~/openwrt/ncurses-5.9$ CC=mips-openwrt-linux-gcc CXX=mips-openwrt-linux-g++ ./configure --prefix=$STAGING_DIR --host=mips-unknown-linux-gnu {{{ checking for mips-unknown-linux-gnu-g++... no checking for mips-unknown-linux-gnu-c++... no checking for mips-unknown-linux-gnu-gpp... no checking for mips-unknown-linux-gnu-aCC... no checking for mips-unknown-linux-gnu-CC... no checking for mips-unknown-linux-gnu-cxx... no checking for mips-unknown-linux-gnu-cc++... no checking for mips-unknown-linux-gnu-cl... no checking for mips-unknown-linux-gnu-FCC... no checking for mips-unknown-linux-gnu-KCC... no checking for mips-unknown-linux-gnu-RCC... no checking for mips-unknown-linux-gnu-xlC_r... no checking for mips-unknown-linux-gnu-xlC... no checking for g++... g++ }}} * oops === configure with host=mips-openwrt-linux === * mitty@precise:~/openwrt/ncurses-5.9$ CC=mips-openwrt-linux-gcc CXX=mips-openwrt-linux-g++ ./configure --prefix=$STAGING_DIR --host=mips-openwrt-linux * mitty@precise:~/openwrt/ncurses-5.9$ make {{{ compatibility.cc:(.text._ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEi+0x188): undefined reference to `_Unwind_Resume' collect2: ld returned 1 exit status make[1]: *** [demo] Error 1 make[1]: Leaving directory `/home/mitty/openwrt/ncurses-5.9/c++' make: *** [all] Error 2 }}} * https://dev.openwrt.org/browser/trunk/package/ncurses/Makefile のCONFIGURE_ARGSを参考にする * mitty@precise:~/openwrt/ncurses-5.9$ CC=mips-openwrt-linux-gcc CXX=mips-openwrt-linux-g++ ./configure --prefix=$STAGING_DIR --host=mips-openwrt-linux --enable-echo --enable-const --enable-overwrite --disable-rpath --without-ada --without-debug --without-profile --without-progs --disable-big-core --disable-home-terminfo --with-normal --with-shared --with-terminfo-dirs=/usr/share/terminfo --with-default-terminfo-dir=/usr/share/terminfo * mitty@precise:~/openwrt/ncurses-5.9$ make * mitty@precise:~/openwrt/ncurses-5.9$ make install == readline == * mitty@precise:~/openwrt$ wget ftp://ftp.cwru.edu/pub/bash/readline-5.2.013.tar.gz * mitty@precise:~/openwrt/readline-5.2.013$ wget ftp://ftp.cwru.edu/pub/bash/readline-5.2-patches/readline52-014 * mitty@precise:~/openwrt/readline-5.2.013$ patch < readline52-014 {{{ patching file mbutil.c }}} * mitty@precise:~/openwrt/readline-5.2.013$ CC=mips-openwrt-linux-gcc ./configure --prefix=$STAGING_DIR --host=mips-openwrt-linux * mitty@precise:~/openwrt/readline-5.2.013$ make * mitty@precise:~/openwrt/readline-5.2.013$ make install