ijsgutenprint出现segment fault

      ijsgutenprint移植到Android出现的问题,在一般的嵌入式linux上没有问题,对比差异的过程中在Google出了答案(开始会以为文件系统差异导致的呢,因为Android的没有/tmp目录),如果这个问题不Google也能找出答案,这次的经验教训是写代码不能太不可思议了,出现的错误和问题表面上都看不出关联来,还是在一个05年发的帖子中找到了答案,纠结了一下午。以下转载:http://sourceforge.net/p/gimp-print/bugs/406/

I have RPMized the snapshot for Mandriva Linux in the
last days, because the beta4 had some Foomatic bugs
which prevented print queues from working.

On some machines Gutenprint then worked perfectly
(tested by me and others with the Stylus Photo 950,
Stylus C84, and Stylus C86). On another machine I got a
core dump with the Stylus Photo 950, but the core dump
even persisted when choosing another device (C84) or a
non-existing device (entering gibberish as
"-sDeviceModel=..." argument). Strangely enough one set
of RPM packages, built on the Mandriva compilation
cluster, worked on the first box and had
ijsgutenprint.5.0 coredumping on the second machine.
ESP GhostScript was also from the same RPM on the two
machines and both were set to french locale.

Fortunately, the behaviour did not change when
rebuilding the RPM with "--enable-debug" added to the
"./configure ..." line and the stripping by RPM being
turned off. So I could run the core file through gdb:

------------------------------------------------------------------------------------------
[root@localhost g]# cat
/usr/share/cups/data/testprint.ps | gs -q
-dPARANOIDSAFER -dNOPAUSE -dBATCH -sDEVICE=ijs
-sIjsServer=/usr/bin/ijsgutenprint.5.0 -dIjsUseOutputFD
-sDeviceManufacturer=Epson -sDeviceModel=escp2-950
-dDEVICEWIDTHPOINTS=612 -dDEVICEHEIGHTPOINTS=792
-r360x360 -sProcessColorModel=DeviceRGB -sOutputFile=-
- > x
DEBUG: ESP Ghostscript 815.01: Can't start ijs server
"/usr/bin/ijsgutenprint.5.0"
[root@localhost g]#
[root@localhost g]#
[root@localhost g]#
[root@localhost g]# ll core.15257
-rw------- 1 root root 376832 ao 25 22:52 core.15257
[root@localhost g]# gdb -c core.15257 
/usr/bin/ijsgutenprint.5.0
GNU gdb 6.3-5mdk (Mandriva Linux release 2006.0)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public
License, and you are
welcome to change it and/or distribute copies of it
under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show
warranty" for details.
This GDB was configured as
"i586-mandriva-linux-gnu"...Using host libthread_db
library "/lib/tls/libthread_db.so.1".

warning: core file may not match specified executable file.
Reading symbols from shared object read from target
memory...done.
Loaded system supplied DSO at 0xffffe000
Core was generated by `/usr/bin/ijsgutenprint.5.0'.
Program terminated with signal 11, Segmentation fault.

warning: svr4_current_sos: Can't read pathname for load
map: Input/output error

Reading symbols from /usr/lib/libgutenprint.so.2...done.
Loaded symbols for /usr/lib/libgutenprint.so.2
Reading symbols from /lib/tls/libm.so.6...done.
Loaded symbols for /lib/tls/libm.so.6
Reading symbols from /usr/lib/libijs.so.1...done.
Loaded symbols for /usr/lib/libijs.so.1
Reading symbols from /lib/tls/libc.so.6...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0 0xb7f40b97 in stpi_get_printfuncs (printer=0x0) at
printers.c:174
174 printers.c: No such file or directory.
in printers.c
(gdb) bt
#0 0xb7f40b97 in stpi_get_printfuncs (printer=0x0) at
printers.c:174
#1 0xb7f40b7b in stp_printer_list_parameters
(v=0x8053da0) at printers.c:247
#2 0xb7f38b86 in stp_get_parameter_list (v=0x8053da0)
at print-util.c:607
#3 0x0804d74a in stp_dbg (msg=0x80502a4
"ijsgutenprint: about to start\n",
v=0x8053da0) at ijsgutenprint.c:972
#4 0x0804e869 in main (argc=1, argv=0xbfbcf614) at
ijsgutenprint.c:1210
(gdb) quit
[root@localhost g]#
------------------------------------------------------------------------------------------

Here is the ".configure" command line which I have used:

------------------------------------------------------------------------------------------
configure --enable-shared --disable-rpath
--disable-libgutenprintui --enable-libgutenprintui2
--without-gimp --with-gimp2 --with-cups --with-ijs
--with-foomatic --with-foomatic3
--enable-cups-level3-ppds --disable-translated-ppds
--disable-cups-level3-ps --disable-static-genppd
------------------------------------------------------------------------------------------

RPM has added following optimization flags: -O2
-fomit-frame-pointer -pipe -march=i586 -mtune=pentiumpro

In the debug mode build "-O2" was replaced by -g.

Logged In: YES 
user_id=47862

I have found the cause of the problem: the printers.xml file
was missing on the machine where the core dump occured and
it was present on the other box. After installing it, the
printer printed correctly. The missing printers.xml was
caused by a missing dependency in my RPMs. So it was not a
bug of Gutenprint.

看发帖这个哥们愣是调试出来了,我调试用的是strace,结果什么都看不出来。应该向人家学习学习。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

袁保康

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值