Changes between Initial Version and Version 1 of TipAndDoc/Linux/OpenWRT/CrossCompile/oldmethod


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

--

Legend:

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

    v1 v1  
     1[[PageOutline]] 
     2 
     3 * 試行錯誤しながらmake installした際の、冗長な手順など 
     4 
     5 == utvpn == 
     6 * mitty@precise:~/openwrt/trunk/package$ svn co https://lab.mitty.jp/svn/lab/trunk/Dev/utvpn/utvpn-unix-v101-7101-public utvpn 
     7 * mitty@precise:~/openwrt/trunk/package/utvpn$ ./configure 
     8{{{ 
     9------------------------------------------------------------- 
     10SoftEther UT-VPN for Unix 
     11 
     12Copyright (C) 2004-2010 SoftEther Corporation. 
     13Copyright (C) 2004-2010 University of Tsukuba, Japan. 
     14Copyright (C) 2003-2010 Daiyuu Nobori. All Rights Reserved. 
     15 
     16This program is free software; you can redistribute it and/or 
     17modify it under the terms of the GNU General Public License 
     18version 2 as published by the Free Software Foundation. 
     19------------------------------------------------------------- 
     20 
     21Please select your Operating System below: 
     22 1: Linux 
     23 2: FreeBSD 
     24 3: Solaris 
     25 4: Mac OS X 
     26 
     27Which is your operating system (1-4): 
     281 
     29 
     30Please select your CPU Bits below: 
     31 1: 32-bit 
     32 2: 64-bit 
     33 
     34Which is the bits of your CPU (1-2): 
     351 
     36 
     37Makefile is generated. Please execute 'make' to build UT-VPN. 
     38}}} 
     39 
     40 * mitty@precise:~/openwrt/trunk/package/utvpn$ sha1sum Makefile makefiles/linux_32bit_ja.mak 
     41{{{ 
     425d63c1cbb04ef9a3ecc6d4b8f1150cac20fbfa9d  Makefile 
     435d63c1cbb04ef9a3ecc6d4b8f1150cac20fbfa9d  makefiles/linux_32bit_ja.mak 
     44}}} 
     45  * Makefileは単純にcpしているだけ 
     46 
     47 * mitty@precise:~/openwrt/trunk/package/utvpn$ svn cp makefiles/linux_32bit_ja.mak Makefile 
     48 
     49 === build with gcc for mips === 
     50 * 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/ 
     51 
     52 * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld 
     53{{{ 
     54mips-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 
     55mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined 
     56In file included from src/Mayaqua/Cfg.c:90:0: 
     57./src/Mayaqua/Mayaqua.h:219:31: fatal error: readline/readline.h: No such file or directory 
     58compilation terminated. 
     59make: *** [tmp/objs/Mayaqua/Cfg.o] Error 1 
     60}}} 
     61 * mitty@precise:~$ sudo aptitude install -R libssl-dev libreadline-dev libncurses-dev 
     62 
     63 * 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/ 
     64 * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld 
     65{{{ 
     66(snip) 
     67 
     68mips-openwrt-linux-gcc tmp/as/Ham.a -O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -o output/ham/ham 
     69/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 
     70/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 
     71/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 
     72/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 
     73/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 
     74collect2: ld returned 1 exit status 
     75}}} 
     76 
     77 === rebuild after libraries were installed === 
     78 * make install [#zlib], [#openssl], [#ncurses] and [#readline] 
     79 
     80 * mitty@precise:~/openwrt/trunk/package/utvpn$ make clean 
     81 * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld 
     82{{{ 
     83 
     84mips-openwrt-linux-gcc tmp/as/Ham.a -O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -o output/ham/ham 
     85tmp/as/Ham.a(Internat.o): In function `IconvWideToStrInternal': 
     86Internat.c:(.text+0x634): undefined reference to `iconv_open' 
     87Internat.c:(.text+0x648): undefined reference to `iconv_open' 
     88tmp/as/Ham.a(Internat.o): In function `IconvStrToWideInternal': 
     89Internat.c:(.text+0x66c): undefined reference to `iconv_open' 
     90Internat.c:(.text+0x680): undefined reference to `iconv_open' 
     91tmp/as/Ham.a(Internat.o): In function `IconvFreeInternal': 
     92Internat.c:(.text+0x690): undefined reference to `iconv_close' 
     93tmp/as/Ham.a(Internat.o): In function `UnixUniToStr': 
     94Internat.c:(.text+0x7b0): undefined reference to `iconv' 
     95tmp/as/Ham.a(Internat.o): In function `InitInternational': 
     96Internat.c:(.text+0xb68): undefined reference to `iconv_close' 
     97Internat.c:(.text+0xbcc): undefined reference to `iconv_close' 
     98tmp/as/Ham.a(Internat.o): In function `UnixStrToUni': 
     99Internat.c:(.text+0x37e4): undefined reference to `iconv' 
     100collect2: ld returned 1 exit status 
     101make: *** [output/ham/ham] Error 1 
     102}}} 
     103 === make install iconv === 
     104 * mitty@precise:~/openwrt$ wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz 
     105 * mitty@precise:~/openwrt/libiconv-1.14$ CC=mips-openwrt-linux-gcc ./configure --prefix=$STAGING_DIR --host=mips-openwrt-linux 
     106 * mitty@precise:~/openwrt/libiconv-1.14$ make 
     107 * mitty@precise:~/openwrt/libiconv-1.14$ make install 
     108 
     109 * mitty@precise:~/openwrt/trunk/package/utvpn$ make clean 
     110 * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld 
     111{{{ 
     112 
     113mips-openwrt-linux-gcc tmp/as/Ham.a -O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -o output/ham/ham 
     114tmp/as/Ham.a(Internat.o): In function `IconvWideToStrInternal': 
     115Internat.c:(.text+0x634): undefined reference to `iconv_open' 
     116 
     117(snip) 
     118}}} 
     119 
     120 === fix source === 
     121 * mitty@precise:~/openwrt/trunk/package/utvpn$ vim src/Mayaqua/Mayaqua.h 
     122{{{#!diff 
     123Index: src/Mayaqua/Mayaqua.h 
     124=================================================================== 
     125--- src/Mayaqua/Mayaqua.h       (revision 147) 
     126+++ src/Mayaqua/Mayaqua.h       (working copy) 
     127@@ -221,6 +221,8 @@ 
     128 //#include <curses.h> 
     129  
     130 #ifdef UNIX_LINUX 
     131+#include <iconv.h> 
     132+/* 
     133 typedef void *iconv_t; 
     134 iconv_t iconv_open (__const char *__tocode, __const char *__fromcode); 
     135 size_t iconv (iconv_t __cd, char **__restrict __inbuf, 
     136@@ -228,6 +230,7 @@ 
     137                      char **__restrict __outbuf, 
     138                      size_t *__restrict __outbytesleft); 
     139 int iconv_close (iconv_t __cd); 
     140+*/ 
     141 #else  // UNIX_LINUX 
     142 #include <iconv.h> 
     143 #endif // UNIX_LINUX 
     144}}} 
     145 * mitty@precise:~/openwrt/trunk/package/utvpn$ vim Makefile 
     146{{{#!diff 
     147Index: Makefile 
     148=================================================================== 
     149--- Makefile    (revision 147) 
     150+++ Makefile    (working copy) 
     151@@ -27,16 +27,16 @@ 
     152  
     153 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 
     154  
     155-OPTIONS_LINK_DEBUG=-g -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz 
     156+OPTIONS_LINK_DEBUG=-g -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -liconv 
     157  
     158 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 
     159  
     160-OPTIONS_LINK_RELEASE=-O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz 
     161+OPTIONS_LINK_RELEASE=-O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -liconv 
     162  
     163-INSTALL_BINDIR=/usr/bin/ 
     164-INSTALL_UTVPNSERVER_DIR=/usr/utvpnserver/ 
     165-INSTALL_UTVPNCLIENT_DIR=/usr/utvpnclient/ 
     166-INSTALL_UTVPNCMD_DIR=/usr/utvpncmd/ 
     167+INSTALL_BINDIR=$(PREFIX)/usr/bin/ 
     168+INSTALL_UTVPNSERVER_DIR=$(PREFIX)/usr/utvpnserver/ 
     169+INSTALL_UTVPNCLIENT_DIR=$(PREFIX)/usr/utvpnclient/ 
     170+INSTALL_UTVPNCMD_DIR=$(PREFIX)/usr/utvpncmd/ 
     171  
     172 ifeq ($(DEBUG),YES) 
     173        OPTIONS_COMPILE=$(OPTIONS_COMPILE_DEBUG) 
     174@@ -307,6 +307,7 @@ 
     175        @mkdir -p $(INSTALL_UTVPNSERVER_DIR) 
     176        cp output/utvpnserver/hamcore.utvpn $(INSTALL_UTVPNSERVER_DIR)hamcore.utvpn 
     177        cp output/utvpnserver/utvpnserver $(INSTALL_UTVPNSERVER_DIR)utvpnserver 
     178+       @mkdir -p $(INSTALL_BINDIR) 
     179        echo "#!/bin/sh" > $(INSTALL_BINDIR)utvpnserver 
     180        echo $(INSTALL_UTVPNSERVER_DIR)utvpnserver '"$$@"' >> $(INSTALL_BINDIR)utvpnserver 
     181        echo 'exit $$?' >> $(INSTALL_BINDIR)utvpnserver 
     182@@ -317,6 +318,7 @@ 
     183        cp output/utvpnclient/hamcore.utvpn $(INSTALL_UTVPNCLIENT_DIR)hamcore.utvpn 
     184        cp output/utvpnclient/utvpnclient $(INSTALL_UTVPNCLIENT_DIR)utvpnclient 
     185        echo "#!/bin/sh" > $(INSTALL_BINDIR)utvpnclient 
     186+       @mkdir -p $(INSTALL_BINDIR) 
     187        echo $(INSTALL_UTVPNCLIENT_DIR)utvpnclient '"$$@"' >> $(INSTALL_BINDIR)utvpnclient 
     188        echo 'exit $$?' >> $(INSTALL_BINDIR)utvpnclient 
     189        chmod 755 $(INSTALL_BINDIR)utvpnclient 
     190@@ -325,6 +327,7 @@ 
     191        @mkdir -p $(INSTALL_UTVPNCMD_DIR) 
     192        cp output/utvpncmd/hamcore.utvpn $(INSTALL_UTVPNCMD_DIR)hamcore.utvpn 
     193        cp output/utvpncmd/utvpncmd $(INSTALL_UTVPNCMD_DIR)utvpncmd 
     194+       @mkdir -p $(INSTALL_BINDIR) 
     195        echo "#!/bin/sh" > $(INSTALL_BINDIR)utvpncmd 
     196        echo $(INSTALL_UTVPNCMD_DIR)utvpncmd '"$$@"' >> $(INSTALL_BINDIR)utvpncmd 
     197        echo 'exit $$?' >> $(INSTALL_BINDIR)utvpncmd 
     198}}} 
     199 * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld 
     200 
     201 * mitty@precise:~/openwrt/trunk/package/utvpn$ make install PREFIX=~/tmp 
     202{{{ 
     203cp output/utvpnserver/hamcore.utvpn /home/mitty/tmp/usr/utvpnserver/hamcore.utvpn 
     204cp output/utvpnserver/utvpnserver /home/mitty/tmp/usr/utvpnserver/utvpnserver 
     205echo "#!/bin/sh" > /home/mitty/tmp/usr/bin/utvpnserver 
     206echo /home/mitty/tmp/usr/utvpnserver/utvpnserver '"$@"' >> /home/mitty/tmp/usr/bin/utvpnserver 
     207echo 'exit $?' >> /home/mitty/tmp/usr/bin/utvpnserver 
     208chmod 755 /home/mitty/tmp/usr/bin/utvpnserver 
     209cp output/utvpnclient/hamcore.utvpn /home/mitty/tmp/usr/utvpnclient/hamcore.utvpn 
     210cp output/utvpnclient/utvpnclient /home/mitty/tmp/usr/utvpnclient/utvpnclient 
     211echo "#!/bin/sh" > /home/mitty/tmp/usr/bin/utvpnclient 
     212echo /home/mitty/tmp/usr/utvpnclient/utvpnclient '"$@"' >> /home/mitty/tmp/usr/bin/utvpnclient 
     213echo 'exit $?' >> /home/mitty/tmp/usr/bin/utvpnclient 
     214chmod 755 /home/mitty/tmp/usr/bin/utvpnclient 
     215cp output/utvpncmd/hamcore.utvpn /home/mitty/tmp/usr/utvpncmd/hamcore.utvpn 
     216cp output/utvpncmd/utvpncmd /home/mitty/tmp/usr/utvpncmd/utvpncmd 
     217echo "#!/bin/sh" > /home/mitty/tmp/usr/bin/utvpncmd 
     218echo /home/mitty/tmp/usr/utvpncmd/utvpncmd '"$@"' >> /home/mitty/tmp/usr/bin/utvpncmd 
     219echo 'exit $?' >> /home/mitty/tmp/usr/bin/utvpncmd 
     220chmod 755 /home/mitty/tmp/usr/bin/utvpncmd 
     221 
     222-------------------------------------------------------------------- 
     223Installation completed successfully. 
     224 
     225Please execute 'utvpnserver start' to run UT-VPN Server Background Service. 
     226Or please execute 'utvpnclient start' to run UT-VPN Client Background Service. 
     227And please execute 'utvpncmd' to run UT-VPN Command-Line Utility to configure UT-Server or UT-VPN Client. 
     228-------------------------------------------------------------------- 
     229}}} 
     230 
     231 * mitty@precise:~$ mv tmp utvpn-unix-v101-7101-public.mips 
     232 * mitty@precise:~$ tar czf utvpn-unix-v101-7101-public.mips.tar.gz utvpn-unix-v101-7101-public.mips 
     233 
     234 * mitty@starseed:~/utvpn-unix-v101-7101-public.mips/usr/utvpncmd$ ./utvpncmd 
     235{{{ 
     236Bus error 
     237}}} 
     238  * うまく動かない 
     239  * [http://wiki.livedoor.jp/taiki_kondo/d/UT-VPN/Debian UT-VPN/Debian - 判ってるよねWiki - livedoor Wiki(ウィキ)] 
     240  * [http://blog.falconsrv.net/2012/05/ut-vpnubuntu-1204.html Falcon’s Diary: UT-VPNのビルド方法(Ubuntu 12.04)] 
     241 
     242 === update openssl headers === 
     243 * 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/ 
     244 * 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/ 
     245 * 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/ 
     246 * mitty@precise:~/openwrt/trunk/package/utvpn$ make CC=mips-openwrt-linux-gcc LD=mips-openwrt-linux-ld 
     247 
     248 
     249 * mitty@precise:~/openwrt/trunk/package/utvpn$ make install PREFIX=~/utvpn-unix-v101-7101-public.mips 
     250 
     251 === it works ! === 
     252 * mitty@starseed:~$ ./utvpn-unix-v101-7101-public.mips/usr/utvpnclient/utvpnclient 
     253{{{ 
     254SoftEther UT-VPN Client Service Program 
     255Copyright (C) 2004-2010 SoftEther Corporation. 
     256Copyright (C) 2004-2010 University of Tsukuba, Japan. 
     257Copyright (C) 2003-2010 Daiyuu Nobori. 
     258All Rights Reserved. 
     259 
     260utvpnclient Command Usage: 
     261 utvpnclient start  - Start SoftEther UT-VPN Client Service. 
     262 utvpnclient stop   - Stop SoftEther UT-VPN Client Service if the service is already started. 
     263}}} 
     264 * mitty@starseed:~$ ./utvpn-unix-v101-7101-public.mips/usr/utvpnclient/utvpnclient start 
     265{{{ 
     266SoftEther UT-VPN Client Service Started. 
     267}}} 
     268 
     269* mitty@starseed:~$ ps w | tail 
     270{{{ 
     27129986 root         0 SW   [flush-mtd-unmap] 
     27229987 mitty     2100 S    -bash 
     27329992 mitty     1548 S    /usr/sbin/screen -d -RR -U 
     27429993 mitty     4344 S    {screen} /usr/sbin/SCREEN -d -RR -U 
     27529994 mitty     2648 S    /bin/bash 
     27630026 root         0 SW   [kworker/0:0] 
     27730033 mitty     4164 S    /home/mitty/utvpn-unix-v101-7101-public.mips/usr/utvpnclient/utvpnclient execsvc 
     27830034 mitty    11948 S    /home/mitty/utvpn-unix-v101-7101-public.mips/usr/utvpnclient/utvpnclient execsvc 
     27930043 mitty     1492 R    ps w 
     28030044 mitty     1492 S    tail 
     281}}} 
     282 * mitty@starseed:~$ netstat -nap --inet | grep utvpn 
     283{{{ 
     284(Not all processes could be identified, non-owned process info 
     285 will not be shown, you would have to be root to see it all.) 
     286tcp        0      0 0.0.0.0:9930            0.0.0.0:*               LISTEN      30034/utvpnclient 
     287}}} 
     288 == zlib == 
     289 * [http://www.crosscompile.org/static/pages/ZLib.html How to Cross Compile Zlib Compression Library - Step by Step Guide (crosscompile.org)] 
     290 
     291 * mitty@precise:~$ export PATH=$PATH:~/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/ 
     292 * mitty@precise:~$ export STAGING_DIR=~/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ 
     293 
     294 * mitty@precise:~/openwrt$ wget http://zlib.net/zlib-1.2.7.tar.gz 
     295 * mitty@precise:~/openwrt/zlib-1.2.7$ ./configure --prefix=$STAGING_DIR 
     296 * mitty@precise:~/openwrt/zlib-1.2.7$ vim Makefile 
     297{{{#!diff 
     298--- Makefile.old        2012-06-17 20:05:08.485384996 +0900 
     299+++ Makefile    2012-06-17 20:16:36.692585953 +0900 
     300@@ -16,7 +16,7 @@ 
     301 # To install in $HOME instead of /usr/local, use: 
     302 #    make install prefix=$HOME 
     303  
     304-CC=gcc 
     305+CC=mips-openwrt-linux-gcc 
     306  
     307 CFLAGS=-O3  -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN 
     308 #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 
     309@@ -27,8 +27,8 @@ 
     310 SFLAGS=-O3  -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN 
     311 LDFLAGS=  
     312 TEST_LDFLAGS=-L. libz.a 
     313-LDSHARED=gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map 
     314-CPP=gcc -E 
     315+LDSHARED=mips-openwrt-linux-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map 
     316+CPP=mips-openwrt-linux-gcc -E 
     317  
     318 STATICLIB=libz.a 
     319 SHAREDLIB=libz.so 
     320@@ -36,9 +36,9 @@ 
     321 SHAREDLIBM=libz.so.1 
     322 LIBS=$(STATICLIB) $(SHAREDLIBV) 
     323  
     324-AR=ar 
     325+AR=mips-openwrt-linux-ar 
     326 ARFLAGS=rc 
     327-RANLIB=ranlib 
     328+RANLIB=mips-openwrt-linux-ranlib 
     329 LDCONFIG=ldconfig 
     330 LDSHAREDLIBC=-lc 
     331 TAR=tar 
     332}}} 
     333 
     334 * mitty@precise:~/openwrt/zlib-1.2.7$ make 
     335 * mitty@precise:~/openwrt/zlib-1.2.7$ make install 
     336{{{ 
     337cp libz.a /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib 
     338chmod 644 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib/libz.a 
     339cp libz.so.1.2.7 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib 
     340chmod 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 
     341cp zlib.3 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//share/man/man3 
     342chmod 644 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//share/man/man3/zlib.3 
     343cp zlib.pc /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib/pkgconfig 
     344chmod 644 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib/pkgconfig/zlib.pc 
     345cp zlib.h zconf.h /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//include 
     346chmod 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 
     347}}} 
     348 
     349 == openssl == 
     350 * [http://www.crosscompile.org/static/pages/OpenSSL.html How to Cross Compile OpenSSL a Step by Step Guide (crosscompile.org)] 
     351 
     352 * mitty@precise:~/openwrt$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz 
     353 * mitty@precise:~/openwrt/openssl-1.0.1c$ vim Makefile 
     354{{{#!diff 
     355--- Makefile.old        2012-05-11 00:18:25.000000000 +0900 
     356+++ Makefile    2012-06-17 20:29:26.155761089 +0900 
     357@@ -26,10 +26,10 @@ 
     358 # for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/. 
     359 # Normally it is left empty. 
     360 INSTALL_PREFIX= 
     361-INSTALLTOP=/usr/local/ssl 
     362+INSTALLTOP=/home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ 
     363  
     364 # Do not edit this manually. Use Configure --openssldir=DIR do change this! 
     365-OPENSSLDIR=/usr/local/ssl 
     366+OPENSSLDIR=/home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ 
     367  
     368 # NO_IDEA - Define to build without the IDEA algorithm 
     369 # NO_RC4  - Define to build without the RC4 algorithm 
     370@@ -59,15 +59,15 @@ 
     371 # equal 4. 
     372 # PKCS1_CHECK - pkcs1 tests. 
     373  
     374-CC= cc 
     375+CC= mips-openwrt-linux-gcc 
     376 CFLAG= -O 
     377 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 
     378 PEX_LIBS=  
     379 EX_LIBS=  
     380 EXE_EXT=  
     381 ARFLAGS=  
     382-AR= ar $(ARFLAGS) r 
     383-RANLIB= /usr/bin/ranlib 
     384+AR= mips-openwrt-linux-ar $(ARFLAGS) r 
     385+RANLIB= mips-openwrt-linux-ranlib 
     386 NM= nm 
     387 PERL= /usr/bin/perl 
     388 TAR= tar 
     389}}} 
     390 
     391 * mitty@precise:~/openwrt/openssl-1.0.1c$ make 
     392 * mitty@precise:~/openwrt/openssl-1.0.1c$ make install 
     393 
     394 * mitty@precise:~$ file openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/openssl 
     395{{{ 
     396openwrt/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 
     397}}} 
     398 
     399 == ncurses == 
     400 * mitty@precise:~/openwrt$ wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz 
     401 * mitty@precise:~/openwrt/ncurses-5.9$ CC=mips-openwrt-linux-gcc ./configure --prefix=$STAGING_DIR 
     402{{{ 
     403checking for egrep... grep -E 
     404Configuring NCURSES 5.9 ABI 5 (Sun Jun 17 21:04:38 JST 2012) 
     405checking build system type... x86_64-unknown-linux-gnu 
     406checking host system type... x86_64-unknown-linux-gnu 
     407checking target system type... x86_64-unknown-linux-gnu 
     408Configuring for linux-gnu 
     409checking for prefix... /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ 
     410checking for gcc... mips-openwrt-linux-gcc 
     411checking for C compiler default output... a.out 
     412checking whether the C compiler works... configure: error: cannot run C compiled programs. 
     413If you meant to cross compile, use `--host'. 
     414}}} 
     415 
     416 === configure with host=mips-unknown-linux-gnu === 
     417 * 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 
     418{{{ 
     419checking for mips-unknown-linux-gnu-g++... no 
     420checking for mips-unknown-linux-gnu-c++... no 
     421checking for mips-unknown-linux-gnu-gpp... no 
     422checking for mips-unknown-linux-gnu-aCC... no 
     423checking for mips-unknown-linux-gnu-CC... no 
     424checking for mips-unknown-linux-gnu-cxx... no 
     425checking for mips-unknown-linux-gnu-cc++... no 
     426checking for mips-unknown-linux-gnu-cl... no 
     427checking for mips-unknown-linux-gnu-FCC... no 
     428checking for mips-unknown-linux-gnu-KCC... no 
     429checking for mips-unknown-linux-gnu-RCC... no 
     430checking for mips-unknown-linux-gnu-xlC_r... no 
     431checking for mips-unknown-linux-gnu-xlC... no 
     432checking for g++... g++ 
     433}}} 
     434  * oops 
     435 
     436 === configure with host=mips-openwrt-linux === 
     437 * mitty@precise:~/openwrt/ncurses-5.9$ CC=mips-openwrt-linux-gcc CXX=mips-openwrt-linux-g++ ./configure --prefix=$STAGING_DIR --host=mips-openwrt-linux 
     438 * mitty@precise:~/openwrt/ncurses-5.9$ make 
     439{{{ 
     440compatibility.cc:(.text._ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEi+0x188): undefined reference to `_Unwind_Resume' 
     441collect2: ld returned 1 exit status 
     442make[1]: *** [demo] Error 1 
     443make[1]: Leaving directory `/home/mitty/openwrt/ncurses-5.9/c++' 
     444make: *** [all] Error 2 
     445}}} 
     446 
     447 * https://dev.openwrt.org/browser/trunk/package/ncurses/Makefile のCONFIGURE_ARGSを参考にする 
     448 
     449 * 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 
     450 * mitty@precise:~/openwrt/ncurses-5.9$ make 
     451 * mitty@precise:~/openwrt/ncurses-5.9$ make install 
     452 
     453 == readline == 
     454 * mitty@precise:~/openwrt$ wget ftp://ftp.cwru.edu/pub/bash/readline-5.2.013.tar.gz 
     455 * mitty@precise:~/openwrt/readline-5.2.013$ wget ftp://ftp.cwru.edu/pub/bash/readline-5.2-patches/readline52-014 
     456 * mitty@precise:~/openwrt/readline-5.2.013$ patch < readline52-014 
     457{{{ 
     458patching file mbutil.c 
     459}}} 
     460 * mitty@precise:~/openwrt/readline-5.2.013$ CC=mips-openwrt-linux-gcc ./configure --prefix=$STAGING_DIR --host=mips-openwrt-linux 
     461 * mitty@precise:~/openwrt/readline-5.2.013$ make 
     462 * mitty@precise:~/openwrt/readline-5.2.013$ make install