kateli1991

检阅板:文件中未定义符号XML_SetHashSalt,版本EXPAT_2_0_1_RHlibexpat.so.1与链接时间引用



我正在运行ReviewBoard 2.0.15,在一些评论中,我得到以下错误:

Django Version: 1.6.11
Python Version: 2.6.6
Installed Applications:
[u'django.contrib.admin',
 u'django.contrib.auth',
 u'django.contrib.contenttypes',
 u'django.contrib.sites',
 u'django.contrib.sessions',
 u'django.contrib.staticfiles',
 u'djblets',
 u'djblets.configforms',
 u'djblets.datagrid',
 u'djblets.extensions',
 u'djblets.feedview',
 u'djblets.gravatars',
 u'djblets.log',
 u'djblets.pipeline',
 u'djblets.siteconfig',
 u'djblets.util',
 u'djblets.webapi',
 u'haystack',
 u'pipeline',
 u'reviewboard',
 u'reviewboard.accounts',
 u'reviewboard.admin',
 u'reviewboard.attachments',
 u'reviewboard.changedescs',
 u'reviewboard.datagrids',
 u'reviewboard.diffviewer',
 u'reviewboard.extensions',
 u'reviewboard.hostingsvcs',
 u'reviewboard.notifications',
 u'reviewboard.reviews',
 u'reviewboard.reviews.ui',
 u'reviewboard.scmtools',
 u'reviewboard.site',
 u'reviewboard.ssh',
 u'reviewboard.webapi',
 u'django_evolution']
Installed Middleware:
[u'django.middleware.gzip.GZipMiddleware',
 u'reviewboard.admin.middleware.InitReviewBoardMiddleware',
 u'django.middleware.clickjacking.XFrameOptionsMiddleware',
 u'django.middleware.common.CommonMiddleware',
 u'django.middleware.doc.XViewMiddleware',
 u'django.middleware.http.ConditionalGetMiddleware',
 u'django.middleware.locale.LocaleMiddleware',
 u'django.contrib.sessions.middleware.SessionMiddleware',
 u'django.contrib.auth.middleware.AuthenticationMiddleware',
 u'django.contrib.messages.middleware.MessageMiddleware',
 u'djblets.siteconfig.middleware.SettingsMiddleware',
 u'reviewboard.admin.middleware.LoadSettingsMiddleware',
 u'djblets.extensions.middleware.ExtensionsMiddleware',
 u'djblets.log.middleware.LoggingMiddleware',
 u'reviewboard.accounts.middleware.TimezoneMiddleware',
 u'reviewboard.admin.middleware.CheckUpdatesRequiredMiddleware',
 u'reviewboard.admin.middleware.X509AuthMiddleware',
 u'reviewboard.site.middleware.LocalSiteMiddleware',
 u'djblets.extensions.middleware.ExtensionsMiddlewareRunner',
 u'reviewboard.admin.middleware.ExtraExceptionInfoMiddleware']


Traceback:
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/Django-1.6.11-py2.6.egg/django/core/handlers/base.py" in get_response
  112.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/ReviewBoard-2.0.15-py2.6.egg/reviewboard/accounts/decorators.py" in _check
  23.             return view_func(*args, **kwargs)
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/ReviewBoard-2.0.15-py2.6.egg/reviewboard/site/decorators.py" in _check
  35.         return view_func(request, local_site=local_site, *args, **kwargs)
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/ReviewBoard-2.0.15-py2.6.egg/reviewboard/reviews/views.py" in review_detail
  665.                         changedesc.fields_changed[field_id])
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/ReviewBoard-2.0.15-py2.6.egg/reviewboard/reviews/fields.py" in get_change_entry_sections_html
  200.             'rendered_html': mark_safe(self.render_change_entry_html(info)),
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/ReviewBoard-2.0.15-py2.6.egg/reviewboard/reviews/fields.py" in render_change_entry_html
  590.         old_lines = list(iter_markdown_lines(old_value))
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/ReviewBoard-2.0.15-py2.6.egg/reviewboard/reviews/markdown_utils.py" in iter_markdown_lines
  212.     nodes = get_markdown_element_tree(markdown_html)
