【问题标题】:Getting 6 errors when compiling the wrapper module output by SWIG?编译 SWIG 输出的包装器模块时出现 6 个错误?
【发布时间】:2011-06-27 13:08:28
【问题描述】:

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

【问题讨论】:

    标签: c perl swig


    【解决方案1】:

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

    我过去找到了两种解决方案。

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

    #include <stdint.h>
    typedef __off64_t off64_t;
    

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

    【讨论】:

    • /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/reentr.h:612: error: field ‘_crypt_struct’ has incomplete type 呢?
    • 啊,为此,只需在编译行“-D_GNU_SOURCE”中定义“_GNU_SOURCE”
    • 只是好奇,你怎么记得这一切?
    • 我在一家用语言(C++、java、php、python、perl 和 ruby​​)编写所有代码的公司工作,我用 C++ 编写代码并使用 SWIG 将其翻译成所有语言, boost.python 等...
    【解决方案2】:

    这是为我解决问题的 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 痛饮 -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../include icinga-core-wrap-perl.c -I/usr/lib/perl/5.10.1/CORE/ -o icinga-core-wrap-perl.o

    测试:icinga-core-wrap-perl.o 回显待办事项

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-06
      • 1970-01-01
      • 2021-11-23
      • 2014-03-31
      • 2019-01-25
      • 2019-10-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多