Armadilloフォーラム

QtでLCDの画面をportraitで使う方法

yse

2014年12月8日 16時59分

お世話になります。

Armadillo-410 液晶モデル開発セットを使用して、セミナーの手順でQtを使ってGUIソフトを作製しています。
デフォルトではLCD画面は横長のlandscapeですが、縦長のportraitに変えることは可能でしょうか?

試しに、環境変数でQWS_DISPLAY=Transformed:Rot90と設定してみましたが、
transformed: driver not found
となって実行できませんでした。

よろしくお願い致します。
山田

コメント

at_takashi.sasayama

2014年12月9日 21時14分

笹山です。

> Armadillo-410 液晶モデル開発セットを使用して、セミナーの手順でQtを使ってGUIソフトを作製しています。
> デフォルトではLCD画面は横長のlandscapeですが、縦長のportraitに変えることは可能でしょうか?

可能です。

> 試しに、環境変数でQWS_DISPLAY=Transformed:Rot90と設定してみましたが、
> transformed: driver not found
> となって実行できませんでした。

Qtライブラリのビルド時に -qt-gfx-transformed が有効になっていない為、本現象が発生します。

以下、2014/12/09時点でのQt4最新版 v4.8.6 で、 -qt-gfx-transformed を有効にしたライブラリのビルド方法です。
ビルド環境と手順は、下記のHowto、イメージをベースにしています。

Howto : Armadillo-440でQt! 第2回
http://armadillo.atmark-techno.com/howto/armadillo-440-qt-2

ビルド環境:atde4-qt-amd64-20130131.zip
http://armadillo.atmark-techno.com/files/downloads/sample/a440-qt-howto…

Linuxカーネル:linux-2.6.26-at20
http://armadillo.atmark-techno.com/files/downloads/armadillo-410/source…

atmark-dist:v20141128
http://armadillo.atmark-techno.com/files/downloads/armadillo-410/source…

========================
Qtライブラリのビルド
========================
ここでは、Qt4.8.6 を -qt-gfx-transformed を有効にしてビルド後、ATDE4にインストールします。
QtのビルドにはPCスペックにもよりますが、1時間程かかる場合があります。

atmark@atde4:~$ wget http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz
atmark@atde4:~$ tar zxvf qt-everywhere-opensource-src-4.8.6.tar.gz 
atmark@atde4:~$ mkdir qt4-build
atmark@atde4:~$ cd qt4-build/
atmark@atde4:~$ export PKG_CONFIG_PATH=/usr/lib/pkgconfig
atmark@atde4:~$ sed -i "s/arm-none-linux-gnueabi/arm-linux-gnueabi/" qt-everywhere-opensource-src-4.8.6/mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf
atmark@atde4:~$ ../qt-everywhere-opensource-src-4.8.6/configure -embedded arm \
-xplatform qws/linux-arm-gnueabi-g++ -force-pkg-config -release -opensource -confirm-license \
-shared -prefix /usr/local/Trolltech/Qt-4.8.6-qws-armel/ \
-largefile -no-exceptions -no-accessibility -stl -plugin-sql-sqlite -no-qt3support \
-no-xmlpatterns -multimedia -audio-backend -no-phonon -no-phonon-backend -no-svg \
-no-webkit -no-javascript-jit -script -scripttools -declarative \
-system-zlib -system-libtiff -system-libpng -system-libmng -system-libjpeg \
-openssl -no-nis -cups -iconv -dbus -plugin-kbd-linuxinput -plugin-mouse-tslib -qt-mouse-linuxinput -glib \
-nomake tests -nomake examples -nomake docs -nomake demos -make tools \
-qt-gfx-transformed 
atmark@atde4:~$ make
atmark@atde4:~$ sudo make install

ホスト用にビルドするには、以下のオプションで configure をして、
make, sudo make install を実行してください。

../qt-everywhere-opensource-src-4.8.6/configure \
-platform linux-g++-64 -force-pkg-config -release -opensource -confirm-license \
-shared -prefix /usr/local/Trolltech/Qt-4.8.6-x11-amd64/ \
-largefile -no-exceptions -no-accessibility -stl -plugin-sql-sqlite -no-qt3support \
-no-xmlpatterns -multimedia -audio-backend -no-phonon -no-phonon-backend -no-svg \
-no-webkit -javascript-jit -script -scripttools -declarative \
-system-zlib -system-libtiff -system-libpng -system-libmng -system-libjpeg \
-openssl -no-nis -cups -iconv -dbus -glib \
-nomake tests -nomake examples -nomake docs -nomake demos -make tools \
-qt-gfx-transformed 

