1.insight的交叉编译
从insight的官网http://sourceware.org/insight/下载最新版本的insight,目前是GDB/Insight6.8-1.
如果仅是简单地
./confiugre--host=arm-none-linux-gnueabi--prefix=/usr/local/arm
进行配置,会出现下面错误:
--------------------------------------------------------------------------------------------------
In file included from/home/lucid/software/insight-6.8-1/tk/unix/../generic/tkInt.h:21,
/home/lucid/software/insight-6.8-1/tk/unix/../generic/tk.h:96:fatal error: X11/Xlib.h: No such file or directory
compilation terminated.
make[3]: *** [tk3d.o] Error 1
make[3]: Leaving directory`/home/lucid/software/insight-6.8-1/tk/unix'
make[2]: *** [all] Error 2
make[2]: Leaving directory`/home/lucid/software/insight-6.8-1/tk'
make[1]: *** [all-tk] Error 2
make[1]: Leaving directory`/home/lucid/software/insight-6.8-1'
make: *** [all] Error 2
------------------------------------------------------------------------------------------------
开始仅是简单地认为,insight依赖于glib,交叉编译glib后,仍会出现上面的错误:
回过头认真地想一想,编译的还是在宿主机上的程序,但是程序是调试设备上运行的程序,因此应该是典型的交叉编译问题,
要设置正确的--host选项和--target选项
正确配置如下:
./configure --host=i686-pc-linux-gnu--target=arm-none-linux-gnueabi--prefix=/opt/arm-linux-insight
然后编译:
make
这时会出现下面的简单的一个错误:
------------------------------------------------------------------------------------------------
../.././tcl/unix/../compat/strstr.c: Infunction 'strstr':
../.././tcl/unix/../compat/strstr.c:40:warning: argument 'string' doesn't match built-inprototype
../.././tcl/unix/../compat/strstr.c:40:warning: argument 'substring' doesn't match built-inprototype
../.././tcl/unix/../compat/strstr.c:67:error: 'NULL' undeclared (first use in this function)
../.././tcl/unix/../compat/strstr.c:67:error: (Each undeclared identifier is reported only once
../.././tcl/unix/../compat/strstr.c:67:error: for each function it appears in.)
make[3]: *** [strstr.o] Error 1
---------------------------------------------------------------------------------------------
只要在源码strstr.c中67行将NULL改为0,就能顺利编译
make install
安装成功后,将PATH路径中加入/opt/arm-linux-insight/bin,在图形界面的命令行中执行
arm-none-linux-gnueabi-insight
就会出现insight的图形调试界面
2.编译gdbserver
然后进入gdb/gdbserver目录
./configure--host=arm-none-linux-gnueabi--prefix=/usr/local/arm
make
sudo make install
会在/usr/local/arm/bin中找到gdbserver,将其拷到开发板的执行文件路径中,就可以启动gdbserver进行嵌入式设备的调试了