Changes between Version 10 and Version 11 of TipAndDoc/Linux/OpenWRT/CrossCompile


Ignore:
Timestamp:
Jun 22, 2012 1:53:23 AM (12 years ago)
Author:
mitty
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TipAndDoc/Linux/OpenWRT/CrossCompile

    v10 v11  
    214214 = build others = 
    215215 
     216 * よくある(?)エラーなどは => [./oldmethod] 
     217 
     218 == download toolcgain == 
     219 * mitty@precise:~$ wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2 
     220 * mitty@precise:~$ tar xjf OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2 
     221 
     222 == export ENVIRONMENT == 
     223 * mitty@precise:~$ export STAGING_DIR=~/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ 
     224 * mitty@precise:~$ export PATH=$PATH:$STAGING_DIR/bin/ 
     225 
     226 == libiconv == 
     227 * mitty@precise:~$ wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz 
     228 * mitty@precise:~$ tar xzf libiconv-1.14.tar.gz 
     229 * mitty@precise:~/libiconv-1.14$ CC=mips-openwrt-linux-gcc ./configure --prefix=$STAGING_DIR --host=mips-openwrt-linux 
     230 * mitty@precise:~/libiconv-1.14$ make 
     231 * mitty@precise:~/libiconv-1.14$ make install 
     232 
     233 == zlib == 
     234 * mitty@precise:~$ wget http://zlib.net/zlib-1.2.7.tar.gz 
     235 * mitty@precise:~$ tar xzf zlib-1.2.7.tar.gz 
     236 * mitty@precise:~/zlib-1.2.7$ CC=mips-openwrt-linux-gcc AR=mips-openwrt-linux-ar RANLIB=mips-openwrt-linux-ranlib ./configure --prefix=$STAGING_DIR 
     237 * mitty@precise:~/zlib-1.2.7$ make 
     238 * mitty@precise:~/zlib-1.2.7$ make install 
     239 
     240 == openssl == 
     241 * mitty@precise:~$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz 
     242 * mitty@precise:~$ tar xzf openssl-1.0.1c.tar.gz 
     243 * mitty@precise:~/openssl-1.0.1c$ ./Configure --prefix=$STAGING_DIR --cross-compile-prefix=mips-openwrt-linux- gcc 
     244 * mitty@precise:~/openssl-1.0.1c$ make 
     245 * mitty@precise:~/openssl-1.0.1c$ make install 
     246 
     247 == ncurses == 
     248 * mitty@precise:~$ wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz 
     249 * mitty@precise:~$ tar xzf ncurses-5.9.tar.gz 
     250 * mitty@precise:~/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 
     251 * mitty@precise:~/ncurses-5.9$ make 
     252 * mitty@precise:~/ncurses-5.9$ make install 
     253 
     254 == readline == 
     255 * mitty@precise:~$ wget ftp://ftp.cwru.edu/pub/bash/readline-5.2.013.tar.gz 
     256 * mitty@precise:~$ tar xzf readline-5.2.013.tar.gz 
     257 * mitty@precise:~/readline-5.2.013$ wget ftp://ftp.cwru.edu/pub/bash/readline-5.2-patches/readline52-014 
     258 * mitty@precise:~/readline-5.2.013$ patch < readline52-014 
     259 * mitty@precise:~/readline-5.2.013$ CC=mips-openwrt-linux-gcc ./configure --prefix=$STAGING_DIR --host=mips-openwrt-linux 
     260 * mitty@precise:~/readline-5.2.013$ make 
     261 * mitty@precise:~/readline-5.2.013$ make install 
     262 
    216263 == utvpn == 
    217  * mitty@precise:~/openwrt/trunk/package$ svn co https://lab.mitty.jp/svn/lab/trunk/Dev/utvpn/utvpn-unix-v101-7101-public utvpn 
    218  * mitty@precise:~/openwrt/trunk/package/utvpn$ ./configure 
    219 {{{ 
    220 ------------------------------------------------------------- 
    221 SoftEther UT-VPN for Unix 
    222  
    223 Copyright (C) 2004-2010 SoftEther Corporation. 
    224 Copyright (C) 2004-2010 University of Tsukuba, Japan. 
    225 Copyright (C) 2003-2010 Daiyuu Nobori. All Rights Reserved. 
    226  
    227 This program is free software; you can redistribute it and/or 
    228 modify it under the terms of the GNU General Public License 
    229 version 2 as published by the Free Software Foundation. 
    230 ------------------------------------------------------------- 
    231  
    232 Please select your Operating System below: 
    233  1: Linux 
    234  2: FreeBSD 
    235  3: Solaris 
    236  4: Mac OS X 
    237  
    238 Which is your operating system (1-4): 
    239 1 
    240  
    241 Please select your CPU Bits below: 
    242  1: 32-bit 
    243  2: 64-bit 
    244  
    245 Which is the bits of your CPU (1-2): 
    246 1 
    247  
    248 Makefile is generated. Please execute 'make' to build UT-VPN. 
    249 }}} 
    250  
    251  * mitty@precise:~/openwrt/trunk/package/utvpn$ sha1sum Makefile makefiles/linux_32bit_ja.mak 
    252 {{{ 
    253 5d63c1cbb04ef9a3ecc6d4b8f1150cac20fbfa9d  Makefile 
    254 5d63c1cbb04ef9a3ecc6d4b8f1150cac20fbfa9d  makefiles/linux_32bit_ja.mak 
    255 }}} 
    256   * Makefileは単純にcpしているだけ 
    257  
    258  * mitty@precise:~/openwrt/trunk/package/utvpn$ svn cp makefiles/linux_32bit_ja.mak Makefile 
    259  
    260  === build with gcc for mips === 
    261  * 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/ 
    262  
    263  * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld 
    264 {{{ 
    265 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 
    266 mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined 
    267 In file included from src/Mayaqua/Cfg.c:90:0: 
    268 ./src/Mayaqua/Mayaqua.h:219:31: fatal error: readline/readline.h: No such file or directory 
    269 compilation terminated. 
    270 make: *** [tmp/objs/Mayaqua/Cfg.o] Error 1 
    271 }}} 
    272  * mitty@precise:~$ sudo aptitude install -R libssl-dev libreadline-dev libncurses-dev 
    273  
    274  * 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/ 
    275  * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld 
    276 {{{ 
    277 (snip) 
    278  
    279 mips-openwrt-linux-gcc tmp/as/Ham.a -O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -o output/ham/ham 
    280 /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 
    281 /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 
    282 /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 
    283 /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 
    284 /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 
    285 collect2: ld returned 1 exit status 
    286 }}} 
    287  
    288  === rebuild after libraries were installed === 
    289  * make install [#zlib], [#openssl], [#ncurses] and [#readline] 
    290  
    291  * mitty@precise:~/openwrt/trunk/package/utvpn$ make clean 
    292  * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld 
    293 {{{ 
    294  
    295 mips-openwrt-linux-gcc tmp/as/Ham.a -O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -o output/ham/ham 
    296 tmp/as/Ham.a(Internat.o): In function `IconvWideToStrInternal': 
    297 Internat.c:(.text+0x634): undefined reference to `iconv_open' 
    298 Internat.c:(.text+0x648): undefined reference to `iconv_open' 
    299 tmp/as/Ham.a(Internat.o): In function `IconvStrToWideInternal': 
    300 Internat.c:(.text+0x66c): undefined reference to `iconv_open' 
    301 Internat.c:(.text+0x680): undefined reference to `iconv_open' 
    302 tmp/as/Ham.a(Internat.o): In function `IconvFreeInternal': 
    303 Internat.c:(.text+0x690): undefined reference to `iconv_close' 
    304 tmp/as/Ham.a(Internat.o): In function `UnixUniToStr': 
    305 Internat.c:(.text+0x7b0): undefined reference to `iconv' 
    306 tmp/as/Ham.a(Internat.o): In function `InitInternational': 
    307 Internat.c:(.text+0xb68): undefined reference to `iconv_close' 
    308 Internat.c:(.text+0xbcc): undefined reference to `iconv_close' 
    309 tmp/as/Ham.a(Internat.o): In function `UnixStrToUni': 
    310 Internat.c:(.text+0x37e4): undefined reference to `iconv' 
    311 collect2: ld returned 1 exit status 
    312 make: *** [output/ham/ham] Error 1 
    313 }}} 
    314  === make install iconv === 
    315  * mitty@precise:~/openwrt$ wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz 
    316  * mitty@precise:~/openwrt/libiconv-1.14$ CC=mips-openwrt-linux-gcc ./configure --prefix=$STAGING_DIR --host=mips-openwrt-linux 
    317  * mitty@precise:~/openwrt/libiconv-1.14$ make 
    318  * mitty@precise:~/openwrt/libiconv-1.14$ make install 
    319  
    320  * mitty@precise:~/openwrt/trunk/package/utvpn$ make clean 
    321  * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld 
    322 {{{ 
    323  
    324 mips-openwrt-linux-gcc tmp/as/Ham.a -O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -o output/ham/ham 
    325 tmp/as/Ham.a(Internat.o): In function `IconvWideToStrInternal': 
    326 Internat.c:(.text+0x634): undefined reference to `iconv_open' 
    327  
    328 (snip) 
    329 }}} 
    330  
    331  === fix source === 
    332  * mitty@precise:~/openwrt/trunk/package/utvpn$ vim src/Mayaqua/Mayaqua.h 
    333 {{{#!diff 
    334 Index: src/Mayaqua/Mayaqua.h 
    335 =================================================================== 
    336 --- src/Mayaqua/Mayaqua.h       (revision 147) 
    337 +++ src/Mayaqua/Mayaqua.h       (working copy) 
    338 @@ -221,6 +221,8 @@ 
    339  //#include <curses.h> 
    340   
    341  #ifdef UNIX_LINUX 
    342 +#include <iconv.h> 
    343 +/* 
    344  typedef void *iconv_t; 
    345  iconv_t iconv_open (__const char *__tocode, __const char *__fromcode); 
    346  size_t iconv (iconv_t __cd, char **__restrict __inbuf, 
    347 @@ -228,6 +230,7 @@ 
    348                       char **__restrict __outbuf, 
    349                       size_t *__restrict __outbytesleft); 
    350  int iconv_close (iconv_t __cd); 
    351 +*/ 
    352  #else  // UNIX_LINUX 
    353  #include <iconv.h> 
    354  #endif // UNIX_LINUX 
    355 }}} 
    356  * mitty@precise:~/openwrt/trunk/package/utvpn$ vim Makefile 
    357 {{{#!diff 
    358 Index: Makefile 
    359 =================================================================== 
    360 --- Makefile    (revision 147) 
    361 +++ Makefile    (working copy) 
    362 @@ -27,16 +27,16 @@ 
    363   
    364  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 
    365   
    366 -OPTIONS_LINK_DEBUG=-g -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz 
    367 +OPTIONS_LINK_DEBUG=-g -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -liconv 
    368   
    369  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 
    370   
    371 -OPTIONS_LINK_RELEASE=-O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz 
    372 +OPTIONS_LINK_RELEASE=-O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -liconv 
    373   
    374 -INSTALL_BINDIR=/usr/bin/ 
    375 -INSTALL_UTVPNSERVER_DIR=/usr/utvpnserver/ 
    376 -INSTALL_UTVPNCLIENT_DIR=/usr/utvpnclient/ 
    377 -INSTALL_UTVPNCMD_DIR=/usr/utvpncmd/ 
    378 +INSTALL_BINDIR=$(PREFIX)/usr/bin/ 
    379 +INSTALL_UTVPNSERVER_DIR=$(PREFIX)/usr/utvpnserver/ 
    380 +INSTALL_UTVPNCLIENT_DIR=$(PREFIX)/usr/utvpnclient/ 
    381 +INSTALL_UTVPNCMD_DIR=$(PREFIX)/usr/utvpncmd/ 
    382   
    383  ifeq ($(DEBUG),YES) 
    384         OPTIONS_COMPILE=$(OPTIONS_COMPILE_DEBUG) 
    385 @@ -307,6 +307,7 @@ 
    386         @mkdir -p $(INSTALL_UTVPNSERVER_DIR) 
    387         cp output/utvpnserver/hamcore.utvpn $(INSTALL_UTVPNSERVER_DIR)hamcore.utvpn 
    388         cp output/utvpnserver/utvpnserver $(INSTALL_UTVPNSERVER_DIR)utvpnserver 
    389 +       @mkdir -p $(INSTALL_BINDIR) 
    390         echo "#!/bin/sh" > $(INSTALL_BINDIR)utvpnserver 
    391         echo $(INSTALL_UTVPNSERVER_DIR)utvpnserver '"$$@"' >> $(INSTALL_BINDIR)utvpnserver 
    392         echo 'exit $$?' >> $(INSTALL_BINDIR)utvpnserver 
    393 @@ -317,6 +318,7 @@ 
    394         cp output/utvpnclient/hamcore.utvpn $(INSTALL_UTVPNCLIENT_DIR)hamcore.utvpn 
    395         cp output/utvpnclient/utvpnclient $(INSTALL_UTVPNCLIENT_DIR)utvpnclient 
    396         echo "#!/bin/sh" > $(INSTALL_BINDIR)utvpnclient 
    397 +       @mkdir -p $(INSTALL_BINDIR) 
    398         echo $(INSTALL_UTVPNCLIENT_DIR)utvpnclient '"$$@"' >> $(INSTALL_BINDIR)utvpnclient 
    399         echo 'exit $$?' >> $(INSTALL_BINDIR)utvpnclient 
    400         chmod 755 $(INSTALL_BINDIR)utvpnclient 
    401 @@ -325,6 +327,7 @@ 
    402         @mkdir -p $(INSTALL_UTVPNCMD_DIR) 
    403         cp output/utvpncmd/hamcore.utvpn $(INSTALL_UTVPNCMD_DIR)hamcore.utvpn 
    404         cp output/utvpncmd/utvpncmd $(INSTALL_UTVPNCMD_DIR)utvpncmd 
    405 +       @mkdir -p $(INSTALL_BINDIR) 
    406         echo "#!/bin/sh" > $(INSTALL_BINDIR)utvpncmd 
    407         echo $(INSTALL_UTVPNCMD_DIR)utvpncmd '"$$@"' >> $(INSTALL_BINDIR)utvpncmd 
    408         echo 'exit $$?' >> $(INSTALL_BINDIR)utvpncmd 
    409 }}} 
    410  * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld 
    411  
    412  * mitty@precise:~/openwrt/trunk/package/utvpn$ make install PREFIX=~/tmp 
    413 {{{ 
    414 cp output/utvpnserver/hamcore.utvpn /home/mitty/tmp/usr/utvpnserver/hamcore.utvpn 
    415 cp output/utvpnserver/utvpnserver /home/mitty/tmp/usr/utvpnserver/utvpnserver 
    416 echo "#!/bin/sh" > /home/mitty/tmp/usr/bin/utvpnserver 
    417 echo /home/mitty/tmp/usr/utvpnserver/utvpnserver '"$@"' >> /home/mitty/tmp/usr/bin/utvpnserver 
    418 echo 'exit $?' >> /home/mitty/tmp/usr/bin/utvpnserver 
    419 chmod 755 /home/mitty/tmp/usr/bin/utvpnserver 
    420 cp output/utvpnclient/hamcore.utvpn /home/mitty/tmp/usr/utvpnclient/hamcore.utvpn 
    421 cp output/utvpnclient/utvpnclient /home/mitty/tmp/usr/utvpnclient/utvpnclient 
    422 echo "#!/bin/sh" > /home/mitty/tmp/usr/bin/utvpnclient 
    423 echo /home/mitty/tmp/usr/utvpnclient/utvpnclient '"$@"' >> /home/mitty/tmp/usr/bin/utvpnclient 
    424 echo 'exit $?' >> /home/mitty/tmp/usr/bin/utvpnclient 
    425 chmod 755 /home/mitty/tmp/usr/bin/utvpnclient 
    426 cp output/utvpncmd/hamcore.utvpn /home/mitty/tmp/usr/utvpncmd/hamcore.utvpn 
    427 cp output/utvpncmd/utvpncmd /home/mitty/tmp/usr/utvpncmd/utvpncmd 
    428 echo "#!/bin/sh" > /home/mitty/tmp/usr/bin/utvpncmd 
    429 echo /home/mitty/tmp/usr/utvpncmd/utvpncmd '"$@"' >> /home/mitty/tmp/usr/bin/utvpncmd 
    430 echo 'exit $?' >> /home/mitty/tmp/usr/bin/utvpncmd 
    431 chmod 755 /home/mitty/tmp/usr/bin/utvpncmd 
    432  
    433 -------------------------------------------------------------------- 
    434 Installation completed successfully. 
    435  
    436 Please execute 'utvpnserver start' to run UT-VPN Server Background Service. 
    437 Or please execute 'utvpnclient start' to run UT-VPN Client Background Service. 
    438 And please execute 'utvpncmd' to run UT-VPN Command-Line Utility to configure UT-Server or UT-VPN Client. 
    439 -------------------------------------------------------------------- 
    440 }}} 
    441  
    442  * mitty@precise:~$ mv tmp utvpn-unix-v101-7101-public.mips 
    443  * mitty@precise:~$ tar czf utvpn-unix-v101-7101-public.mips.tar.gz utvpn-unix-v101-7101-public.mips 
    444  
    445  * mitty@starseed:~/utvpn-unix-v101-7101-public.mips/usr/utvpncmd$ ./utvpncmd 
    446 {{{ 
    447 Bus error 
    448 }}} 
    449   * うまく動かない 
     264 * make install #zlib, #openssl, #ncurses and #readline 
     265 
     266 * mitty@precise:~$ svn export http://lab.mitty.jp/svn/lab/trunk/Dev/utvpn/utvpn-unix-v101-7101-public/ 
     267 
     268 * あるいは以下の様にする 
     269  * mitty@precise:~$ wget 'http://utvpn.tsukuba.ac.jp/files/utvpn/v1.01-7101-public-2010.06.27/Source%20Code%20(Win32%20and%20Unix)/utvpn-src-unix-v101-7101-public-2010.06.27.tar.gz' 
     270  * mitty@precise:~$ tar xzf utvpn-src-unix-v101-7101-public-2010.06.27.tar.gz 
     271  * mitty@precise:~/utvpn-unix-v101-7101-public$ svn diff http://lab.mitty.jp/svn/lab/trunk/Dev/utvpn/utvpn-unix-v101-7101-public/ -r152:153 | patch -p0 
     272{{{ 
     273patching file Makefile.mips 
     274patching file src/Mayaqua/Mayaqua.h 
     275}}} 
     276 
     277 * mitty@precise:~/utvpn-unix-v101-7101-public$ cp $STAGING_DIR/include/openssl/* src/Mayaqua/openssl/ 
    450278  * [http://wiki.livedoor.jp/taiki_kondo/d/UT-VPN/Debian UT-VPN/Debian - 判ってるよねWiki - livedoor Wiki(ウィキ)] 
    451279  * [http://blog.falconsrv.net/2012/05/ut-vpnubuntu-1204.html Falcon’s Diary: UT-VPNのビルド方法(Ubuntu 12.04)] 
    452280 
    453  === update openssl headers === 
    454  * 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/ 
    455  * 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/ 
    456  * mitty@precise:~/openwrt/trunk/package/utvpn$ cp ../../staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/include/openssl/* src/Mayaqua/openssl/ 
    457  * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld 
    458  
    459  
    460  * mitty@precise:~/openwrt/trunk/package/utvpn$ make install PREFIX=~/utvpn-unix-v101-7101-public.mips 
    461  
    462  === it works ! === 
    463  * mitty@starseed:~$ ./utvpn-unix-v101-7101-public.mips/usr/utvpnclient/utvpnclient 
    464 {{{ 
    465 SoftEther UT-VPN Client Service Program 
    466 Copyright (C) 2004-2010 SoftEther Corporation. 
    467 Copyright (C) 2004-2010 University of Tsukuba, Japan. 
    468 Copyright (C) 2003-2010 Daiyuu Nobori. 
    469 All Rights Reserved. 
    470  
    471 utvpnclient Command Usage: 
    472  utvpnclient start  - Start SoftEther UT-VPN Client Service. 
    473  utvpnclient stop   - Stop SoftEther UT-VPN Client Service if the service is already started. 
    474 }}} 
    475  * mitty@starseed:~$ ./utvpn-unix-v101-7101-public.mips/usr/utvpnclient/utvpnclient start 
    476 {{{ 
    477 SoftEther UT-VPN Client Service Started. 
    478 }}} 
    479  
    480 * mitty@starseed:~$ ps w | tail 
    481 {{{ 
    482 29986 root         0 SW   [flush-mtd-unmap] 
    483 29987 mitty     2100 S    -bash 
    484 29992 mitty     1548 S    /usr/sbin/screen -d -RR -U 
    485 29993 mitty     4344 S    {screen} /usr/sbin/SCREEN -d -RR -U 
    486 29994 mitty     2648 S    /bin/bash 
    487 30026 root         0 SW   [kworker/0:0] 
    488 30033 mitty     4164 S    /home/mitty/utvpn-unix-v101-7101-public.mips/usr/utvpnclient/utvpnclient execsvc 
    489 30034 mitty    11948 S    /home/mitty/utvpn-unix-v101-7101-public.mips/usr/utvpnclient/utvpnclient execsvc 
    490 30043 mitty     1492 R    ps w 
    491 30044 mitty     1492 S    tail 
    492 }}} 
    493  * mitty@starseed:~$ netstat -nap --inet | grep utvpn 
    494 {{{ 
    495 (Not all processes could be identified, non-owned process info 
    496  will not be shown, you would have to be root to see it all.) 
    497 tcp        0      0 0.0.0.0:9930            0.0.0.0:*               LISTEN      30034/utvpnclient 
    498 }}} 
    499  == zlib == 
    500  * [http://www.crosscompile.org/static/pages/ZLib.html How to Cross Compile Zlib Compression Library - Step by Step Guide (crosscompile.org)] 
    501  
    502  * mitty@precise:~$ export PATH=$PATH:~/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/ 
    503  * mitty@precise:~$ export STAGING_DIR=~/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ 
    504  
    505  * mitty@precise:~/openwrt$ wget http://zlib.net/zlib-1.2.7.tar.gz 
    506  * mitty@precise:~/openwrt/zlib-1.2.7$ ./configure --prefix=$STAGING_DIR 
    507  * mitty@precise:~/openwrt/zlib-1.2.7$ vim Makefile 
    508 {{{#!diff 
    509 --- Makefile.old        2012-06-17 20:05:08.485384996 +0900 
    510 +++ Makefile    2012-06-17 20:16:36.692585953 +0900 
    511 @@ -16,7 +16,7 @@ 
    512  # To install in $HOME instead of /usr/local, use: 
    513  #    make install prefix=$HOME 
    514   
    515 -CC=gcc 
    516 +CC=mips-openwrt-linux-gcc 
    517   
    518  CFLAGS=-O3  -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN 
    519  #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 
    520 @@ -27,8 +27,8 @@ 
    521  SFLAGS=-O3  -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN 
    522  LDFLAGS=  
    523  TEST_LDFLAGS=-L. libz.a 
    524 -LDSHARED=gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map 
    525 -CPP=gcc -E 
    526 +LDSHARED=mips-openwrt-linux-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map 
    527 +CPP=mips-openwrt-linux-gcc -E 
    528   
    529  STATICLIB=libz.a 
    530  SHAREDLIB=libz.so 
    531 @@ -36,9 +36,9 @@ 
    532  SHAREDLIBM=libz.so.1 
    533  LIBS=$(STATICLIB) $(SHAREDLIBV) 
    534   
    535 -AR=ar 
    536 +AR=mips-openwrt-linux-ar 
    537  ARFLAGS=rc 
    538 -RANLIB=ranlib 
    539 +RANLIB=mips-openwrt-linux-ranlib 
    540  LDCONFIG=ldconfig 
    541  LDSHAREDLIBC=-lc 
    542  TAR=tar 
    543 }}} 
    544  
    545  * mitty@precise:~/openwrt/zlib-1.2.7$ make 
    546  * mitty@precise:~/openwrt/zlib-1.2.7$ make install 
    547 {{{ 
    548 cp libz.a /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib 
    549 chmod 644 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib/libz.a 
    550 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 
    551 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 
    552 cp zlib.3 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//share/man/man3 
    553 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 
    554 cp zlib.pc /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib/pkgconfig 
    555 chmod 644 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib/pkgconfig/zlib.pc 
    556 cp zlib.h zconf.h /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//include 
    557 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 
    558 }}} 
    559  
    560  == openssl == 
    561  * [http://www.crosscompile.org/static/pages/OpenSSL.html How to Cross Compile OpenSSL a Step by Step Guide (crosscompile.org)] 
    562  
    563  * mitty@precise:~/openwrt$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz 
    564  * mitty@precise:~/openwrt/openssl-1.0.1c$ vim Makefile 
    565 {{{#!diff 
    566 --- Makefile.old        2012-05-11 00:18:25.000000000 +0900 
    567 +++ Makefile    2012-06-17 20:29:26.155761089 +0900 
    568 @@ -26,10 +26,10 @@ 
    569  # for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/. 
    570  # Normally it is left empty. 
    571  INSTALL_PREFIX= 
    572 -INSTALLTOP=/usr/local/ssl 
    573 +INSTALLTOP=/home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ 
    574   
    575  # Do not edit this manually. Use Configure --openssldir=DIR do change this! 
    576 -OPENSSLDIR=/usr/local/ssl 
    577 +OPENSSLDIR=/home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ 
    578   
    579  # NO_IDEA - Define to build without the IDEA algorithm 
    580  # NO_RC4  - Define to build without the RC4 algorithm 
    581 @@ -59,15 +59,15 @@ 
    582  # equal 4. 
    583  # PKCS1_CHECK - pkcs1 tests. 
    584   
    585 -CC= cc 
    586 +CC= mips-openwrt-linux-gcc 
    587  CFLAG= -O 
    588  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 
    589  PEX_LIBS=  
    590  EX_LIBS=  
    591  EXE_EXT=  
    592  ARFLAGS=  
    593 -AR= ar $(ARFLAGS) r 
    594 -RANLIB= /usr/bin/ranlib 
    595 +AR= mips-openwrt-linux-ar $(ARFLAGS) r 
    596 +RANLIB= mips-openwrt-linux-ranlib 
    597  NM= nm 
    598  PERL= /usr/bin/perl 
    599  TAR= tar 
    600 }}} 
    601  
    602  * mitty@precise:~/openwrt/openssl-1.0.1c$ make 
    603  * mitty@precise:~/openwrt/openssl-1.0.1c$ make install 
    604  
    605  * mitty@precise:~$ file openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/openssl 
    606 {{{ 
    607 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 
    608 }}} 
    609  
    610  == ncurses == 
    611  * mitty@precise:~/openwrt$ wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz 
    612  * mitty@precise:~/openwrt/ncurses-5.9$ CC=mips-openwrt-linux-gcc ./configure --prefix=$STAGING_DIR 
    613 {{{ 
    614 checking for egrep... grep -E 
    615 Configuring NCURSES 5.9 ABI 5 (Sun Jun 17 21:04:38 JST 2012) 
    616 checking build system type... x86_64-unknown-linux-gnu 
    617 checking host system type... x86_64-unknown-linux-gnu 
    618 checking target system type... x86_64-unknown-linux-gnu 
    619 Configuring for linux-gnu 
    620 checking for prefix... /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ 
    621 checking for gcc... mips-openwrt-linux-gcc 
    622 checking for C compiler default output... a.out 
    623 checking whether the C compiler works... configure: error: cannot run C compiled programs. 
    624 If you meant to cross compile, use `--host'. 
    625 }}} 
    626  
    627  === configure with host=mips-unknown-linux-gnu === 
    628  * 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 
    629 {{{ 
    630 checking for mips-unknown-linux-gnu-g++... no 
    631 checking for mips-unknown-linux-gnu-c++... no 
    632 checking for mips-unknown-linux-gnu-gpp... no 
    633 checking for mips-unknown-linux-gnu-aCC... no 
    634 checking for mips-unknown-linux-gnu-CC... no 
    635 checking for mips-unknown-linux-gnu-cxx... no 
    636 checking for mips-unknown-linux-gnu-cc++... no 
    637 checking for mips-unknown-linux-gnu-cl... no 
    638 checking for mips-unknown-linux-gnu-FCC... no 
    639 checking for mips-unknown-linux-gnu-KCC... no 
    640 checking for mips-unknown-linux-gnu-RCC... no 
    641 checking for mips-unknown-linux-gnu-xlC_r... no 
    642 checking for mips-unknown-linux-gnu-xlC... no 
    643 checking for g++... g++ 
    644 }}} 
    645   * oops 
    646  
    647  === configure with host=mips-openwrt-linux === 
    648  * mitty@precise:~/openwrt/ncurses-5.9$ CC=mips-openwrt-linux-gcc CXX=mips-openwrt-linux-g++ ./configure --prefix=$STAGING_DIR --host=mips-openwrt-linux 
    649  * mitty@precise:~/openwrt/ncurses-5.9$ make 
    650 {{{ 
    651 compatibility.cc:(.text._ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEi+0x188): undefined reference to `_Unwind_Resume' 
    652 collect2: ld returned 1 exit status 
    653 make[1]: *** [demo] Error 1 
    654 make[1]: Leaving directory `/home/mitty/openwrt/ncurses-5.9/c++' 
    655 make: *** [all] Error 2 
    656 }}} 
    657  
    658  * https://dev.openwrt.org/browser/trunk/package/ncurses/Makefile のCONFIGURE_ARGSを参考にする 
    659  
    660  * 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 
    661  * mitty@precise:~/openwrt/ncurses-5.9$ make 
    662  * mitty@precise:~/openwrt/ncurses-5.9$ make install 
    663  
    664  == readline == 
    665  * mitty@precise:~/openwrt$ wget ftp://ftp.cwru.edu/pub/bash/readline-5.2.013.tar.gz 
    666  * mitty@precise:~/openwrt/readline-5.2.013$ wget ftp://ftp.cwru.edu/pub/bash/readline-5.2-patches/readline52-014 
    667  * mitty@precise:~/openwrt/readline-5.2.013$ patch < readline52-014 
    668 {{{ 
    669 patching file mbutil.c 
    670 }}} 
    671  * mitty@precise:~/openwrt/readline-5.2.013$ CC=mips-openwrt-linux-gcc ./configure --prefix=$STAGING_DIR --host=mips-openwrt-linux 
    672  * mitty@precise:~/openwrt/readline-5.2.013$ make 
    673  * mitty@precise:~/openwrt/readline-5.2.013$ make install 
     281 * mitty@precise:~/utvpn-unix-v101-7101-public$ make -f Makefile.mips CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld 
     282 * mitty@precise:~/utvpn-unix-v101-7101-public$ make -f Makefile.mips install PREFIX=~/target