在编译SWIG的包装器模块输出时出现6个错误?

时间:2011-06-27 13:08:28

标签: c perl swig

gcc -fpic -c gd_wrap.c -Dbool=char -I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE

In file included from /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/op.h:499,
                 from /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/perl.h:2754,
                 from gd_wrap.c:731:
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/reentr.h:612: error: field ‘_crypt_struct’ has incomplete type
In file included from /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/perl.h:3950,
                 from gd_wrap.c:731:
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/proto.h:297: error: expected declaration specifiers or ‘...’ before ‘off64_t’
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/proto.h:299: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Perl_do_sysseek’
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/proto.h:300: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Perl_do_tell’
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/proto.h:2009: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before Perl_PerlIO_tell’
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/proto.h:2010: error: expected declaration specifiers or ‘...’ before ‘off64_t’

是否有人熟悉此错误?

我在Centos 5.5上,而perl版本是5.8.8

2 个答案:

答案 0 :(得分:3)

这是一个众所周知的错误(只需在谷歌上搜索关键字Perl_do_sysseek和swig。

我过去发现了两种解决方案。

第一个真的很脏(我鄙视它)但是100%工作。它包括在“proto.h”文件的顶部添加这些行:

#include <stdint.h>
typedef __off64_t off64_t;

第二个系统比第一个系统清洁。您应该将swig升级到2.0版并重试。如果它不起作用,您可以尝试将perl升级到版本5.10.0。

答案 1 :(得分:0)

这是我的makefile,它解决了我的问题。

全部:测试

-isystem / usr / local / include

CFLAGS = -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS = 64

icinga-core-wrap-perl.c:icinga-core.i     swig -perl -outcurrentdir -o icinga-core-wrap-perl.c -oh icinga-core-wrap-perl.h icinga-core.i

icinga-core-wrap-perl.o:icinga-core-wrap-perl.c     gcc $(CFLAGS)-I ../包括icinga-core-wrap-perl.c -I / usr / lib / perl / 5.10.1 / CORE / -o icinga-core-wrap-perl.o

测试:icinga-core-wrap-perl.o     echo todo

https://gitorious.org/icinga/icinga-core/commit/5c19af4baf01b6741bdef782a33339da0e403de6