为ARM交叉编译Perl时出错

时间:2011-09-21 08:18:56

标签: perl cross-compiling

我已使用configure options成功配置perl for cross comile:

./Configure -des -Dusecrosscompile \
    -Dtargethost=172.17.185.91 \
    -Dtargetdir=/home/perl/ \
    -Dtargetuser=root \
    -Dtargetarch=arm-linux \
    -Dcc=arm-linux-gcc \
    -Dusrinc=/opt/Mozart_Toolchain/arm-eabi-uclibc/include/ \
    -Dincpth=/opt/Mozart_Toolchain/arm-eabi-uclibc/include/ \
    -Dlibpth=/opt/Mozart_Toolchain/arm-eabi-uclibc/lib/

配置脚本告诉我“现在你必须运行'make'。”但是当我做的时候我遇到了错误:

`sh  cflags "optimize='-O2'" miniperlmain.o`  miniperlmain.c
  CCCMD =  arm-linux-gcc -DPERL_CORE -c -DOVR_DBL_DIG=14 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -O2  -Wall 
In file included from perl.h:38,
                 from miniperlmain.c:40:
config.h:4425:12: error: operator '==' has no left operand
In file included from miniperlmain.c:40:
perl.h:713:14: error: operator '>=' has no left operand
... ...

在config.h中,某些宏留空,例如:

#define INTSIZE         /**/
#define LONGSIZE        /**/
#define SHORTSIZE       /**/
... much more ...

我认为这是make错误中未定义的宏结果。我不知道如何解决它。为什么即使成功配置宏也是空白的? 是否有一些指南可以交叉编译Perl?

2 个答案:

答案 0 :(得分:1)

有一个Cross目录,其中包含README文件,其中包含arm-linux的以下说明:

1)  You should be reading me (README) in perl-5.x.y/Cross

2)  Make sure you are in the Cross directory.

3)  Edit the file 'config' to contain your target platform information.

4)  make patch  ## This will patch the existing source-tree.
5)  make perl   ## Will make perl

(阅读整篇文章。)

答案 1 :(得分:0)

我得到了最简单的方法来交叉编译Perl for arm-linux。请参考Cross-compiling perl。这是一项伟大的工作!它救了我的命。

根据给出的指示,你可以得到你想要的东西。 'make'时可能会遇到这样的错误:

pp_sys.c:78: error: non-thread-local declaration of 'h_errno' follows thread-local declaration

只需评论该行。 享受吧!