หน้าเว็บ

วันเสาร์ที่ 25 ตุลาคม พ.ศ. 2551

ปัญหาการลง PIL (Python Image Library) บน FreeBSD

ในการที่จะลง Plone นั้นต้องมีการลง PIL (Python Image Library) ก่อน
แต่พอผมลงแล้วเกิดปัญหาคือพอสั่ง python setup.py build_ext -i แล้วเกิด error ดังนี้

building '_imagingtk' extension

creating build/temp.freebsd-5.5-RELEASE-i386-2.4/Tk

cc -fno-strict-aliasing -DNDEBUG -O -pipe -D__wchar_t=wchar_t -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/freetype2 -IlibImaging -I/usr/local/include -I/usr/include -I/usr/local/include/python2.4 -c _imagingtk.c -o build/temp.freebsd-5.5-RELEASE-i386-2.4/_imagingtk.o

_imagingtk.c:20:16: tk.h: No such file or directory

_imagingtk.c:23: error: syntax error before '*' token

_imagingtk.c:31: error: syntax error before "Tcl_Interp"

_imagingtk.c: In function `_tkinit':

_imagingtk.c:37: error: `Tcl_Interp' undeclared (first use in this function)

_imagingtk.c:37: error: (Each undeclared identifier is reported only once

_imagingtk.c:37: error: for each function it appears in.)

_imagingtk.c:37: error: `interp' undeclared (first use in this function)

_imagingtk.c:45: error: syntax error before ')' token

_imagingtk.c:50: error: `app' undeclared (first use in this function)

_imagingtk.c: At top level:

_imagingtk.c:55: warning: parameter names (without types) in function declaration

_imagingtk.c:55: error: conflicting types for 'TkImaging_Init'

_imagingtk.c:23: error: previous declaration of 'TkImaging_Init' was here

_imagingtk.c:55: error: conflicting types for 'TkImaging_Init'

_imagingtk.c:23: error: previous declaration of 'TkImaging_Init' was here

_imagingtk.c:55: warning: data definition has no type or storage class

_imagingtk.c:57: error: syntax error before '&' token

error: command 'cc' failed with exit status 1

ซึ่งปัญหาเค้าว่าอาจเป็นที่ python ได้ถูก link กับ Tkinter และ Tcl/Tk builid libraries แต่ไม่ได้ link กับ Tcl/Tk include files

วิธีแก้
1. locate Tcl/Tk developer package (ผมไม่ได้ทดลองวิธีนี้)
หรือ
2. ให้แก้ไฟล์ setup.py โดยการ comment บรรทัดดังต่อไปนี้ทิ้ง
         elif feature.tcl and feature.tk:
exts.append(Extension(
"_imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"],
libraries=[feature.tcl, feature.tk]
))
ระบบที่ทดสอบ
OS: FreeBSD 6.2
PIL: 1.1.6
Python: 2.4.5

ที่มา
http://mail.python.org/pipermail/image-sig/2007-November/004662.html

ไม่มีความคิดเห็น: