노무현 대통령 배너


2006. 3. 22. 13:21

[본문스크랩] qt-x11 & qt-embedded & qpe 설치하기 - 출처[kelp]

qt-x11 & qt-embedded & qpe 설치하기.
글쓴이 : 지노 (2002년 01월 29일 오전 09:54) 읽은수: 5,092 [ 체험수기 인쇄용 페이지 ]
우선 qpe를 하기위해서는
qt-x11-2.3.1.tar.gz , qt-embedded-2.3.1.tar.gz , qpe-1.3.1.tar.gz
이 3가지의 소스 파일이 필요하다.

우선 이 소스는 ftp.trolltech.com에서 /pub/qt/source에 가면 다운로드 받을 수 있다.

1. X11용 부터 설치를 하자.

받아온 소스파일의 압축을 해제 한다.

# gunzip qt-x11-2.3.1.tar.gz # 압축해제
# tar xvf qt-x11-2.3.1.tar # 묵음해제

자 그럼 이제 qt-x11-2.3.1 디렉토리가 생겼을 것이다.(디렉토리는 약간 다를 수도 있
다. 나의 경우에는 위 처럼 mv로 바꾸어 놓고 컴파일을 한것 같다.)

압축을 해제한 디렉토리로 cd 명령을 사용하여 이동을 한다.

그리고 환경변수들을 잡아 주어야 한다. 이것을 qtx11_env라고 하는 파일로 vi를 사용하여 만들자.

qtx11_env file내용
----------

QTDIR=<자신이 qt-x11압축을 풀어놓은 디렉토리>
PATH=$QTDIR/bin:$PATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH

export QTDIR PATH LD_LIBRARY_PATH

-------------

파일을 위와 같이 만든 후에
# source ./qtx11_env
명령어를 사용하여 환경변수를 적용하자.

자이제 기반 사항은 대충 된것 같다. 그럼 이제 콘솔에서 다음의 순서대로 실행하면 된다.

# ./configure

This is the Qt Free Edition.

You are licensed to use this software under the terms of either
the Q Public License (QPL) or the GNU General Public License (GPL).

Type 'Q' to view the Q Public License.
Type 'G' to view the GNU General Public License.
Type 'yes' to accept this license offer.
Type 'no' to decline this license offer.

Do you accept the terms of the license?
yes <- 사용자 입력

-- 중략 --

Build type: linux-g++-shared

Thread support..................... no
GIF support........................ no
MNG support........................ no
JPEG support....................... no
NAS sound support.................. no
Session management................. yes
Xft support (Anti-Aliased Fonts) .. yes

Creating makefiles...
Qt is now configured for building. Just run make.
To reconfigure, run make clean and configure.

# make
make[1]: 들어감 `/usr/local/src/qt-x11-2.3.1' 디렉토리
cd src/moc; make
make[2]: 들어감 `/usr/local/src/qt-x11-2.3.1/src/moc' 디렉토리
g++ -c -I/usr/local/src/qt-x11-2.3.1/include -Wno-unused -Wno-parentheses -
pipe -O2 -DQT_NO_CODECS -DQT_LITE_UNICODE -I../../include -I../tools -I. -o
mocgen.o mocgen.cpp
-- 하략 --

를 수행하면 qt라이브러리 컴파일이 끝나게 된다.

* 참고사항 configure에 옵션이 참 많이 있다.
# ./configure --help
하게 되면 상당히 많은 옵션이 나오게 됨을 알 수 있을 것이다.
여러 옵션들을 참고 해서 컴파일 할 수 있다.

2. qt-embedded-2.3.1 컴파일

qt-embedded-2.3.1.tar.gz의 압축을 해제 한다.

압축을 해제하면 x11의 경우와 마찬가지로 qt-em-2.3.1과 같이 풀리지 않을 것이다.
나는 mv명령을 사용하여 변경을 한것임을 알려둔다.

자 그리고 여기서, 환경변수를 만들기 전에 qpe의 압축을 해제 한다.(압축 해제 하는 방법은 언급하지 않는다.)

두가지의 압축을 해제한 후에 x11에서 한것처럼 환경 설정 화일을 만들어 준다.
나의 경우는 qtem_env와 qpe_env 라고 하는 파일을 만들어 주었다.

임베디드 qt의 압축을 해제한 디렉토리로 이동하자. 이동후 vi를 이용하여 다음의 파일을 생성한다.

qtem_env file내용
----------

QTDIR=<자신이 qt-embedded압축을 풀어놓은 디렉토리>
QPEDIR=<자신이 qpe압축을 풀어놓은 디렉토리>
PATH=$QTDIR/bin:$PATH
MANPATH=$QTDIR/doc/man:$MANPATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QTDIR PATH MANPATH LD_LIBRARY_PATH

------------
# source ./qtem_env
로 환경변수를 적용한다.

qpe압축 풀어놓은 디렉토리로 이동하자. vi를 이용하여 qpe_env를 새로 만들자.

