노력과 삽질 퇴적물

Embedded: QT프로그래밍 준비 본문

📂기초 및 세팅 note/공개 일시중지

Embedded: QT프로그래밍 준비

알 수 없는 사용자 2011. 6. 1. 00:44

* 개발환경
우분투 8.10
QT-x11-free-3.3.8   -> ftp://ftp.trolltech.com/qt/source/qt-x11-free-3.3.8.tar.gz
QT-embedded-free-3.3.8   -> ftp://ftp.trolltech.com/qt/source/qt-embedded-free-3.3.8.tar.gz





1. apt-get install
root@desktop:~# apt-get install build-essential
꾸러미 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다      
상태 정보를 읽는 중입니다... 완료
build-essential 꾸러미는 이미 최신 버전입니다.
0개 업그레이드, 0개 새로 설치, 0개 지우기 및 18개 업그레이드 안 함.
root@desktop:~# apt-get install qt3-dev-tools
꾸러미 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다      
상태 정보를 읽는 중입니다... 완료
...
...
qt3-dev-tools (3:3.3.8-b-0ubuntu3) 설정하는 중입니다 ...

libaudio-dev (1.9.1-1) 설정하는 중입니다 ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place
root@desktop:~# apt-get install qt3-dev-tools-embedded
root@desktop:~# apt-get install qt3-dev-tools-embedded
꾸러미 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다      
상태 정보를 읽는 중입니다... 완료
...
3.8-b-0ubuntu3_i386.deb에서) ...
Processing triggers for man-db ...
qt3-dev-tools-embedded (3:3.3.8-b-0ubuntu3) 설정하는 중입니다 ...
root@desktop:~# tar xvzf qt-x11-free-3.3.8.tar.gz
root@desktop:/usr/local# ls
arm-linux    etc      info  pxa255                    sbin
bin          games    lib   qt-x11-free-3.3.8         share
boa-0.94.13  include  man   qt-x11-free-3.3.8.tar.gz  src
root@desktop:/usr/local# mv qt-x11-free-3.3.8 qtx-3.3.8
root@desktop:~# mv qt-x11-free-3.3.8 qtx-3.3.8
root@desktop:/usr/local# cd qtx-3.3.8
root@desktop:/usr/local/qtx-3.3.8# ./configure -shared -thread -no-cups

This is the Qt/X11 Open Source 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 either license? yes
...
...
  for /usr/local/qtx-3.3.8/examples/qwerty/qwerty.pro
  for /usr/local/qtx-3.3.8/examples/wizard/wizard.pro

Qt is now configured for building. Just run /usr/bin/make.
To reconfigure, run /usr/bin/make confclean and configure.
root@desktop:/usr/local/qtx-3.3.8# ls
FAQ          Makefile       changes-3.3.8  examples    pics     translations
INSTALL      PLATFORMS      config.status  extensions  plugins  tutorial
LICENSE.GPL  README         config.tests   include     qmake
LICENSE.QPL  README-QT.TXT  configure      lib         src
MANIFEST     bin            doc            mkspecs     tools
root@desktop:/usr/local/qtx-3.3.8# aptitude install libx11-dev
...
Accept this solution? [Y/n/q/?] y
The following packages will be DOWNGRADED:
  libx11-6 libxau6 libxcb-xlib0 libxcb1 libxdmcp6
The following NEW packages will be installed:
  libx11-dev libxau-dev{a} libxcb-xlib0-dev{a} libxcb1-dev{a}
  libxdmcp-dev{a}
The following packages will be REMOVED:
  libaudio-dev{u} libgnutls13{u} libgnutlsxx13{u} libgpg-error-dev{u}
  libice-dev{u} libjpeg62-dev{u} liblzo2-2{u} liblzo2-dev{u}
  libopencdk10{u} libqt3-compat-headers{u} libqt3-headers{u}
  x11proto-randr-dev{u} x11proto-render-dev{u} x11proto-xinerama-dev{u}
