Py_Initializemisses necessary libraries (static libpython.a)

来源:互联网 发布:淘宝主图的尺寸 编辑:程序博客网 时间:2024/06/05 15:53
>> operating system:Linux 2.6.32.12-0.7-default #1 SMP 2010-05-20 11:14:20 +0200 x86_64 x86_64 x86_64 GNU/LinuxSUSE Linux Enterprise Desktop 11 (x86_64)VERSION = 11PATCHLEVEL = 1>> python version:Python 2.6.2>> waf version (or svn revision):1.7.6>> observed output and expected output:(excerpt from config.log)-------------------------------------------------------------------------------------------------------------------Asking python-config for the flags (pyembed)['/opt/share/python-2.6.2/bin/python-config', '--cflags', '--libs', '--ldflags']out: -I/opt/share/python-2.6.2/include/python2.6 -I/opt/share/python-2.6.2/include/python2.6 -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypesyes-------------------------------------------------------------------------------------------------------------------Getting pyembed flags from python-config==>#include <Python.h>#ifdef __cplusplusextern "C" {#endifvoid Py_Initialize(void);void Py_Finalize(void);#ifdef __cplusplus}#endifint main(int argc, char **argv){   (void)argc; (void)argv;   Py_Initialize();   Py_Finalize();   return 0;}

The test for Python.h and the embedding fails to link because the libraries needed for satisfying dependencies of libpython2.6.a are not applied (in my case pthread dl util m).python-config --libs correctly outputs these libs (which seems a somewhat similar problem to http://code.google.com/p/waf/issues/detail?id=1118 but happens with old Python-versions too). It seems you need to use "--libs" as the only option for it to output them correctly.I think the correct approach would be to parse `python-config --libs` separately and add those to the check used for embedding Python.>> how to reproduce the problem?Compile Python with static libpython and use waf's check_python_headers()

原创粉丝点击