Cross-compile Zlib from Linux
리눅스에서 Zlib를 크로스 컴파일 하는 방법.
Debian Lenny에서는 mingw 3.13버전이 설치된다.(2012.12.01 wheezy (testing)이하까지 확인됨)
3.15를 얻기위해 다음과 같이 한다.
mingw32-runtime, mingw32-binutils를 다운로드하고 설치한다.
# wget http://kr.archive.ubuntu.com/ubuntu/pool/universe/m/mingw32-runtime/mingw32-runtime_3.15.2-0ubuntu1_all.deb # dpkg -i mingw32-runtime_3.15.2-0ubuntu1_all.deb # # |
mingw32를 설치한다.
# apt-get install mingw32 |
디렉토리를 생성한다.
# mkdir /opt/mingw
# mkdir /opt/mingw/bin
# mkdir /opt/mingw/include
# mkdir /opt/mingw/lib
|
환경변수를 설정한다.
# AR="/usr/bin/i586-mingw32msvc-ar rc"
# CC=/usr/bin/i586-mingw32msvc-gcc
# CPP=/usr/bin/i586-mingw32msvc-cpp
# CPPFLAGS="-I/usr/i586-mingw32msvc/include -I/opt/mingw/include"
# CXX=/usr/bin/i586-mingw32msvc-g++
# LDFLAGS="-L/usr/i586-mingw32msvc/lib -L/opt/mingw/lib"
# PATH=/usr/i586-mingw32msvc/bin:$PATH
# RANLIB=/usr/bin/i586-mingw32msvc-ranlib
# RC=/usr/bin/i586-mingw32msvc-windres
# WINDRES=/usr/bin/i586-mingw32msvc-windres
# export AR CC CPP CPPFLAGS CXX LDFLAGS PATH RANLIB RC WINDRES
|
configure, make수행
# ./configure --prefix=/opt/mingw
# make
# make install
|
dll을 생성.
# /usr/bin/i586-mingw32msvc-gcc -shared -o /opt/mingw/bin/zlib1.dll -Wl,--out-implib=/opt/mingw/lib/libz.dll.a [!em]*.o |
make시 다음과 비슷한 에러가 나올때..
colinux:/home/mongin/zlib-1.2.5# make
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o example.o example.c
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o adler32.o adler32.c
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o compress.o compress.c
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o crc32.o crc32.c
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o deflate.o deflate.c
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o gzclose.o gzclose.c
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o gzlib.o gzlib.c
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o gzread.o gzread.c
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o gzwrite.o gzwrite.c
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o infback.o infback.c
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o inffast.o inffast.c
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o inflate.o inflate.c
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o inftrees.o inftrees.c
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o trees.o trees.c
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o uncompr.o uncompr.c
/usr/bin/i586-mingw32msvc-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DNO_VIZ -I/usr/i586-mingw32msvc/include -I/opt/mingw/include -c -o zutil.o zutil.c
/usr/bin/i586-mingw32msvc-ar rc rc libz.a adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
/usr/bin/i586-mingw32msvc-ar: libz.a: No such file or directory
make: *** [libz.a] Error 1
|
i586-mingw32msvc-ar의 첫 인자는 command이며 두번째 인자는 디렉토리이다.
그런데 첫인자, 둘째인지 모두 rc로 되어 있다. 아마 두번째 인자가 잘못된듯 보인다.
해결을 위해 rc디렉토리를 하나 만들었다.
# mkdir ./rc
zlib 컴파일 방법
|
'작업일지 > QEMU' 카테고리의 다른 글
Cross-compile QEMU from Linux (0) | 2011.02.13 |
---|---|
Windows에서 qemu의 qow같은 파일 만드는 방법 (0) | 2011.01.31 |
ARM Emulation With QEMU (0) | 2010.11.19 |
qemu, colinux network 작업 (0) | 2010.03.11 |
QEMU로 ARM에뮬레이팅 하기 (0) | 2010.03.01 |