========================
qt-creatorの設定
========================
以下のHowtoで Qt-4.8.3 となっている個所を、Qt-4.8.6 に置き換えて作業を進めます。

Howto : Armadillo-440でQt! 第3回
http://armadillo.atmark-techno.com/howto/armadillo-440-qt-3

========================
atmark-distとの統合
========================

最新版のatmark-dist v20141128 に Qtを導入する手順を記載します。

atmark@atde4:~$ wget http://armadillo.atmark-techno.com/files/downloads/armadillo-410/source/dist/atmark-dist-20141128.tar.gz
atmark@atde4:~$ tar zxf atmark-dist-20141128.tar.gz
atmark@atde4:~$ cd atmark-dist-20141128/vendors/AtmarkTechno
atmark@atde4:~$ 本ディレクトリに添付の atmark-dist20141128-Armadillo-440.Qt_.tar.gz を格納します。
atmark@atde4:~$ tar zxf atmark-dist20141128-Armadillo-440.Qt_.tar.gz
atmark@atde4:~$ cd ~/
atmark@atde4:~$ wget http://armadillo.atmark-techno.com/files/downloads/armadillo-410/source/kernel/linux-2.6.26-at20.tar.gz
atmark@atde4:~$ tar zxf linux-2.6.26-at20.tar.gz
atmark@atde4:~$ cd ~/atmark-dist-20141128
atmark@atde4:~$ ln -s ~/linux-2.6.26-at20 linux-2.6.x
atmark@atde4:~$ make menuconfig
 
Main Menu
  Vendor/Product Selection
    Vendor: AtmarkTechno
    Products: Armadillo-440.Qt
を選択
 
以下はNを選択する。
ssh-vulnkey (CONFIG_USER_OPENSSH_SSHVULNKEY) [N/y/?] (NEW) 
sh-pkcs11-helper (CONFIG_USER_OPENSSH_SSHPKCS11) [N/y/?] (NEW)
 
atmark@atde4:~$ make

========================
Armadilloの起動
========================

Howto : Armadillo-440でQt! 第1回
http://armadillo.atmark-techno.com/howto/armadillo-440-qt-1

上記、Howtoの解説に従い、RAMDISKのサイズを64MB(61440kB)に設定します。

hermit> setenv console=ttymxc1 ramdisk_size=61440

ビルドできたイメージでArmadilloを起動します。
以上の作業で -qt-gfx-transformed を有効になります。

以下のコマンドを実行すると、縦画面にqtアプリが起動するのを確認できると思います。

[root@armadillo440-0 (ttymxc1) ~]# export QWS_MOUSE_PROTO=tslib:/dev/input/event1
[root@armadillo440-0 (ttymxc1) ~]# QWS_DISPLAY=Transformed:Rot270  hello_qml -qws
ファイル ファイルの説明
atmark-dist20141128-Armadillo-440.Qt_.tar.gz atmark-dist-20141128 Qt4.8.6 用

yse

2014年12月11日 20時55分

山田です。
対応ありがとうございます。

ARM用のQtライブラリのmake install までは成功しましたが、
ホスト用のQtライブラリのビルドで失敗して、詰まっております。
ホストはi386で、ATDEはatde4-i386-qt-20131205を使用しています。
このATDEにはもともと、Qt-4.8.3が入っています。
ホストのコンパイラGCCは今まで/usr/bin/g++を使用しています。

configureをオプションを
-prefix /usr/local/Trolltech/Qt-4.8.6-x11-amd64

-prefix /usr/local/Trolltech/Qt-4.8.6-x11-i386
のように変更し、

-platform linux-g++-64

-platform linux-g++
のように変更して試してみましたが、makeすると下記のようにエラーで止まります。

