2011. 7. 12.

Qt 4.8 설치하기 (Qt Lighthouse)

드디어 오랜 동안 연구 프로젝트로 사용되던 Qt Lighthouse가 연구 프로젝트에서
실제 Qt repository로 들어가게 되었다.
이말의 의미는 Qt 4.8에는 Lighthouse처럼 Qt가 X library나 X windows를 거치지 않고,
직접적으로 Kernel을 통하여 Rendering이 가능하게 된다는 의미가 된다.

따라서 기존에 쓰이는 lighthouse git (git://gitorious.org/+qt-developers/qt/lighthouse.git) 은 더이상 쓰이지 않게 되었으며, 그냥 역사적의미로만 남겨둔다고 한다.

Lighthouse is no longer a research project. It is now a part of Qt 4.8, and will be the foundation for Qt 5. This repository is now closed.

Old repository description for historical purposes.
위에 내용은 expired된 예전 git에서 그대로 복사해온 것이고 이제 QPA ( project name: Lighthouse)를 쓰기 위해서는 Qt 4.8을 qt gitorious에서 그대로 받아 오면 된다.
Cloning this repository:
git clone git://gitorious.org/qt/qt.git qt
cd qt
Add this repository as a remote to an existing local repository:
git remote add qt git://gitorious.org/qt/qt.git
git fetch qt
git checkout -b my-local-tracking-branch qt/4.8
위의 Checkout 시 적절한 이름 my-local-tracking-branch나 qpa-branch 등과 같이 사용해서 checkout 해주고, configure/make/make install 의 과정을 거치면 된다.
필자가 사용한 configure를 예제로 하자면 다음과 같다.

# ../qt/configure -prefix /usr/local/qt-qpa -confirm-license -qpa -developer-build -verbose  2>&1 | tee MyConfigure.log
# make -j4   (j이후의 숫자는 자신의 CPU수에 맞춰서 알아서, 느린 PC의 경우에는 그냥 make)
# make install (sudo make install)

그리고 다음으로 해주어야 하는 작업이 있는데
# cd /"qt 4.8 src folder"/src/plugins/platforms
# make 
# make install

해주면 현재 platform에서 사용할 수 있는 plugin들을 설치 해준다.
현재 4.8버전에서 지원해 주는 plugin은 다음과 같다.
cocoa      (Macintosh 환경)
directfb    (DirectFB 환경)
eglfs        (egl 환경)
fb_base
linuxfb      (Linux Framebuffer 환경)
minimal
openkode  (openkode 환경)
qvfb          (Virtual Frame buffer 환경)
uikit          (iOS 환경)
vnc           (vnc 환경)
wayland    (wayland환경)
xcb
xlib           (X Window 환경)

위와 같이 platform을 구축해 주면
다음과 같이 실행 시킬 수 있다.

실행 방법

# ./qtapplication -platform Xlib
# ./qtapplication -platform cocoa
# ./qtapplication -platform directfb


2011. 7. 1.

Byte Order conversion in Qt (Qt에서 Endian 전환)


- Endian Conversion Functions


    Qt 에서 엔디안 바이트 전환은 다음의 함수 들을 통해 편리하게 할 수 있다.

      상당히 편리하고 유용하다.
       필자도 Endian conversion 때문에 골치 아픈 경우가 있었는데,


#include <QtEndian>

    한줄을 header파일로 추가 하고 간단히 해결 하였다.

Functions


T

qFromBigEndian
 ( const uchar * src )
TqFromBigEndian ( T src )
TqFromLittleEndian ( const uchar * src )
TqFromLittleEndian ( T src )
voidqToBigEndian ( T src, uchar * dest )
TqToBigEndian ( T src )
voidqToLittleEndian ( T src, uchar * dest )
TqToLittleEndian ( T src )



Qt 에서 64 bit Data를 Hex값으로 출력하고 싶을 때

How to make 64bit data value into Hex display?

물론 Qt 에서 사용하는 QDebug()를 사용하면 된다.

너무 간단한 solution이지만, 실제 코딩할 때 쓸데없이 시간 소모가 되는 경우가 있으므로 정리

uint64_t TimeStamp;
or
qint64 TimeStamp;


 qDebug(" Transmit TimeStamp(hex) = %llx ", TimeStamp);


2011. 6. 27.

Android 용 Qt Framework compile 하는 방법

준비해야 하는 사항
  • 최신의 Official Android NDK를 다운로드 하고 설치한다.
  • 최신의 Official Android SDK를 다운로드 하고 설치한다.
--------------------------------------------------------------------------------
Android-lighthouse Repository를 Gitorious clone(gitorious에 대한 정보는 Googling해 보시길)

# git clone git://gitorious.org/~taipan/qt/android-lighthouse.git



Prepare & compile Qt

"Qt android-lighthouse" git clone시킨 폴더로 이동하여 "androidconfigbuild.sh"을 실행시킨다.
"androidconfigbuild.sh"을 기존의 qt configure와 동일한 역할을 하며, Qt를 처음 설치할때 한번만 실행시켜 주면 된다.

# cd /path/to/cloneOfandroid-lighthouse/,
# ./androidconfigbuild.sh -n "Android NDK를 설치한 폴더 절대경로" -q 1

만일 이미 설치 환경과 개발 framework가 구성되어 있는 상태에서 Qt만 컴파일 하기를 원한다면 아래와 같이 "-q 1" option을 제거하여 주면 된다.

# ./androidconfigbuild.sh -n "Android NDK를 설치한 폴더 절대 경로"

Android용 Qt-lighthouse 의 컴파일이 완료되면 컴파일된 Qt Library를 Android Device에 넣어 주어야 하는데 다음과 같은 방식으로 QtCreator를 이용하면 된다.
Target 에서 Testing 개발 중일 경우에는
 use device Qt library를 check해서 사용

Deploy를 원할 경우에는 Projects->Android (run tab)->Deploy configurations->Deploy local qt libs 옵션 사용



--------------------------------------------------------------------------------
androidconfigbuild.sh 은 아래와 같은 파라메터를 이용할 수 있다.
"androidconfigbuild.sh -p " 를 통하면 아래와 같은 help를 읽을 수 있다.


usage: ./androidconfigbuild.sh options



OPTIONS:

-p Shows this message

-c Clean qt

-q Qt build options

0 - don't configure qt (only compile) default

1 - configure qt and compile qt

-b Build qt

0 - don't build

1 - build

-s Install qt

0 - don't install

1 - install

-n NDK root. Default "/usr/local/android-ndk-r5b"

-o NDK host. Default "linux-x86"

-f NDK toolchain prefix. Default "arm-linux-androideabi"

-v NDK toolchain version. Default "4.4.3"

-a Target cpu architecture. Default "armeabi"

armeabi - tune for android arm v5

armeabi-v7a - tune for android arm v7

Optional name suffix: v5/v7

-h Shared

0 - Build static version of qt

1 - Build shared version of qt

-x Exceptions options

0 - don't use exceptions (you won't be able to build qtcreator with such a qt though)

