Tk - 我使用widget时的段错误(按钮,文本)

时间:2011-03-30 15:25:34

标签: dependencies tk fontconfig

我已将Tcl / Tk编译到我的应用程序中。当我打开我的应用程序时,我得到一个窗口(由于Tk_init)我可以操作:

> wm title . "mysh"
> wm geometry . 300x300

但是当我尝试按钮或任何其他小部件时,它会出现段错误

> button .b
Segmentation fault

我在gdb中加载了这个并运行了后退跟踪

Program received signal SIGSEGV, Segmentation fault.
  [Switching to Thread 182897358752 (LWP 14112)]
0x0000000100000000 in ?? ()
  (gdb) bt
#0  0x0000000100000000 in ?? ()
#1  0x0000000000fe3004 in XML_ParseBuffer ()
  at <local>/software/gcc_64/include/c++/3.3.6/bits/stl_pair.h:83
#2  0x0000000000fa4955 in FcConfigParseAndLoad ()
  at <local>/software/gcc_64/include/c++/3.3.6/bits/stl_pair.h:83
#3  0x0000000000f9d3cc in FcInitLoadConfig ()
  at <local>/software/gcc_64/include/c++/3.3.6/bits/stl_pair.h:83
#4  0x0000000000f9d416 in FcInitLoadConfigAndFonts ()
  at <local>/software/gcc_64/include/c++/3.3.6/bits/stl_pair.h:83
#5  0x0000000000f9d5bd in FcInit ()
  at <local>/software/gcc_64/include/c++/3.3.6/bits/stl_pair.h:83
#6  0x0000000000f97015 in FcConfigGetCurrent ()
  at <local>/software/gcc_64/include/c++/3.3.6/bits/stl_pair.h:83
#7  0x0000000000f98906 in FcConfigSubstituteWithPat ()
  at <local>/software/gcc_64/include/c++/3.3.6/bits/stl_pair.h:83
#8  0x0000000000edf28c in InitFont ()
  at <local>/software/gcc_64/include/c++/3.3.6/bits/stl_pair.h:83
#9  0x0000000000edf52f in TkpGetFontFromAttributes ()
  at <local>/software/gcc_64/include/c++/3.3.6/bits/stl_pair.h:83
#10 0x0000000000f00c4c in Tk_AllocFontFromObj ()
  at <local>/software/gcc_64/include/c++/3.3.6/bits/stl_pair.h:83
#11 0x0000000000efa4d2 in DoObjConfig ()
  at <local>/software/gcc_64/include/c++/3.3.6/bits/stl_pair.h:83
#12 0x0000000000efaa3a in Tk_InitOptions ()
  at <local>/software/gcc_64/include/c++/3.3.6/bits/stl_pair.h:83
#13 0x0000000000e70db2 in ButtonCreate ()
  at <local>/software/gcc_64/include/c++/3.3.6/bits/stl_pair.h:83
#14 0x0000000001588581 in TclEvalObjvInternal ()

我认为字体存在一些问题。有什么想法解决这个问题吗?

编辑1(2011年4月1日):

% uname -a
Linux scdbuild04 2.6.9-67.ELsmp #1 SMP Fri Nov 16 12:49:06 EST 2007 x86_64 x86_64 x86_64 GNU/Linux

% ldd libtk8.5.so 
libX11.so.6 => /usr/X11R6/lib64/libX11.so.6 (0x0000002a957b7000)
libXss.so.1 => /usr/X11R6/lib64/libXss.so.1 (0x0000002a959b0000)
libXext.so.6 => /usr/X11R6/lib64/libXext.so.6 (0x0000002a95ab3000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000002a95bc5000)
libm.so.6 => /lib64/tls/libm.so.6 (0x0000002a95cc8000)
libc.so.6 => /lib64/tls/libc.so.6 (0x0000002a95e4e000)
/lib64/ld-linux-x86-64.so.2 (0x000000552aaaa000)

EDIT 2(2011年4月4日)

% cat /etc/*-release 
CentOS release 4.6 (Final)

% cat /proc/version
Linux version 2.6.9-67.ELsmp (mockbuild@builder10.centos.org) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-9)) #1 SMP Fri Nov 16 12:49:06 EST 2007

1 个答案:

答案 0 :(得分:1)

您在comp.lang.tcl上提出此问题,解决方法是在配置Tk时指定--disable-xft

我怀疑真正的原因是无法链接XML解析器,由于系统更改了传递依赖关系的处理方式,因此在一些最新版本的Linux上被报告为潜在问题。 (我忘记了哪个供应商负责;我最近没有那么多关注开发人员的讨论,最近这个问题被淘汰了。)你能报告一下Tk库的ldd报告(没有解决方法)和确切的内容您正在构建的操作系统?另外,你想要建立哪个版本的Tk?另请注意,在跟踪问题时使用--enable-symbols配置选项对Tcl和Tk非常有帮助,因为这样可以在堆栈跟踪中获得更好的信息。