Tizen SDK付属のEmulatorイメージを作成する - Tizen nerdの続き。Tizenアプリケーションに取り敢えずログを入れて、rebuildし、Emulatorで動かしてみます。
どうも上手く行きませんでした。ospを通るアプリだからでしょうか、、、うーむ。。。
ソースのダウンロード
ひとまず、rebuildの対象はWebBrowser(Internet)にします。Internetのソースコードをgitリポジトリからcloneしてきます。最近のgbsでもそのままgit cloneできます。個人的にgit cloneの直打ちに慣れてしまったのでmogurisoは下記の用にしてcloneしています。(落ちてこない場合はsshの設定など、環境構築を見なおしてみて下さい)
$ git clone review.tizen.org:apps/osp/Internet Internet
clone直後の状態ではmasterが空リポジトリを見ているので、2.0 releaseのbranchに変更します。一応確認すると
$ git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/master remotes/origin/tizen_2.0
という感じなので
$ git checkout remotes/origin/tizen_2.0
として、
$ git checkout -b tizen_2.0
とかします。(他にスマートなやり方をご存知な方はご教示下さい。。。)
GBSの設定変更
$(HOME)/.gbs.config の定義をemulator向けに修正します。
[repo.tizen_latest] url = https://download.tizen.org/snapshots/2.0-emul/common/latest/ [repo.tizen_base] url = https://download.tizen.org/snapshots/2.0-emul/common/latest/repos/base [repo.tizen_main] url = https://download.tizen.org/snapshots/2.0-emul/common/latest/repos/main
独自にデバッグログを追加する
ログを出力するAPIは複数用意されており、EFLとOSP層でも呼び方が異なるようです。取り敢えず低レイヤーではdlogを共通して呼び出すようなので framework/system/dlog/include/dlog.h の
549 #define print_apps_log(prio, tag, fmt...) \ 550 __dlog_print(LOG_ID_APPS, prio, tag, fmt)
辺りを使おうと思えば使えそうです。ただ、
543 /* 544 * =========================================================================== 545 * 546 * The stuff in the rest of this file should not be used directly. 547 */
直接呼ぶなとのことなので、Internetの場合は
56 if (IsFailed(r)) 57 { 58 AppLogException("Application execution failed-[%s].", GetErrorMessage(r));
辺りを参考にAppLogExceptionを呼べば表示されてくれるかも知れません。。。と思ったのですが、 framework/osp/appfw/inc/FBaseLog.h を見ると
43 #if defined(_APP_LOG) || defined(_OSP_DEBUG_) || defined(_DEBUG)
があると
49 #define AppLogException(...) AppLogExceptionInternal(__PRETTY_FUNCTION__, __LINE__, __VA_ARGS__)
で、無いと
139 #define AppLogDebug(...)
空関数にされる様です。実体のAppLogExceptionInternalそのものはあるようなので、マクロをundefして実体にしてみます。(下記)
40 //add 41 #undef AppLog(...) 42 #undef AppLogDebug(...) 43 #undef AppLogException(...) 44 #define AppLog(...) AppLogInternal(__PRETTY_FUNCTION__, __LINE__, __VA_ARGS__) 45 #define AppLogDebug(...) AppLogDebugInternal(__PRETTY_FUNCTION__, __LINE__, __VA_ARGS__) 46 #define AppLogException(...) AppLogExceptionInternal(__PRETTY_FUNCTION__, __LINE__, __VA_ARGS__) 47 //add
build
git cloneしたディレクトリに移動して
$ gbs lb -A i586
初回はちょっと時間が掛かりますが、なんとなくbuild出来ました。
エミュレータへインストール
buildしたファイルは下記に展開されます。
$(HOME)/GBS-ROOT/local/repos/tizen2.0emul/i586/RPMS
これをsdbを使ってエミュレータに転送します。
$ sdb push apps.Internet-1.0.0.0-1.i586.rpm /opt/home/app/ * daemon not running. starting it now on port 26099 * * daemon started successfully * apps.Internet-1.0.0.0-1.i586.rpm 1220 KB/s (736147 bytes in 0.589s)
次にsdb shellでrpmを上書きします。
$ sdb shell rpm -Uvh --force /opt/home/app/apps.Internet-1.0.0.0-1.i586.rpm Preparing... ########################################### [100%] 1:apps.Internet ########################################### [100%] (略)
実行
何故かアプリアイコンが消えてしまったので、sdbで直接実行して見ました。
sh-4.1# ./Internet [sys_assert]START of sighandler [sys-assert]exepath = ./Internet [sys-assert]processname = Internet [sys_assert]this thread is main thread. pid=2246 [sys-assert]cs timestr 1366447534 sighandler = 0xb7746c70, g_sig_oldact[i] = (nil) [sys_assert]END of sighandler Segmentation fault sh-4.1# /usr/apps/kmcele1k0n/bin/Internet Application initialization failure for kmcele1k0n.
・・・どうも、設定やら何やらに不備があるのか、起動手順を誤っているのか、理由はよくわかりませんがseg faultするようになってしまいました。
22:42追記
エラーメッセージを出しているのは、"appfw/src/app/FApp_AppInfo.cpp" の
47 void _OSP_EXPORT_ 48 InitAppInfo(const char* appId, const char* svcId, int argc, char* pArgv[], int fd) 49 { 50 result r = Tizen::App::_AppInfo::GetAppInfo()->Construct(appId, svcId, argc, pArgv); 51 if (IsFailed(r)) 52 { 53 SysLogException(NID_APP, E_SYSTEM, "Application initialization failure for %s.", appId); 54 fprintf(stderr, "Application initialization failure for %s.\n", appId); 55 56 _Process::Exit(-1); 57 } 58 }
見たいです。具体的に何が悪いのかはよくわかりません。。。うーむ、、、
26:52追記
EFLアプリはフルパス指定で実行すると起動する。OSPアプリはSeg落ちする。何かありそう。。