1

を使用して Android エミュレーターで iOS アプリを実行しようとしています。Apportable

ターミナルで次のコマンドを使用して、アプリをコンパイルして実行します

ROOTED=yes MTP=no apportable debug

エミュレータは次の設定でセットアップされます。

Apportable を使用しているときに Android Device Simulator を xcode にインストールできますか

正常にコンパイルされますがSIGSEGV、アプリがエミュレーターのスプラッシュ画面にあるときにセグメンテーション違反が発生します。トレースを取得しようとすると、bt何も表示されません。

エラーのトレースを取得する方法についての解決策をグーグルで試しましたが、うまくいきませんでした。

からの出力は次のTerminalとおりです。

Debugging...
1871 KB/s (26836917 bytes in 14.005s)
    pkg: /data/local/tmp/Chaser-debug.apk
Success
Starting: Intent { cmp=Cromian.CHASER/com.apportable.activity.VerdeActivity (has extras) }

Failed to load one the Breakpoints files:
/Users/Anders/Documents/Xcode/iOS_code/Cromian/Chaser/chaser_app/Chaser.xcodeproj/xcuserdata/Anders.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
/Users/Anders/Documents/Xcode/iOS_code/Cromian/Chaser/chaser_app/Chaser.xcodeproj/xcuserdata/Anders.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

Attaching to pid 1149
Attached; pid = 1149
Listening on port 5039
657 KB/s (9592 bytes in 0.014s)
GNU gdb (GDB) 7.5-https://github.com/apportable/gdb Jan  3 2014 13:47:56
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin12.4.0 --target=arm-elf-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Remote debugging from host 127.0.0.1
warning: Could not load shared library symbols for gralloc.goldfish.so.
Do you need "set solib-search-path" or "set sysroot"?
libthread_db:td_ta_new: Probing system for platform bug.
libthread_db:td_ta_new: Running as root, nothing to do.
0x40037ebc in epoll_wait ()
   from /Users/Anders/.apportable/cache/devices/emulator-5554/libs/libc.so
$1 = 1
$2 = 0
Breakpoint 1 at 0x5cadf2c8: file /Users/Anders/Documents/Xcode/iOS_code/Cromian/Chaser/chaser_app/Chaser/main.m, line 13.
Breakpoint 2 at 0x5a1d8ed0
[New Thread 1169]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1169]
0x40005a1e in ?? ()
(gdb) bt
#0  0x40005a1e in ?? ()
#1  0x400044d2 in ?? ()
#2  0x400044d2 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?) 

セグメンテーション違反の原因を見つけるにはどうすればよいですか?

編集: コマンド x/200a $sp を使用することにより、セグメンテーション違反の後、次のトレースを取得できました。

