Py_Initializemisses necessary libraries (static libpython.a)

>> 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/Linux
SUSE Linux Enterprise Desktop 11 (x86_64)
VERSION = 11
PATCHLEVEL = 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-prototypes

yes
-------------------------------------------------------------------------------------------------------------------
Getting pyembed flags from python-config
==>

#include <Python.h>
#ifdef __cplusplus
extern "C" {
#endif
	void Py_Initialize(void);
	void Py_Finalize(void);
#ifdef __cplusplus
}
#endif
int 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()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值