0 packages upgraded, 5 newly installed, 5 downgraded, 14 to remove and 18 not upgraded.
Need to get 2482kB of archives. After unpacking 3461kB will be freed.
Do you want to continue? [Y/n/?] y
...
...
root@desktop:/usr/local/qtx-3.3.8# aptitude install libxinerama-dev
...
Accept this solution? [Y/n/q/?] y
The following packages will be DOWNGRADED:
  libxext6 libxinerama1
The following NEW packages will be installed:
  libxext-dev{a} libxinerama-dev x11proto-xext-dev{a}
  x11proto-xinerama-dev{a}
0 packages upgraded, 4 newly installed, 2 downgraded, 0 to remove and 18 not upgraded.
Need to get 175kB/181kB of archives. After unpacking 725kB will be used.
Do you want to continue? [Y/n/?] y
...
...



2. make
root@desktop:/usr/local/qtx-3.3.8# vim Makefile
<Makefile중에서>
...
all: symlinks src-qmake src-moc sub-src sub-tools #sub-tutorial sub-examples
        @echo
        @echo "The Qt library is now built in ./lib"
        @echo "The Qt examples are built in the directories in ./examples"
        @echo "The Qt tutorials are built in the directories in ./tutorial"
        @echo
        @echo "Enjoy!   - the Trolltech team"
        @echo
...
root@desktop:/usr/local/qtx-3.3.8# make   -> 20~30정도 소요됨.
...
...
The Qt library is now built in ./lib
The Qt examples are built in the directories in ./examples
The Qt tutorials are built in the directories in ./tutorial

Enjoy!   - the Trolltech team

