为四川人民祈祷! www.onefoundation.cn

Spotlight crash and lxml install on leopard

Leopard在我欢天喜地的更新到了10.5.2以后, SPOTLIGHT Crash whenever I type...

Dam!

在网上找找解决方案, 只有一个家伙和我一样倒霉. 尝试他的方法, 删掉了spotlight的index文件, 重新索引, 无效.

找Crash Dump, 找到了Crash的线程
Thread 3 Crashed:
0   libxml2.2.dylib               	0x02e424fc xmlXPathCacheNewString + 44
1   libxml2.2.dylib               	0x02e4e3f2 xmlXPathCompPathExpr + 2546
2   libxml2.2.dylib               	0x02e4ebb5 xmlXPathCompUnaryExpr + 213
3   libxml2.2.dylib               	0x02e4edbf xmlXPathCompMultiplicativeExpr + 15
4   libxml2.2.dylib               	0x02e4efaf xmlXPathCompAdditiveExpr + 15
5   libxml2.2.dylib               	0x02e4f0ff xmlXPathCompRelationalExpr + 15
6   libxml2.2.dylib               	0x02e4f36b xmlXPathCompEqualityExpr + 203
7   libxml2.2.dylib               	0x02e4f40f xmlXPathCompAndExpr + 15
8   libxml2.2.dylib               	0x02e4f582 xmlXPathCompileExpr + 18
9   libxml2.2.dylib               	0x02e5464a xmlXPathCtxtCompile + 90
10  libxslt.1.dylib               	0x03c5f6e9 xsltXPathCompile + 76
11  libxslt.1.dylib               	0x03c6f939 xsltStylePreCompute + 1530
12  libxslt.1.dylib               	0x03c5b223 xsltParseTemplateContent + 2542
13  libxslt.1.dylib               	0x03c5b51e xsltParseStylesheetProcess + 105
14  libxslt.1.dylib               	0x03c5c78e xsltParseStylesheetImportedDoc + 493
15  libxslt.1.dylib               	0x03c5c7fc xsltParseStylesheetDoc + 26
16  com.apple.DictionaryServices  	0x007d4305 PredefinedXSLTDoc(DCSTransformStyle) + 267
17  com.apple.DictionaryServices  	0x007d4396 CopyTransformedTextFromXML + 110
18  com.apple.DictionaryServices  	0x007d155d DCSRecord::copyData(DCSTransformStyle) + 137
19  com.apple.DictionaryServices  	0x007d3393 DCSCopyTextDefinition + 417
20  com.apple.spotlight           	0x0002b916 0x1000 + 174358
21  com.apple.Foundation          	0x00471b34 -[NSOperation start] + 772
22  com.apple.Foundation          	0x00471822 __runop + 34
23  libSystem.B.dylib             	0x90ecd743 _pthread_wqthread + 331
24  libSystem.B.dylib             	0x90ecd5f6 start_wqthread + 30

难道是自作孽, stupid!

还记得我曾经在blog里面教大家怎么安装python lxml lib吗? 把链接改回来, 也就是libxml2的版本换回2.6.16, spotlight comes back.


但是lxml.etree还是彻底不能用了. 看来不能这样安装, 找一些更加安全的方法. 我可是spotlight的重度依赖者

另外, 还有一条信息, libxslt和libxml2据说要配套的用, 为了安全起见, 在/usr/local/下面安装最新的libxslt

重新安装lxml, 用下面的命令
python setup.py build_ext
    --with-xml2-config=/usr/local/bin/xml2-config
    --with-xslt-config=/usr/local/bin/xslt-config
python setup.py build
python setup.py install

这回应该是完美解决方案了
python
>>> from lxml import etree

终于没有报错, 安装成功

上面的命令可是我读lxml的setupinfo.py源码得出的, 果然源代码面前没有秘密

最后, 清理一下/usr/lib下面无用的文件, 收工!
 
by kernel1983
Comments »
Leave a Comment:
code:272