错误信息:
qiang@LinuxSir:~$ sudo arm-elf-insight
Tk_Init failed: Can't find a usable tk.tcl in the following directories:
/usr/local/share/tk8.4 /usr/local/lib/tk8.4 /usr/lib/tk8.4 /usr/local/library /usr/library /usr/tk8.4.1/library /tk8.4.1/library
/usr/local/share/tk8.4/tk.tcl: no event type or button # or keysym
no event type or button # or keysym
while executing
"bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D / 120) * 4}] units
}"
(file "/usr/local/share/tk8.4/listbox.tcl" line 182)
invoked from within
"source /usr/local/share/tk8.4/listbox.tcl"
(in namespace eval "::" script line 1)
invoked from within
"namespace eval :: [list source [file join $::tk_library $file.tcl]]"
(procedure "SourceLibFile" line 2)
invoked from within
"SourceLibFile listbox"
(in namespace eval "::tk" script line 4)
invoked from within
"namespace eval ::tk {
SourceLibFile button
SourceLibFile entry
SourceLibFile listbox
SourceLibFile menu
SourceLibFile panedwindow
SourceLibFile ..."
invoked from within
"if {$::tk_library ne ""} {
if {[string equal $tcl_platform(platform) "macintosh"]} {
proc ::tk::SourceLibFile {file} {
if {[catch {
namesp..."
(file "/usr/local/share/tk8.4/tk.tcl" line 393)
invoked from within
"source /usr/local/share/tk8.4/tk.tcl"
("uplevel" body line 1)
invoked from within
"uplevel #0 [list source $file]"
This probably means that tk wasn't installed properly.
编译insight-6.8前必须修改insight-6.8的源代码。
1)修改insight-6.8/tk/generic/tk.h
将(line 653)
#define VirtualEvent (LASTEvent)
#define ActivateNotify (LASTEvent + 1)
#define DeactivateNotify (LASTEvent + 2)
#define MouseWheelEvent (LASTEvent + 3)
#define TK_LASTEVENT (LASTEvent + 4)
改为:
#define VirtualEvent (MappingNotify)
#define ActivateNotify (MappingNotify + 1)
#define DeactivateNotify (MappingNotify + 2)
#define MouseWheelEvent (MappingNotify + 3)
#define TK_LASTEVENT (MappingNotify + 4)
并将随后的#define TK_LASTEVENT (LASTEvent + 4)删除(line 661附近)
2)修改insight-6.8/tk/generic/tkBind.c
在line 586和line 587之间增加
#ifdef GenericEvent
/* GenericEvent */ 0,
#endif
经测试,已经可以正常启动arm-linux-insight
补充一下:我安装的tk8.5和tcl8.5
错误:
cc1: warnings being treated as errors
.././gdb/cli/cli-cmds.c: In function ‘pwd_command’:
.././gdb/cli/cli-cmds.c:323: error: ignoring return value of ‘getcwd’, declared with attribute warn_unused_result
make[2]: *** [cli-cmds.o] 错误 1
make[2]:正在离开目录 `/home/qiang/tools/insight-6.8-1/gdb'
make[1]: *** [all-gdb] 错误 2
make[1]:正在离开目录 `/home/qiang/tools/insight-6.8-1'
make: *** [all] 错误 2
解决方案:
方法1.修改源代码,
linux-nat.c:2879:error:ignoring return value of 'fgets',declared with attribute warn_unused_result
老代码
fgets(buffer, MAXPATHLEN, procfile);
解决的方法是
char* temp_p = fgets(buffer, MAXPATHLEN, procfile);
类似的问题还有几个,基本上都是gdb的问题,照着解决就行了,我就不一个个说了。
方法2.进入insight-6.8-1/gdb目录,打开Makefile文件搜索-Werror
老代码
WERROR_CFLAGS = -Werror
新代码
WERROR_CFLAGS = #-Werror
这2个办法都可以通过编译,就可以使用insight了。