GDのクロスコンパイル
1.準備
・ここでの内容も、http://d.hatena.ne.jp/NeoCat/20070910こ
こを参考にさせて頂いた。
・クロスコンパイル環境は、libpngと同様zlibをコンパイルしたものをそのまま使用する。
・クロスコンパイル用gccのある場所にパスを通は通っているはずである。# echo $PATHで確認して
通っていないならば再度通しておく。
・zlib libpng libjpeg の各種ファイルを以下のディレクトリーにコピーする。
理由は良く解らない。下に示す./configureで赤字部分がYes
にならなかった。
thinkpad:/home/anabuki/work/kamikaze_7.09/staging_dir_mips/lib#
cp -rf /root/work/nagios/local/lib/* .
thinkpad:/home/anabuki/work/kamikaze_7.09/staging_dir_mips/include# cp
-rf /root/work/nagi
os/local/include/* .
|
・http://www.boutell.com/gd/http/gd-2.0.33.tar.gzよ
りソースもらってきてこれを適当な
ディレクトリーで展開する。私は/root/work/nagios以下を使用した。
・thinkpad:~/work/nagios# tar zxvf
gd-2.0.33.tar.gz
2.クロスコンパイルの実行
・./configureの実行
thinkpad:‾/work/nagios/gd-2.0.33# ./configure
--build=i686-linux --host=mips-linux --targe
t=mips-linux --enable-shared --prefix=/root/work/nagios/local/
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for mips-linux-strip... mips-linux-strip
checking for mips-linux-gcc... mips-linux-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether mips-linux-gcc accepts -g... yes
checking for mips-linux-gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of mips-linux-gcc... gcc3
checking for mips-linux-gcc... (cached) mips-linux-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether mips-linux-gcc accepts -g... (cached) yes
checking for mips-linux-gcc option to accept ANSI C... (cached) none
needed
checking dependency style of mips-linux-gcc... (cached) gcc3
checking for a BSD-compatible install... /usr/bin/install -c
checking build system type... i686-pc-linux-gnu
checking host system type... mips-unknown-linux-gnu
checking for ld used by GCC...
/home/anabuki/work/kamikaze_7.09/staging_dir_mips/mips-linux-uclibc/bin/ld
checking if the linker
(/home/anabuki/work/kamikaze_7.09/staging_dir_mips/mips-linux-uclibc/bin/ld)
is GNU ld... yes
checking for
/home/anabuki/work/kamikaze_7.09/staging_dir_mips/mips-linux-uclibc/bin/ld
option to reload object files... -r
checking for BSD-compatible nm...
/home/anabuki/work/kamikaze_7.09/staging_dir_mips/bin/mips-linux-nm -B
checking for a sed that does not truncate output...
/home/anabuki/work/kamikaze_7.09/staging_dir_mips/bin/sed
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking command to parse
/home/anabuki/work/kamikaze_7.09/staging_dir_mips/bin/mips-linux-nm -B
output... ok
checking how to run the C preprocessor... mips-linux-gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for mips-linux-ranlib... mips-linux-ranlib
checking for mips-linux-strip... (cached) mips-linux-strip
checking for objdir... .libs
checking for mips-linux-gcc option to produce PIC... -fPIC
checking if mips-linux-gcc PIC flag -fPIC works... yes
checking if mips-linux-gcc static flag -static works... yes
checking if mips-linux-gcc supports -c -o file.o... yes
checking if mips-linux-gcc supports -c -o file.lo... yes
checking if mips-linux-gcc supports -fno-rtti -fno-exceptions... no
checking
whether the linker
(/home/anabuki/work/kamikaze_7.09/staging_dir_mips/mips-linux-uclibc/bin/ld)
supports shared libraries... yes
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether -lc should be explicitly linked in... no
creating libtool
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for mips-linux-ranlib... (cached) mips-linux-ranlib
checking for X... no
checking for ANSI C header files... (cached) yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking for ld used by GCC...
/home/anabuki/work/kamikaze_7.09/staging_dir_mips/mips-linux-uclibc/bin/ld
checking if the linker
(/home/anabuki/work/kamikaze_7.09/staging_dir_mips/mips-linux-uclibc/bin/ld)
is GNU ld... yes
checking for shared library run path origin... done
checking for iconv... no, consider installing GNU libiconv
checking iconv.h usability... no
checking iconv.h presence... no
checking for iconv.h... no
checking for sin... no
checking for sin in -lm... yes
checking for deflate in -lz... yes
checking for libpng12-config... /usr/local/bin/libpng12-config
checking for libpng-config... /usr/local/bin/libpng-config
checking png.h usability... yes
checking png.h presence... yes
checking for png.h... yes
checking for png_create_read_struct in -lpng12... yes
checking for freetype-config... no
checking for FT_Init_FreeType in -lfreetype... no
configure: WARNING: not found - disabling freetype support
checking ft2build.h usability... no
checking ft2build.h presence... no
checking for ft2build.h... no
no
checking for FcInit in -lfontconfig... no
checking for jpeg_set_defaults in -ljpeg... yes
checking for XpmReadFileToXpmImage in -lXpm... no
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for cc_r... mips-linux-gcc
** Configuration summary for gd 2.0.33:
Support for PNG
library:
yes
Support for JPEG
library:
yes
Support for Freetype 2.x library: no
Support for Fontconfig
library: no
Support for Xpm
library:
no
Support for
pthreads:
yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config/Makefile
config.status: creating config/gdlib-config
config.status: creating test/Makefile
config.status: creating config.h
config.status: executing depfiles commands
|
・makeの実行
thinkpad:~/work/nagios/gd-2.0.33# make
CC=mips-linux-gcc
メッセージは長すぎるので省略する |
・make installの実行
thinkpad:‾/work/nagios/gd-2.0.33# make install
Making install in config
make[1]: ディレクトリ `/root/work/nagios/gd-2.0.33/config' に入ります
make[2]: ディレクトリ `/root/work/nagios/gd-2.0.33/config' に入ります
test -z "/root/work/nagios/local//bin" || mkdir -p --
"/root/work/nagios/local//bin"
/usr/bin/install -c 'gdlib-config'
'/root/work/nagios/local//bin/gdlib-config'
make[2]: `install-data-am' に対して行うべき事はありません.
make[2]: ディレクトリ `/root/work/nagios/gd-2.0.33/config' から出ます
make[1]: ディレクトリ `/root/work/nagios/gd-2.0.33/config' から出ます
Making install in test
make[1]: ディレクトリ `/root/work/nagios/gd-2.0.33/test' に入ります
make[2]: ディレクトリ `/root/work/nagios/gd-2.0.33/test' に入ります
make[2]: `install-exec-am' に対して行うべき事はありません.
make[2]: `install-data-am' に対して行うべき事はありません.
make[2]: ディレクトリ `/root/work/nagios/gd-2.0.33/test' から出ます
make[1]: ディレクトリ `/root/work/nagios/gd-2.0.33/test' から出ます
make[1]: ディレクトリ `/root/work/nagios/gd-2.0.33' に入ります
make[2]: ディレクトリ `/root/work/nagios/gd-2.0.33' に入ります
test -z "/root/work/nagios/local//lib" || mkdir -p --
"/root/work/nagios/local//lib"
/bin/sh ./libtool --mode=install /usr/bin/install
-c 'libgd.la' '/root/work/nagios/local//lib/libgd.la'
/usr/bin/install -c .libs/libgd.so.2.0.0
/root/work/nagios/local//lib/libgd.so.2.0.0
(cd /root/work/nagios/local//lib && rm -f libgd.so.2
&& ln -s libgd.so.2.0.0 libgd.so.2)
(cd /root/work/nagios/local//lib && rm -f libgd.so
&& ln -s libgd.so.2.0.0 libgd.so)
/usr/bin/install -c .libs/libgd.lai
/root/work/nagios/local//lib/libgd.la
/usr/bin/install -c .libs/libgd.a /root/work/nagios/local//lib/libgd.a
mips-linux-ranlib /root/work/nagios/local//lib/libgd.a
chmod 644 /root/work/nagios/local//lib/libgd.a
PATH="$PATH:/sbin" ldconfig -n /root/work/nagios/local//lib
----------------------------------------------------------------------
Libraries have been installed in:
/root/work/nagios/local//lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment
variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment
variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to
`/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
test -z "/root/work/nagios/local//bin" || mkdir -p --
"/root/work/nagios/local//bin"
/bin/sh ./libtool --mode=install /usr/bin/install -c
'annotate' '/root/work/nagios/local//bin/annotate'
/usr/bin/install -c .libs/annotate
/root/work/nagios/local//bin/annotate
/bin/sh ./libtool --mode=install /usr/bin/install -c
'gdparttopng' '/root/work/nagios/local//bin/gdparttopng'
/usr/bin/install -c .libs/gdparttopng
/root/work/nagios/local//bin/gdparttopng
/bin/sh ./libtool --mode=install /usr/bin/install -c
'gdtopng' '/root/work/nagios/local//bin/gdtopng'
/usr/bin/install -c .libs/gdtopng /root/work/nagios/local//bin/gdtopng
/bin/sh ./libtool --mode=install /usr/bin/install -c
'gd2copypal' '/root/work/nagios/local//bin/gd2copypal'
/usr/bin/install -c .libs/gd2copypal
/root/work/nagios/local//bin/gd2copypal
/bin/sh ./libtool --mode=install /usr/bin/install -c
'gd2topng' '/root/work/nagios/local//bin/gd2topng'
/usr/bin/install -c .libs/gd2topng
/root/work/nagios/local//bin/gd2topng
/bin/sh ./libtool --mode=install /usr/bin/install -c
'pngtogd' '/root/work/nagios/local//bin/pngtogd'
/usr/bin/install -c .libs/pngtogd /root/work/nagios/local//bin/pngtogd
/bin/sh ./libtool --mode=install /usr/bin/install -c
'pngtogd2' '/root/work/nagios/local//bin/pngtogd2'
/usr/bin/install -c .libs/pngtogd2
/root/work/nagios/local//bin/pngtogd2
/bin/sh ./libtool --mode=install /usr/bin/install -c
'webpng' '/root/work/nagios/local//bin/webpng'
/usr/bin/install -c .libs/webpng /root/work/nagios/local//bin/webpng
/bin/sh ./libtool --mode=install /usr/bin/install -c
'gd2togif' '/root/work/nagios/local//bin/gd2togif'
/usr/bin/install -c .libs/gd2togif
/root/work/nagios/local//bin/gd2togif
/bin/sh ./libtool --mode=install /usr/bin/install -c
'gdcmpgif' '/root/work/nagios/local//bin/gdcmpgif'
/usr/bin/install -c .libs/gdcmpgif
/root/work/nagios/local//bin/gdcmpgif
/bin/sh ./libtool --mode=install /usr/bin/install -c
'giftogd2' '/root/work/nagios/local//bin/giftogd2'
/usr/bin/install -c .libs/giftogd2
/root/work/nagios/local//bin/giftogd2
test -z "/root/work/nagios/local//bin" || mkdir -p --
"/root/work/nagios/local//bin"
/usr/bin/install -c 'bdftogd'
'/root/work/nagios/local//bin/bdftogd'
/usr/bin/install -c 'config/gdlib-config'
'/root/work/nagios/local//bin/gdlib-config'
test -z "/root/work/nagios/local//include" || mkdir -p --
"/root/work/nagios/local//include"
/usr/bin/install -c -m 644 'gd.h'
'/root/work/nagios/local//include/gd.h'
/usr/bin/install -c -m 644 'gdfx.h'
'/root/work/nagios/local//include/gdfx.h'
/usr/bin/install -c -m 644 'gd_io.h'
'/root/work/nagios/local//include/gd_io.h'
/usr/bin/install -c -m 644 'gdcache.h'
'/root/work/nagios/local//include/gdcache.h'
/usr/bin/install -c -m 644 'gdfontg.h'
'/root/work/nagios/local//include/gdfontg.h'
/usr/bin/install -c -m 644 'gdfontl.h'
'/root/work/nagios/local//include/gdfontl.h'
/usr/bin/install -c -m 644 'gdfontmb.h'
'/root/work/nagios/local//include/gdfontmb.h'
/usr/bin/install -c -m 644 'gdfonts.h'
'/root/work/nagios/local//include/gdfonts.h'
/usr/bin/install -c -m 644 'gdfontt.h'
'/root/work/nagios/local//include/gdfontt.h'
/usr/bin/install -c -m 644 'entities.h'
'/root/work/nagios/local//include/entities.h'
make[2]: ディレクトリ `/root/work/nagios/gd-2.0.33' から出ます
make[1]: ディレクトリ `/root/work/nagios/gd-2.0.33' から出ます
|
・全て上手く出来たか確認
thinkpad:~/work/nagios/gd-2.0.33# ls
../local/lib/
libgd.a
libjpeg.la
libpng.la
libpng12.la
libz.so
libgd.la
libjpeg.so
libpng.so
libpng12.so
libz.so.1
libgd.so
libjpeg.so.62
libpng.so.3
libpng12.so.0
libz.so.1.2.3
libgd.so.2
libjpeg.so.62.0.0 libpng.so.3.0.0
libpng12.so.0.0.0 pkgconfig
libgd.so.2.0.0
libpng.a
libpng12.a
libz.a
thinkpad:~/work/nagios/gd-2.0.33# ls ../local/include/
entities.h
gdcache.h gdfontmb.h
gdfx.h
jmorecfg.h
png.h zlib.h
gd.h
gdfontg.h gdfonts.h jconfig.h
jpeglib.h pngconf.h
gd_io.h
gdfontl.h gdfontt.h
jerror.h
libpng zconf.h
|
このように出来ていれば完了である。
|