File "/opt/local/revboard/python/virtualenv/lib/python2.6/site-packages/ReviewBoard-2.0.15-py2.6.egg/reviewboard/reviews/markdown_utils.py" in get_markdown_element_tree
  274.     doc = parseString(b'<html>%s</html>' % markdown_html)
File "/usr/lib64/python2.6/xml/dom/minidom.py" in parseString
  1927.         from xml.dom import expatbuilder
File "/usr/lib64/python2.6/xml/dom/expatbuilder.py" in <module>
  32. from xml.parsers import expat
File "/usr/lib64/python2.6/xml/parsers/expat.py" in <module>
  4. from pyexpat import *

Exception Type: ImportError at /reviews/r/24291/
Exception Value: /usr/lib64/python2.6/lib-dynload/pyexpat.so: symbol XML_SetHashSalt, version EXPAT_2_0_1_RH not defined in file libexpat.so.1 with link time reference

如果我使用相同的虚拟环境手动运行python,它可以正常工作:

^{pr2}$

我已经验证了apache和python确实使用了完全相同的expat版本,所以这也不是问题所在。我真的很困惑,为什么这会发生在几百篇评论中的少数。在

编辑:我又做了一些测试,发现了一些东西。在

我注意到一件事。这个libexpat.soapache使用指向/usr/local/lib的/libexpat.so,如果对该文件运行以下操作,则不会得到任何结果:

(virtualenv)[user@rbdev301 lib]$ strings libexpat.so.1.5.2 | grep XML_SetHashSalt
(virtualenv)[user@rbdev301 lib]$ strings libexpat.so.1.5.2 | grep EXPAT_2_0_1_RH

但是,当我检查哪个expat Python正在使用时,我得到以下信息:

(virtualenv)[user@rbdev301 lib-dynload]$ ldd pyexpat.so 
linux-vdso.so.1 =>  (0x00007ffff252a000)
libexpat.so.1 => /lib64/libexpat.so.1 (0x00007f52afbae000)
libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 (0x00007f52af802000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f52af5e4000)
libc.so.6 => /lib64/libc.so.6 (0x00007f52af250000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f52af04c000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007f52aee48000)
libm.so.6 => /lib64/libm.so.6 (0x00007f52aebc4000)
/lib64/ld-linux-x86-64.so.2 (0x00007f52affe3000)

所以,python使用的是/lib64中的一个。如果我在那个上面运行同样的命令,我会得到结果。在

(virtualenv)[user@rbdev301 lib64]$ strings libexpat.so.1.5.2 | grep XML_SetHashSalt
XML_SetHashSalt
(virtualenv)[user@rbdev301 lib64]$ strings libexpat.so.1.5.2 | grep EXPAT_2_0_1_RH
EXPAT_2_0_1_RH

Apache使用的源代码与python使用的源代码相同,而且它们的版本相同。似乎Python使用的是64位的,而Apache没有?也许我在这里大惊小怪。在


已被浏览了4585次
1 周,3 日 之前提问
1 个回答
fefe Tyson

我能解决这个问题。我不确定这是不是“正确”的方法,但它对我有效。自从我注意到libexpat.so我的apache lib dir中的.0符号链接指向了/usr/local/lib中的符号链接,而这个符号链接实际上并不包含错误所抱怨的字符串,我删除了那个符号链接,并创建了一个指向/lib64的新符号链接/libexpat.so.1.5.2,如下所示:

sudo ln -s /lib64/libexpat.so.1.5.2 libexpat.so.0

然后我重新启动了机器,一切正常。在

我想我会把解决问题的方法贴出来,以防其他人遇到这种奇怪的错误。在

评论 - 2020年7月29日 10:44

最新Python问答

推荐Python问答