2012-09-18 4 views
8

私はMac OS X 10.8.1とPython 2.7.2でlxmlを構築していて、問題があります。 (私はGithubリポジトリをクローンし、Mac OS Xの指示に従っています:http://lxml.de/build.htmlMac OS X 10.8.1でlxmlをインストールするとどうしたらいいですか?

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 

Iは「[切り取ら]

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 

私の深みの外に出ようとしている何がここに間違っている。 誰も私がこれを解決するために必要な方向に私を指摘することはできますか?

答えて

17

これはlibxml2 2.9のバグです。

あなたが取得しているエラーは、この行にある:ちょうどLinux上で動作するように起こる不正なコードが、だ

once_control = PTHREAD_ONCE_INIT; 

PTHREAD_ONCE_INITは、割り当てではなく初期化にのみ使用できます。具体的な理由は次のとおりです。プラットフォームではPTHREAD_ONCE_INITを集約初期化子として定義できます。どのOS Xがそうですか。 10.8.1の/usr/include/pthread.hから:

#define PTHREAD_ONCE_INIT {_PTHREAD_ONCE_SIG_init, {0}} 

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

だから、ここのオプションは以下のとおりです。もちろん

2.9.1が出てくるためにあなたは待つことができます。

代わりに、ビルドページに記載されているにもかかわらず、Mountain Lion 2.7.8に付属するlibxml2のバージョンは「ひどく時代遅れ」ではありません - 彼が使用する2.7.3バージョンより新しいものです。したがって、--static-depsをスキップして、組み込みの2.7.8を使用することができます。

2.9.0よりも新しいものが必要ですが、(動作していない)2.9.0より新しいものが必要な場合は、ビルドページに明示的に指定する方法が示されています。http://www.xmlsoft.orgは、あなたが望むバージョンを選ぶことができます。たとえば、次のように

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

それとも、そのビルドを使用するlxmlのを教えてくれ、その後、手動でhttp://git.gnome.org/browse/libxml2/commit/?id=3f6cfbd1d38d0634a2ddcb9a0a13e1b5a2195a5eからパッチを適用し、手動での構築、またはツリーの最上部の代わりに、バージョン2.9.0を引き出し、それを構築し、可能性があります。

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

+0

信じられないほど包括的な答えに感謝します。私は最初にpipを使ってみたが、うまくいかなかったことは分かっている。私はちょうど今それを試して、それは正常に完了しました。 (最後の端末出力= "lxmlのインストールに成功しました")しかし、私がPythonに入り、 "import lxml"と入力すると、 "ImportError:lxmlというモジュールがありません"というメッセージが表示されます。私が間違っていることに関するアイデアは? –

+1

アップル以外のPythonインストールはありますか?それはあなたが一致しないpipとpythonのバージョンを実行している可能性があります。あなたのパス上の最初のピップとして/ usr/local/bin/pip(または/ opt/local/bin/pipなど)で終わって、/ usr/local/bin/pythonですが、最初のpythonとしては/ usr/bin/pythonです。 – abarnert

+0

私はある時点でそれを台無しにすることができた可能性が高いです。どうすればこのことを診断できますか? (私はUNIXのコマンド/パス/プロトコル上の本当の初心者です!) –

関連する問題