<前略>
qtconcurrentiteratekernel.cpp:(.text+0x38): undefined reference to `clock_gettime'
.obj/release-shared-emb-arm/qthread_unix.o: In function `QThreadPrivate::createEventDispatcher(QThreadData*)':
qthread_unix.cpp:(.text+0x60c): undefined reference to `QEventDispatcherGlib::QEventDispatcherGlib(QObject*)'
qthread_unix.cpp:(.text+0x6b4): undefined reference to `QEventDispatcherGlib::versionSupported()'
.obj/release-shared-emb-arm/qbytearray.o: In function `qUncompress(unsigned char const*, int)':
qbytearray.cpp:(.text+0x1e34): undefined reference to `uncompress'
.obj/release-shared-emb-arm/qbytearray.o: In function `qCompress(unsigned char const*, int, int)':
qbytearray.cpp:(.text+0x45a0): undefined reference to `compress2'
.obj/release-shared-emb-arm/qelapsedtimer_unix.o: In function `qt_gettime()':
qelapsedtimer_unix.cpp:(.text+0x244): undefined reference to `clock_gettime'
.obj/release-shared-emb-arm/qelapsedtimer_unix.o: In function `QElapsedTimer::elapsed() const':
qelapsedtimer_unix.cpp:(.text+0x354): undefined reference to `clock_gettime'
.obj/release-shared-emb-arm/qelapsedtimer_unix.o: In function `QElapsedTimer::restart()':
qelapsedtimer_unix.cpp:(.text+0x430): undefined reference to `clock_gettime'
.obj/release-shared-emb-arm/qelapsedtimer_unix.o: In function `QElapsedTimer::nsecsElapsed() const':
qelapsedtimer_unix.cpp:(.text+0x50c): undefined reference to `clock_gettime'
.obj/release-shared-emb-arm/qelapsedtimer_unix.o: In function `QElapsedTimer::start()':
qelapsedtimer_unix.cpp:(.text+0x5ec): undefined reference to `clock_gettime'
.obj/release-shared-emb-arm/qcoreapplication.o: In function `QCoreApplicationPrivate::createEventDispatcher()':
qcoreapplication.cpp:(.text+0x1140): undefined reference to `QEventDispatcherGlib::QEventDispatcherGlib(QObject*)'
qcoreapplication.cpp:(.text+0x1174): undefined reference to `QEventDispatcherGlib::versionSupported()'
collect2: ld returned 1 exit status
make[1]: *** [../../lib/libQtCore.so.4.8.6] エラー 1
make[1]: ディレクトリ `/home/atmark/qt_prepare/qt4-build/src/corelib' から出ます
make: *** [sub-corelib-make_default-ordered] エラー 2

configureの-platformを「-platform linux-g++-32」 あるいは、 「-platform linux-g++-64 」のままでmakeしても同様のエラーで止まりました。

原因分かりますでしょうか?
よろしくお願い致します。

at_kojiro.yamada

2014年12月12日 13時23分

アットマークテクノの山田です。

ホスト用にビルドするには
2つ、手順が不足していました。

まず、
違うコンフィギュレーションでビルドする前には、
make confclean を実行する必要があります。
i386用に configure する前に、 make confclean を実行してみてください。

参考情報:configure 完了時のメッセージ

To reconfigure, run 'make confclean' and 'configure'.

次に、
i386用にビルドするには、以下のパッケージが必要になるのでインストールしておきます。

sudo apt-get update
sudo apt-get install libdbus1-dev libjpeg62-dev libtiff4-dev libmng-dev libssl-dev

手順の抜けについては以上です。

ATDE4 i386用のコンフィギュレーションは以下になります。

../qt-everywhere-opensource-src-4.8.6/configure \
-platform linux-g++-32 -force-pkg-config -release -opensource -confirm-license \
-shared -prefix /usr/local/Trolltech/Qt-4.8.6-x11-i386/ \
-largefile -no-exceptions -no-accessibility -stl -plugin-sql-sqlite \
-no-qt3support \
-no-xmlpatterns -multimedia -audio-backend -no-phonon \
-no-phonon-backend -no-svg \
-no-webkit -javascript-jit -script -scripttools -declarative \
-system-zlib -system-libtiff -system-libpng -system-libmng -system-libjpeg \
-openssl -no-nis -cups -iconv -dbus -glib \
-nomake tests -nomake examples -nomake docs -nomake demos -make tools \
-qt-gfx-transformed

yse

2014年12月24日 21時43分

yse山田です。

ありがとうございます。

上記の
sudo apt-get install libdbus-1-dev libjpeg62-dev libtiff4-dev libmng-dev libssl-dev
で、
libdbus1-dev → libdbus-1-dev
と修正したらできました。