| 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 | ------------------------------------------------------------- |
| 10 | SoftEther UT-VPN for Unix |
| 11 | |
| 12 | Copyright (C) 2004-2010 SoftEther Corporation. |
| 13 | Copyright (C) 2004-2010 University of Tsukuba, Japan. |
| 14 | Copyright (C) 2003-2010 Daiyuu Nobori. All Rights Reserved. |
| 15 | |
| 16 | This program is free software; you can redistribute it and/or |
| 17 | modify it under the terms of the GNU General Public License |
| 18 | version 2 as published by the Free Software Foundation. |
| 19 | ------------------------------------------------------------- |
| 20 | |
| 21 | Please select your Operating System below: |
| 22 | 1: Linux |
| 23 | 2: FreeBSD |
| 24 | 3: Solaris |
| 25 | 4: Mac OS X |
| 26 | |
| 27 | Which is your operating system (1-4): |
| 28 | 1 |
| 29 | |
| 30 | Please select your CPU Bits below: |
| 31 | 1: 32-bit |
| 32 | 2: 64-bit |
| 33 | |
| 34 | Which is the bits of your CPU (1-2): |
| 35 | 1 |
| 36 | |
| 37 | Makefile 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 | {{{ |
| 42 | 5d63c1cbb04ef9a3ecc6d4b8f1150cac20fbfa9d Makefile |
| 43 | 5d63c1cbb04ef9a3ecc6d4b8f1150cac20fbfa9d 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 | {{{ |
| 54 | 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 |
| 55 | mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined |
| 56 | In 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 |
| 58 | compilation terminated. |
| 59 | make: *** [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 | |
| 68 | mips-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 |
| 74 | collect2: 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 | |
| 84 | mips-openwrt-linux-gcc tmp/as/Ham.a -O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -o output/ham/ham |
| 85 | tmp/as/Ham.a(Internat.o): In function `IconvWideToStrInternal': |
| 86 | Internat.c:(.text+0x634): undefined reference to `iconv_open' |
| 87 | Internat.c:(.text+0x648): undefined reference to `iconv_open' |
| 88 | tmp/as/Ham.a(Internat.o): In function `IconvStrToWideInternal': |
| 89 | Internat.c:(.text+0x66c): undefined reference to `iconv_open' |
| 90 | Internat.c:(.text+0x680): undefined reference to `iconv_open' |
| 91 | tmp/as/Ham.a(Internat.o): In function `IconvFreeInternal': |
| 92 | Internat.c:(.text+0x690): undefined reference to `iconv_close' |
| 93 | tmp/as/Ham.a(Internat.o): In function `UnixUniToStr': |
| 94 | Internat.c:(.text+0x7b0): undefined reference to `iconv' |
| 95 | tmp/as/Ham.a(Internat.o): In function `InitInternational': |
| 96 | Internat.c:(.text+0xb68): undefined reference to `iconv_close' |
| 97 | Internat.c:(.text+0xbcc): undefined reference to `iconv_close' |
| 98 | tmp/as/Ham.a(Internat.o): In function `UnixStrToUni': |
| 99 | Internat.c:(.text+0x37e4): undefined reference to `iconv' |
| 100 | collect2: ld returned 1 exit status |
| 101 | make: *** [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 | |
| 113 | mips-openwrt-linux-gcc tmp/as/Ham.a -O2 -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lreadline -lncurses -lz -o output/ham/ham |
| 114 | tmp/as/Ham.a(Internat.o): In function `IconvWideToStrInternal': |
| 115 | Internat.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 |
| 123 | Index: 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 |
| 147 | Index: 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 | {{{ |
| 203 | cp output/utvpnserver/hamcore.utvpn /home/mitty/tmp/usr/utvpnserver/hamcore.utvpn |
| 204 | cp output/utvpnserver/utvpnserver /home/mitty/tmp/usr/utvpnserver/utvpnserver |
| 205 | echo "#!/bin/sh" > /home/mitty/tmp/usr/bin/utvpnserver |
| 206 | echo /home/mitty/tmp/usr/utvpnserver/utvpnserver '"$@"' >> /home/mitty/tmp/usr/bin/utvpnserver |
| 207 | echo 'exit $?' >> /home/mitty/tmp/usr/bin/utvpnserver |
| 208 | chmod 755 /home/mitty/tmp/usr/bin/utvpnserver |
| 209 | cp output/utvpnclient/hamcore.utvpn /home/mitty/tmp/usr/utvpnclient/hamcore.utvpn |
| 210 | cp output/utvpnclient/utvpnclient /home/mitty/tmp/usr/utvpnclient/utvpnclient |
| 211 | echo "#!/bin/sh" > /home/mitty/tmp/usr/bin/utvpnclient |
| 212 | echo /home/mitty/tmp/usr/utvpnclient/utvpnclient '"$@"' >> /home/mitty/tmp/usr/bin/utvpnclient |
| 213 | echo 'exit $?' >> /home/mitty/tmp/usr/bin/utvpnclient |
| 214 | chmod 755 /home/mitty/tmp/usr/bin/utvpnclient |
| 215 | cp output/utvpncmd/hamcore.utvpn /home/mitty/tmp/usr/utvpncmd/hamcore.utvpn |
| 216 | cp output/utvpncmd/utvpncmd /home/mitty/tmp/usr/utvpncmd/utvpncmd |
| 217 | echo "#!/bin/sh" > /home/mitty/tmp/usr/bin/utvpncmd |
| 218 | echo /home/mitty/tmp/usr/utvpncmd/utvpncmd '"$@"' >> /home/mitty/tmp/usr/bin/utvpncmd |
| 219 | echo 'exit $?' >> /home/mitty/tmp/usr/bin/utvpncmd |
| 220 | chmod 755 /home/mitty/tmp/usr/bin/utvpncmd |
| 221 | |
| 222 | -------------------------------------------------------------------- |
| 223 | Installation completed successfully. |
| 224 | |
| 225 | Please execute 'utvpnserver start' to run UT-VPN Server Background Service. |
| 226 | Or please execute 'utvpnclient start' to run UT-VPN Client Background Service. |
| 227 | And 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 | {{{ |
| 236 | Bus 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 | {{{ |
| 254 | SoftEther UT-VPN Client Service Program |
| 255 | Copyright (C) 2004-2010 SoftEther Corporation. |
| 256 | Copyright (C) 2004-2010 University of Tsukuba, Japan. |
| 257 | Copyright (C) 2003-2010 Daiyuu Nobori. |
| 258 | All Rights Reserved. |
| 259 | |
| 260 | utvpnclient 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 | {{{ |
| 266 | SoftEther UT-VPN Client Service Started. |
| 267 | }}} |
| 268 | |
| 269 | * mitty@starseed:~$ ps w | tail |
| 270 | {{{ |
| 271 | 29986 root 0 SW [flush-mtd-unmap] |
| 272 | 29987 mitty 2100 S -bash |
| 273 | 29992 mitty 1548 S /usr/sbin/screen -d -RR -U |
| 274 | 29993 mitty 4344 S {screen} /usr/sbin/SCREEN -d -RR -U |
| 275 | 29994 mitty 2648 S /bin/bash |
| 276 | 30026 root 0 SW [kworker/0:0] |
| 277 | 30033 mitty 4164 S /home/mitty/utvpn-unix-v101-7101-public.mips/usr/utvpnclient/utvpnclient execsvc |
| 278 | 30034 mitty 11948 S /home/mitty/utvpn-unix-v101-7101-public.mips/usr/utvpnclient/utvpnclient execsvc |
| 279 | 30043 mitty 1492 R ps w |
| 280 | 30044 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.) |
| 286 | tcp 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 | {{{ |
| 337 | cp libz.a /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib |
| 338 | chmod 644 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib/libz.a |
| 339 | 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 |
| 340 | 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 |
| 341 | cp zlib.3 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//share/man/man3 |
| 342 | 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 |
| 343 | cp zlib.pc /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib/pkgconfig |
| 344 | chmod 644 /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//lib/pkgconfig/zlib.pc |
| 345 | cp zlib.h zconf.h /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2//include |
| 346 | 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 |
| 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 | {{{ |
| 396 | 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 |
| 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 | {{{ |
| 403 | checking for egrep... grep -E |
| 404 | Configuring NCURSES 5.9 ABI 5 (Sun Jun 17 21:04:38 JST 2012) |
| 405 | checking build system type... x86_64-unknown-linux-gnu |
| 406 | checking host system type... x86_64-unknown-linux-gnu |
| 407 | checking target system type... x86_64-unknown-linux-gnu |
| 408 | Configuring for linux-gnu |
| 409 | checking for prefix... /home/mitty/openwrt/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ |
| 410 | checking for gcc... mips-openwrt-linux-gcc |
| 411 | checking for C compiler default output... a.out |
| 412 | checking whether the C compiler works... configure: error: cannot run C compiled programs. |
| 413 | If 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 | {{{ |
| 419 | checking for mips-unknown-linux-gnu-g++... no |
| 420 | checking for mips-unknown-linux-gnu-c++... no |
| 421 | checking for mips-unknown-linux-gnu-gpp... no |
| 422 | checking for mips-unknown-linux-gnu-aCC... no |
| 423 | checking for mips-unknown-linux-gnu-CC... no |
| 424 | checking for mips-unknown-linux-gnu-cxx... no |
| 425 | checking for mips-unknown-linux-gnu-cc++... no |
| 426 | checking for mips-unknown-linux-gnu-cl... no |
| 427 | checking for mips-unknown-linux-gnu-FCC... no |
| 428 | checking for mips-unknown-linux-gnu-KCC... no |
| 429 | checking for mips-unknown-linux-gnu-RCC... no |
| 430 | checking for mips-unknown-linux-gnu-xlC_r... no |
| 431 | checking for mips-unknown-linux-gnu-xlC... no |
| 432 | checking 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 | {{{ |
| 440 | compatibility.cc:(.text._ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEi+0x188): undefined reference to `_Unwind_Resume' |
| 441 | collect2: ld returned 1 exit status |
| 442 | make[1]: *** [demo] Error 1 |
| 443 | make[1]: Leaving directory `/home/mitty/openwrt/ncurses-5.9/c++' |
| 444 | make: *** [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 | {{{ |
| 458 | patching 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 |