make[1]: Leaving directory `/usr/local/qtx-3.3.8'
root@desktop:/usr/local/qtx-3.3.8# cd lib
root@desktop:/usr/local/qtx-3.3.8/lib# ls
README                   libqnp.prl         libqui.prl
libdesignercore.a        libqt-mt.la        libqui.so
libdesignercore.prl      libqt-mt.prl       libqui.so.1
libeditor.a              libqt-mt.so        libqui.so.1.0
libeditor.prl            libqt-mt.so.3      libqui.so.1.0.0
libqassistantclient.a    libqt-mt.so.3.3    qt-mt.pc
libqassistantclient.prl  libqt-mt.so.3.3.8



3.  설정
root@desktop:/usr/local/qtx-3.3.8/lib# cd /usr/local/qtx-3.3.8/bin
root@desktop:/usr/local/qtx-3.3.8/bin# ln -s $PWD/qmake /usr/bin/qmake
root@desktop:/usr/local/qtx-3.3.8/bin# ln -s $PWD/uic /usr/bin/uic
root@desktop:/usr/local/qtx-3.3.8/bin# ln -s $PWD/moc /usr/bin/moc
root@desktop:/usr/local/qtx-3.3.8/bin# ln -s $PWD/designer /usr/bin/designer



4. qvfb

root@desktop:/usr/local/qtx-3.3.8/bin# cd /usr/local/qtx-3.3.8/tools/qvfb
root@desktop:/usr/local/qtx-3.3.8/tools/qvfb# ls
LICENSE.GPL  images        qanimationwriter.cpp  qvfbratedlg.cpp  skin.h
Makefile     main.cpp      qanimationwriter.h    qvfbratedlg.h
README       pda.skin      qvfb.cpp              qvfbview.cpp
config.ui    pda_down.png  qvfb.h                qvfbview.h
gammaview.h  pda_up.png    qvfb.pro              skin.cpp
root@desktop:/usr/local/qtx-3.3.8/tools/qvfb# make
/usr/local/qtx-3.3.8/bin/uic -L /usr/local/qtx-3.3.8/plugins config.ui -o config.h
g++ -c -pipe -Wall -W -O2 -D_REENTRANT  -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -I/usr/local/qtx-3.3.8/mkspecs/linux-g++ -I. -I../../src/3rdparty/libpng -I../../src/3rdparty/zlib -I../../include -I.moc/release-shared-mt/ -o .obj/release-shared-mt/qvfb.o qvfb.cpp
...
root@desktop:/usr/local/qtx-3.3.8/tools/qvfb# ln -s $PWD/qvfb /usr/bin/qvfb
root@desktop:/usr/local/qtx-3.3.8/tools/qvfb# qvfb
Using display 0

<메뉴, File-Configure>



5. 임베디드 호스트용 qt소스

root@desktop:/usr/local# tar xvzf qt-embedded-free-3.3.8.tar.gz
root@desktop:/usr/local# mv qt-embedded-free-3.3.8 qte-3.3.8
root@desktop:/usr/local# cd /usr/local/qte-3.3.8
root@desktop:/usr/local/qte-3.3.8# ./configure -thread -shared -qvfb -no-nis -no-stl -no-cups -qt-libpng -qt-libjpeg -no-ipv6

This is the Qt/Embedded Open Source 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:

   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,32):
16   <-HUINS  pro V2의 LCD
...
  for /usr/local/qte-3.3.8/examples/wizard/wizard.pro

Qt is now configured for building. Just run /usr/bin/make.
To reconfigure, run /usr/bin/make confclean and configure.



6. 임베디드 호스트용 make

root@desktop:/usr/local/qte-3.3.8# vim Makefile
<Makefile중에서>
...
all: symlinks src-qmake src-moc sub-src sub-tools #sub-tutorial sub-examples
        @echo
        @echo "The Qt library is now built in ./lib"
        @echo "The Qt examples are built in the directories in ./examples"
        @echo "The Qt tutorials are built in the directories in ./tutorial"
        @echo
        @echo "Enjoy!   - the Trolltech team"
        @echo
...
...
root@desktop:/usr/local/qte-3.3.8# export QTDIR=$PWD
root@desktop:/usr/local/qte-3.3.8# export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
root@desktop:/usr/local/qte-3.3.8# export PATH=$QTDIR:$QTDIR/bin:$LD_LIBRARY_PATH:$PATH



7. 샘플예제 실행

root@desktop:/# cd /usr/local/qte-3.3.8
root@desktop:/usr/local/qte-3.3.8# make
root@desktop:/usr/local/qte-3.3.8# cd examples/hello
root@desktop:/usr/local/qte-3.3.8/examples/hello# ls
Makefile  README  hello.cpp  hello.doc  hello.h  hello.pro  main.cpp
root@desktop:/usr/local/qte-3.3.8/examples/hello# make
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -D_REENTRANT  -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -I/usr/local/qte-3.3.8/mkspecs/qws/linux-x86-g++ -I. -I../../include -I.moc/release-shared-mt-emb-x86/ -o .obj/release-shared-mt-emb-x86/hello.o hello.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -D_REENTRANT  -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -I/usr/local/qte-3.3.8/mkspecs/qws/linux-x86-g++ -I. -I../../include -I.moc/release-shared-mt-emb-x86/ -o .obj/release-shared-mt-emb-x86/main.o main.cpp
/usr/local/qte-3.3.8/bin/moc hello.h -o .moc/release-shared-mt-emb-x86/moc_hello.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -D_REENTRANT  -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -I/usr/local/qte-3.3.8/mkspecs/qws/linux-x86-g++ -I. -I../../include -I.moc/release-shared-mt-emb-x86/ -o .obj/release-shared-mt-emb-x86/moc_hello.o .moc/release-shared-mt-emb-x86/moc_hello.cpp
g++ -Wl,-rpath,/usr/local/qte-3.3.8/lib -o hello .obj/release-shared-mt-emb-x86/hello.o .obj/release-shared-mt-emb-x86/main.o .obj/release-shared-mt-emb-x86/moc_hello.o   -L/usr/local/qte-3.3.8/lib -lqte-mt -ldl -lpthread
root@desktop:/usr/local/qte-3.3.8/examples/hello# qvfb &   <-매 실행마다 '4. qvfb'에서의 16비트 설정필요
[2] 6008
[1]   Done                    qvfb
root@desktop:/usr/local/qte-3.3.8/examples/hello# Using display 0
./hello -qws    <-명령어 입력