8

Mac OS X 10.8.1 と Python 2.7.2 で lxml をビルドしていますが、問題があります。(Github リポジトリのクローンを作成し、Mac OS X の手順に従いました: http://lxml.de/build.html )

libxml2 のビルド中に何かがハングしたようです。以下は、端末出力の末尾です。

configure: creating ./config.status
config.status: creating libxml2.spec
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating include/libxml/Makefile
config.status: creating doc/Makefile
config.status: creating doc/examples/Makefile
config.status: creating doc/devhelp/Makefile
config.status: creating example/Makefile
config.status: creating python/Makefile
config.status: creating python/tests/Makefile
config.status: creating xstc/Makefile
config.status: creating include/libxml/xmlversion.h
config.status: creating xml2-config
config.status: creating libxml-2.0.pc
config.status: creating libxml-2.0-uninstalled.pc
config.status: creating python/setup.py
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
rm: libtoolT: No such file or directory
Done configuring
make  all-recursive
Making all in include
Making all in libxml
make[3]: Nothing to be done for `all'.
make[3]: Nothing to be done for `all-am'.
Making all in .
  CC     error.lo

[抜粋]

  CC     hash.lo
parser.c: In function 'xmlParseInNodeContext':
parser.c:13492: warning: pointer targets in passing argument 1 of 'xmlFindCharEncodingHandler' differ in signedness
  CC     list.lo

[抜粋]

  CC     xpointer.lo
xpath.c: In function 'xmlXPathRegisterFuncNS':
xpath.c:4870: warning: ISO C forbids passing argument 4 of 'xmlHashAddEntry2' between function pointer and 'void *'
xpath.c: In function 'xmlXPathFunctionLookupNS':
xpath.c:4951: warning: ISO C forbids assignment between function pointer and 'void *'
xpath.c: In function 'xmlXPathCompOpEval':
xpath.c:13535: warning: ISO C forbids assignment between function pointer and 'void *'
xpath.c:13562: warning: ISO C forbids assignment between function pointer and 'void *'
xpath.c: At top level:
trionan.c:221: warning: 'trio_is_negative' defined but not used
  CC     xinclude.lo

[抜粋]

  CC     xmlstring.lo
threads.c: In function 'xmlCleanupThreads':
threads.c:918: error: expected expression before '{' token
make[2]: *** [threads.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Traceback (most recent call last):
  File "setup.py", line 225, in <module>
    **setup_extra_options()
  File "setup.py", line 139, in setup_extra_options
    STATIC_CFLAGS, STATIC_BINARIES)
  File "/Users/jedc/Downloads/lxml/setupinfo.py", line 57, in ext_modules
    multicore=OPTION_MULTICORE)
  File "/Users/jedc/Downloads/lxml/buildlibxml.py", line 338, in build_libxml2xslt
    cmmi(libxml2_configure_cmd, libxml2_dir, multicore, **call_setup)
  File "/Users/jedc/Downloads/lxml/buildlibxml.py", line 266, in cmmi
    cwd=build_dir, **call_setup)
  File "/Users/jedc/Downloads/lxml/buildlibxml.py", line 249, in call_subprocess
    raise Exception('Command "%s" returned code %s' % (cmd_desc, returncode))
Exception: Command "make -j5" returned code 512

ここで何が問題なのかを理解しようとしているのに、私は自分の深さをはるかに超えています。 これを修正するために何をする必要があるかを誰かが教えてくれますか?

4

1 に答える 1

17

これは libxml2 2.9 のバグです。

あなたが得ているエラーはこの行にあります:

once_control = PTHREAD_ONCE_INIT;

これは違法なコードであり、たまたま Linux で動作するだけです。PTHREAD_ONCE_INIT割り当てではなく、初期化にのみ使用できます。これには特定の理由があります。プラットフォームがPTHREAD_ONCE_INIT集約初期化子として定義できるようにするためです。どのOS Xがしますか。10.8.1 から/usr/include/pthread.h:

#define PTHREAD_ONCE_INIT {_PTHREAD_ONCE_SIG_init, {0}}

これは、数日前に libxml2 メーリング リスト (https://mail.gnome.org/archives/xml/2012-September/msg00036.html) に報告され、2 日後に bugzilla に報告されたようです (https:/ /bugzilla.gnome.org/show_bug.cgi?id=684024)、翌日には修正されました (http://git.gnome.org/browse/libxml2/commit/?id=3f6cfbd1d38d0634a2ddcb9a0a13e1b5a2195a5e)。この問題はありません。

したがって、ここにあなたのオプションがあります:

もちろん、2.9.1 がリリースされるまで待つこともできます。

別の方法として、ビルド ページに記載されている内容にかかわらず、Mountain Lion に付属する libxml2 のバージョン 2.7.8 は「ひどく古い」わけではなく、彼が使用を提案している 2.7.3 バージョンよりも新しいものです。したがって、をスキップし--static-depsて組み込みの 2.7.8 を使用できます。

2.7.8 より新しいものが必要であるが、(動作していない) 2.9.0 ほど新しくない場合は、ビルド ページにそれを明示的に指定する方法が示され、http: //www.xmlsoft.orgにバージョンが含まれている必要があります。履歴をどこかに保存して、必要なバージョンを選択できるようにします。例えば:

python setup.py build --static-deps \
   --libxml2-version=2.8.0

または、 http ://git.gnome.org/browse/libxml2/commit/?id=3f6cfbd1d38d0634a2ddcb9a0a13e1b5a2195a5eからパッチを手動で適用して手動でビルドするか、バージョン 2.9.0 の代わりにツリーのトップをプルしてビルドし、次に、lxml にそのビルドを使用するように指示します。

将来、ビルドのデバッグに対処したくない場合は、pip を使用して Python パッケージをインストールし、Homebrew を使用して不足している依存関係をインストールすることをお勧めします。すべての最新バージョンの理想的なビルドを常に取得できるとは限りませんが、はるかに簡単で、通常は十分に優れています。

于 2012-09-18T23:45:18.563 に答える