qpe_env file내용
----------
export QPEDIR=<자신이 qpe압축을 풀어놓은 디렉토리>
export QTDIR=<자신이 qt embedded압축을 풀어놓은 디렉토리>
export LD_LIBRARY_PATH=$QPEDIR/library:$QTDIR/lib:$QTXDIR/lib:$LD_LIBRARY_PATH
export PATH=$QTDIR/bin:$PATH

--------------------

# source ./qpe_env
로 환경변수를 적용한다.

자 이제 환경변수 설정을 다 했다.

그럼 이제 본격적인 qt-embedded와 qpe설치에 들어간다.

2.1. 우선 qt-embedded에 qpe패치를 해준다.

# cd $QTDIR

# patch -p0 -s < $QPEDIR/qt/qte -for-qpe.patch


여기서 패치 적용할때 에러가 나지 않아야 한다.

2.2. qt 본격적으로 컴파일 하기.

우선 qt-embedded에서 qpe를 지원해주게끔 qpe에 있는 헤더파일을 qt-embedded쪽으로 복사를 한다.

# cp $QPEDIR/qt/qconfig*.h $QTDIR/src/tools

2.3 Embedded QT디렉토리로 이동하고, 환경설정을 하고, 컴파일을 한다.

# cd $QTDIR
# ./configure -qconfig qpe

This is the Qt/Embedded Free Edition.

You are licensed to use this software under the terms of
the GNU General Public License (GPL).

Type 'G' to view the GNU General Public License.
Type 'yes' to accept this license offer.
Type 'no' to decline this license offer.

Do you accept the terms of the license?
yes <- 사용자 입력

Choose pixel-depths to support:

v. VGA-16 - also enables 8bpp
4. 4bpp grayscale - also enables 8bpp
8. 8bpp
16. 16bpp
24. 24bpp - also enables 32bpp
32. 32bpp

Each depth adds around 100Kb on 80386.

Your choices (default 8,16):
엔터키누름(아니면 위에있느것중에 하나 선택해도 됨) <- 사용자 입력

Enable Qt Virtual Framebuffer support for development on X11 (default yes)
엔터키누름 <- 사용자 입력

Build type: linux-x86-g++-shared

Thread support..................... no
Configuration...................... qconfig-qpe.h

Creating makefiles...
Qt is now configured for building. Just run make.
To reconfigure, run make clean and configure.

# make
make[1]: 들어감 `/usr/local/src/qt-em-2.3.1' 디렉토리
cd src/moc; make
make[2]: 들어감 `/usr/local/src/qt-em-2.3.1/src/moc' 디렉토리
-- 이하 생략 --

위와 같이 컴파일을 수행한다.

* 참고사항 configure에 여러개의 옵션이 있다.
# ./configure --help
여러 옵션들을 참고 해서 컴파일 할 수 있다.

컴파일을 다 하면 $QTDIR/lib/libqte.so* 의 파일이 생성 된다.

임베디드 용이므로 라이브러리를 strip을 해주어서 용량을 줄인다.

# strip -R .net -R .comment bin/* $QTDIR/lib/libqte.so* $QTDIR/lib/libqpe.so*
2.3.1/lib/libqte.so* $QTDIR/lib/libqpe.so*
strip: bin/README: File format not recognized
strip: bin/core: File format not recognized

3. qpe 컴파일 하기.

3.1. qpe를 컴파일 하기 위해서는 uic라고 하는 프로그램이 필요하다. 이 프로그램은
qt-x11을 컴파일한 디렉토리의 ./bin/ 디렉토리에 있다. 이 파일을 임베디드 qt/bin
디렉토리로 복사하자.

# cp /bin/uic <임베디드용 qt디렉토리>/bin/.
위처럼 복사를 하자.

3.2. 위의 과정이 정상적으로 끝나게 되면, qpe 디렉토리로 이동한다.
# cd $QPE

3.3. 환경 설정을 한다.
# ./configure
Configuring libmpeg3
done
Creating makefiles...
QPE is now configured for building. Just run make (or make single).
To reconfigure, run make clean and configure.

# make

위처럼 실행을 하였을 경우에 Error가 나지 않게 되면 성공한 것이다.

4. QPE 구동하기.
이제 QPE 실행방법을 알아 보자.

4.1. 우선 X11용 qvfb를 컴파일을 하자.

# cd
# source ./qtx11_env
# cd tools/qvfb
# make

위와 같이 실행을 하게 되면 X윈도우 에서 qpe을 에뮬레이션 하는 qvfb가 생성된다.

4.2. 우선 X윈도우에서 qvfb를 구동을 하자.
(qt-embedded를 16bpp로 컴파일 하였다면 qvfb -depth 16으로 구동한다.)

# ./qvfb & (QTDIR 변수가 qt-x11으로 설정되어 있어야 한다.)

4.3. 가상의 프레임 버퍼가 구동되어 있으니 응용 프로그램을 실행해 보자.
여기서는 위에서 컴파일한 qpe를 구동시킨다.

# $QPEDIR/bin/qpe -qws -display QVFb:0 & (QTDIR 변수가 qt-embedded로 설정)

4.4 qvfb에 qpe가 구동되는 모습이 나타나게 된다.