1 - use exceptions

Optional name suffix: Xc/Nx

-d Build debug qt

Optional name suffix: D/R/DaR

-r Build release qt

Optional name suffix: R/D/DaR

-m Modify install path according to passed in options (name suffixes applied in above listed order).

-i Install path. Default "/home/your-name/path/to/android-lighthouse"

2011. 6. 15.

mips Target Board에서 Webkit을 올릴 때의 난감한 상황 undefined reference to `sinf'

mips 칩이 저렴해서 인지 settop box나 ipTV나 멀티미디어 플레이어에서 많이 사용된다.
하지만 최근 들어 피해 갈 수 없는 대세인 모듈이 있으니, 두둥 그것은 webkit
QtWebkit을 올리려면 rendering을 하는 측에서 (예를 들어 line이나 curve 등을 그릴때)
sine 이나 cosine 같은 삼각 함수를 쓰게 되는데
오래된 싸구려 mips 칩에서는 이를 지원하지 않는다..
uClibc 0.9.28 이상에서는 floating math 함수들을 지원한다.
uClibc 0.9.27 이하에서는 floating math 함수들을 지원하지 않는다.

문제점으로는 qline이나 curve 함수들이 컴파일 시 Link 되지 않는다.
undefined reference to `sinf'
undefined reference to `cosf'
undefined reference to `logf'

이를 해결 하기 위한 임시 대응책

$QTDIR/src/corelib/kernel/qmath.h
에다가

inline float sinf( float s)
{
   return (float)sin(s);
}


inline float cosf( float s)
{
   return (float)cos(s);
}

inline float logf( float s)
{
   return (float)log(s);
}

추가함

절대적으로 임시 방편이며, 속도가 많이 느려진다... 특히 Animation
그냥 uClibc 0.9.28 이상을 사용하시길....
양산 후 library 절대 올리기 싫어 하는 경우도 있긴 하지만... 이해는 어렵다...털썩...


2011. 6. 9.

Kbuntu 설치후 Qt 최신 설치할때 많이 요청 되어 지는 라이브러리

sudo apt-get install build-essential
처음에 개발자 도구 들이 설치 되지 않았을 때

sudo apt-get install libx11-dev
configure시 x11 관련 에러가 나왔을 때 : error: X11/Xlib.h: No such file or directory

sudo apt-get install libxext-dev
configure시 "cannot find -lXext" 와 같은 에러 메시지가 나왔을 때

sudo apt-get install libgstreamer0.10-dev
configure시 gstreamer가 설정되지 않을때

sudo apt-get install libxrender-dev
Webkit compile 시 "cannot find -lXrender"와 같은 에러 메시지가 나왔을 때



2011. 5. 31.

Official Qt Mobility 1.2.0 릴리스

Qt Mobility 플러그인 라이브러리가 2011년 5월 12일자로 1.2.0으로 Release 되었습니다.

Qt Mobility version 1.2.0 의 새로운 feature로 소개된 것들로는
- 기존 mobility module들의 개선 사항 추가
- Bluetooth device 와의 쉬운 integration 기능
- NFC ready device support
(Near Field Communication : 5m 이내 통신에 유용하며 RFID와 유사합니다)
- 그외 QtMessaging, QtServiceFramework, QtSensors 와 QML 지원 모듈들
http://doc.qt.nokia.com/qtmobility-1.2/index.html

다음에서 다운 로드 받아 사용하실 수 있습니다.
http://get.qt.nokia.com/qt/add-ons/qt-mobility-opensource-src-1.2.0.zip
http://get.qt.nokia.com/qt/add-ons/qt-mobility-opensource-src-1.2.0.tar.gz

Meego 사용자의 경우 : http://download.meego.com/live/devel:/qt-mtf/Trunk/
sudo zypper addrepo http://download.meego.com/live/devel:/qt-mtf/Trunk/ devel-qt-mtf
sudo zypper refresh
sudo zypper install qt-mobility
sudo zypper install qt-mobility-example

Gitorious (깃토리오스) 사용자의 경우
http://qt.gitorious.org/ 에서 Qt-mobility의 'v1.2.0' Tag를 사용하실 수 있습니다.