(gdb) x/200a $sp
0x57b7fac0: 0x0 0x0 0x57b7fbe0  0xcb18276c
0x57b7fad0: 0x0 0x0 0x40015964  0x40015a88
0x57b7fae0: 0x40015bac  0x40015cd0  0x40010bd4  0x40011064
0x57b7faf0: 0x40011188  0x400100ac  0x40010cf8  0x40010e1c
0x57b7fb00: 0x40010f40  0x0 0x28    0x0
0x57b7fb10: 0xcb18276c  0xcb18276c  0xcb18276c  0x3f000000
0x57b7fb20: 0x0 0xffffffd1  0x2d0   0x0
0x57b7fb30: 0x4045adcc  0x2a19da10  0x2a187260  0x4045fcb0
0x57b7fb40: 0x404584b8  0x1 0x57b80c6c  0x4003ecbb <snprintf+79>
0x57b7fb50: 0x0 0x0 0x400174c4  0x580ce000
0x57b7fb60: 0x580ce034  0x40003ff9  0x400175c0  0x57b7fc07
0x57b7fb70: 0x0 0xfdc   0xffff0208  0x57b7fbe4
0x57b7fb80: 0xfff   0x26    0x57b7fba8  0x400174c4
0x57b7fb90: 0x0 0x57b7fbe4  0x2a187260  0x4045fcb0
0x57b7fba0: 0x404584b8  0x40003f4b  0x57b7fbe4  0x4000
0x57b7fbb0: 0x3c14001   0x3c10000   0x57b7fbe4  0x4045adcc
0x57b7fbc0: 0x2a19da10  0x400050bf  0x0 0x4044758f
0x57b7fbd0: 0x2a187260  0x5a8ff01c <__CFStrAllocateMutableContents+80>  0x584d1040  0x4006b228 <__stack_chk_guard>
0x57b7fbe0: 0x30025 0x7379732f  0x2f6d6574  0x2f62696c
0x57b7fbf0: 0x2f6c6765  0x4562696c  0x655f4c47  0x616c756d
0x57b7fc00: 0x6e6f6974  0x6f732e    0x0 0x0
0x57b7fc10: 0x0 0x0 0x0 0x0
0x57b7fc20: 0x0 0x20    0x5a86695c <__CFAllocatorSystemAllocate>    0x0
0x57b7fc30: 0x57b7fd08  0x1 0x0 0x5844f640 <arena_malloc+1020>
0x57b7fc40: 0x5b04ae00  0x0 0x1728  0x12
0x57b7fc50: 0x0 0x10    0x20    0x1
0x57b7fc60: 0x57b7fc80  0x58449d48 <__wrap_malloc+240>  0x57b7fc78  0x20
0x57b7fc70: 0x600   0x5d1b9461  0x1 0x5d1b9440
0x57b7fc80: 0x5d1b9460  0x0 0x5d1b9460  0x0
0x57b7fc90: 0x0 0x14    0xcb18276c  0x20
0x57b7fca0: 0x12    0x2 0x57b7fd80  0x1
0x57b7fcb0: 0xa 0x0 0x5a9d2270 <_MergedGlobals+112> 0x7
0x57b7fcc0: 0x0 0x5d1b9581  0xcb18276c  0x5d1b9560
---Type <return> to continue, or q <return> to quit---
0x57b7fcd0: 0x5d1b9580  0x0 0x5d1b9580  0x0
0x57b7fce0: 0x0 0x3 0x0 0x20
0x57b7fcf0: 0x2 0x1 0x57b7fdd0  0x1
0x57b7fd00: 0xa 0x0 0x5a9d2270 <_MergedGlobals+112> 0x57b7fe08
0x57b7fd10: 0x2c78  0x0 0x0 0x57b7fd20
0x57b7fd20: 0x200078c   0x5a1b6860 <OSAtomicCompareAndSwap32+76>    0x5a86695c <__CFAllocatorSystemAllocate>    0x6325
0x57b7fd30: 0x584d11a8  0x7fffffff  0xa 0x4004471b <strtol+163>
0x57b7fd40: 0x5d1b9584  0x57b7fd94  0xa 0x5d1b9583
0x57b7fd50: 0x5d1b9584  0x1 0x5d1a67e0  0x1
0x57b7fd60: 0x584d10d0  0x88    0x5d1a67e0  0x5844f65c <arena_malloc+1048>
0x57b7fd70: 0x584d11a8  0x1 0x584d1040  0x1728
0x57b7fd80: 0x5d1b95e0  0x0 0x584d1358  0x584d1040
0x57b7fd90: 0x0 0x5844f640 <arena_malloc+1020>  0x5d1b3cc4  0x0
0x57b7fda0: 0x1728  0x7c    0x584d1040  0x5a2e64dc <_atomic_lock>
0x57b7fdb0: 0x20348 0x5b00f660  0x584d1040  0x80860000
0x57b7fdc0: 0x20348 0x5b00f660  0x80860000  0x5a1b6860 <OSAtomicCompareAndSwap32+76>
0x57b7fdd0: 0x5cc3a164 <OBJC_CLASS_$_VerdeActivity> 0x5b04ae00  0x5cc3a164 <OBJC_CLASS_$_VerdeActivity> 0x1e
4

1 に答える 1

0

apportableを使って最新のcocos2dゲームをiTermからAndroidエミュレータに移植してみました。Androidエミュレーターでゲームを正常にロードしてテストしました。Android デバイスでアプリをテストするために新しいデバイスを購入することはないので、これは私にとって大きな成果です。だから、ここに解決策があります。

いくつかの調査の結果、エミュレーターによる OpenGLES ドライバー パスの不足により、セグメンテーション フォールトが発生することがわかりました。ターミナルからエミュレータ (AVD Manager 経由で追加) を初期化する際に、OpenGL パスが正しく見つからない場合、ターミナルはコンソールに次のようなエラーを表示します。

エミュレータ: エラー: OpenGLES エミュレーション ライブラリを読み込めませんでした: dlopen(libOpenglRender.dylib, 1): イメージが見つかりません
emulator: 警告: ソフトウェア レンダラーを使用して OpenglES エミュレーションを初期化できませんでした。

したがって、この問題を修正しないと、確実にセグメンテーション違反が発生します。この問題を解決するには、Android SDK ツールの lib パスをエクスポートする必要があります。詳細はこちらをご確認ください。

openGLES ドライバーのパスを修正したら。「apportable load」コマンドを使用して、ゲームを Android エミュレーターにロードできます。「適切なデバッグ」(フラグ付き)がうまくいかなかったことに注意してください。エミュレーターではなく、デバイスのみがデバッグの読み込みをサポートするためだと思います。いくつかのエミュレーターを追加して試してみたところ、結果は問題ありませんでした。

注: 16 GB RAM の Macbook pro Retina を使用しています。エミュレーターのロードは、大量の RAM と処理を必要とするため、少し遅くなる可能性があります。

移植おめでとうございます。

于 2014-02-25T10:50:14.193 に答える