Cross compile gdb for arm. ubuntu 11.10(64bits) python2.7

どうもUbuntu11.10にしてから、まともにarm版gdb7.xが動作していない。一番の理由はUbuntu11.10にインストールされているpyhton2.7.2+のso (64bits)との相性。
そのため、gdb for armをコンパイルすることにした{実行はPCで行い、android(arm)のデバックをremoteで行う}


環境:Android NDK r7b, OS ubuntu 11.10(64bits),linux kernel 3.0.x, python2.7.2+


http://www.gnu.org/software/gdb/

gdb7.3.1のtarget arm cross compile
  • 現在gdb7.4はmake設定にバグがあってmakeinfoがないとコンパイル中にいってくる。repositoryから取得が必要あり
  • したがってgdb7.3.1を取得し解凍
  • ./configure --host=x86_64-linux-gnu --target=arm-elf-linux --with-python=/usr/bin/python2.7
  • x86_64-linux-gnu-gcc, x86_64-linux-gnu-arが/usr/bin内に存在を確認
  • arがない場合、sudo ln -s ar /usr/bin/x86_64-linux-gnu-ar
  • make
  • sudo make install
参考:Ubuntu 11.10でのコンパイルツールは以下のようになっている。
/usr/bin $ ls -al x86_64*
lrwxrwxrwx 1 root root 7 2011-11-29 21:35 x86_64 -> setarch
lrwxrwxrwx 1 root root 2 2012-02-22 14:32 x86_64-linux-gnu-ar -> ar
lrwxrwxrwx 1 root root 7 2011-11-29 21:35 x86_64-linux-gnu-cpp -> cpp-4.6
lrwxrwxrwx 1 root root 7 2011-11-29 21:35 x86_64-linux-gnu-cpp-4.6 -> cpp-4.6
lrwxrwxrwx 1 root root 7 2011-08-14 16:16 x86_64-linux-gnu-g++ -> g++-4.6
lrwxrwxrwx 1 root root 7 2011-09-16 23:29 x86_64-linux-gnu-g++-4.6 -> g++-4.6
lrwxrwxrwx 1 root root 7 2011-11-29 21:35 x86_64-linux-gnu-gcc -> gcc-4.6



以上で、コンパイルができた。


実行してみると...
/usr/local/bin $ ./arm-elf-linux-gdb
GNU gdb (GDB) 7.3.1
Copyright (C) 2011 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-linux-gnu --target=arm-elf-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) _


--host=x86_64-linux-gnu --target=arm-elf-linuxはndkについてくるgdb6.xと同じオプションになっている。

簡単な動作確認をしたところbreak pointやs, nは動作。pythonで書かれたqt-printerなども動作。

PS
最後にコンパイルした/usr/local/bin内、gdb, gdbtuiをr7bのtoolchainsへ上書きが必要。その後、ndk-gdbが7.3.1で動作。念のため。


コメント

このブログの人気の投稿

日本でコンピュータサイエンスを学ぶ難しさ

How to preview nif file on the ubuntu.