swig 无法创建 php libnetcdf 扩展
我需要将 libnetcdf 与 PHP 接口。 (谷歌代码上的 php-netcdf 已损坏)
这是 netcdf.i :
%module netcdf
%{
/* Includes the header in the wrapper code */
#include "netcdf.h"
%}
/* Parse the header file to generate wrappers */
%include "netcdf.h"
我做了:
gcc `php-config --includes` -fpic -c netcdf_wrap.c
gcc -shared netcdf_wrap.o -o netcdf.so
但是当在 php 中加载扩展时,我得到:
Unable to load dynamic library netcdf.so:
undefined symbol: ncerr in Unknown on line 0
这是我第一次尝试类似的事情。我错过了什么吗?
添加了 -lnetcdf 标志。
现在,我得到:未定义符号:zend_error_noreturn。修复了 netcdf_wrap.c 中将 zend_error_noreturn 替换为 zend_error
I need to interface libnetcdf with PHP. (the php-netcdf on google code is broken)
Here's netcdf.i :
%module netcdf
%{
/* Includes the header in the wrapper code */
#include "netcdf.h"
%}
/* Parse the header file to generate wrappers */
%include "netcdf.h"
I did :
gcc `php-config --includes` -fpic -c netcdf_wrap.c
gcc -shared netcdf_wrap.o -o netcdf.so
but when loading the extension in php, I get :
Unable to load dynamic library netcdf.so:
undefined symbol: ncerr in Unknown on line 0
It's the first time I try something like that. Am I missing something ?
ADDED -lnetcdf flag.
now, I got : undefined symbol: zend_error_noreturn. fixed replacing zend_error_noreturn by zend_error in netcdf_wrap.c
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您面临的直接问题是由于未链接 libnetcdf 造成的。您需要 gcc 的
-l
标志来执行此操作:Your immediate problem is caused by not linking against libnetcdf. You need the
-l
flag for gcc to do so:Google Code 的 php-netcdf 并没有损坏,它只是未完成并且不再维护。然而,贡献者之一 Santi Oliveras 似乎已经成功地使用了它。尝试联系他,也许他有一些新的代码或其他东西。或者随意接管该项目。
PS我是作者。
php-netcdf at Google Code isn't broken, it's just unfinished and not maintained any more. However, one of the contributors, Santi Oliveras, seems to have managed to use it. Try to contact him, maybe he has some new code or something. Or feel free to take the project over.
P.S. I'm the author.