交叉编译Perl for ARM [英] Cross Compile perl for ARM
问题描述
我正在尝试针对ARM架构交叉编译perl解释器( FriendlyARM Micro2440 )。我正在使用制造商提供的 ARM-Linux GCC 4.4.3 交叉编译器。该开发板正在运行Linux 2.6。
I'm attempting to cross compile the perl interpreter for an ARM architecture (FriendlyARM Micro2440). I'm using the ARM-Linux GCC 4.4.3 cross-compiler provided by the manufacturer. The board is running Linux 2.6.
我能够成功地交叉编译基本的 Hello World应用程序,并在目标计算机上运行。
I was able to cross-compile a basic "Hello World" application successfully, and it ran on the target machine.
我已经下载了perl v5.12.3源码。我能够为Ubuntu进行perl的常规编译。我现在正在尝试对ARM板进行交叉编译。我正在下载源代码中的perl-5.12.3 / Cross文件夹。
I've downloaded the perl v5.12.3 source. I was able to do a normal compilation of perl for Ubuntu. I'm now attempting to do a cross-compilation for the ARM board. I'm working out of the perl-5.12.3/Cross folder in the source download.
制作补丁
成功,但是当我运行 make perl
时,它会失败
make patch
succeeded, but when I run make perl
it fails with this
LD_LIBRARY_PATH=/home/reed022/.local/share/Trash/files/perl-5.2.12.3 arm-linux-gcc -o miniperl \
gv.o toke.o perly.o pad.o regcomp.o dump.o util.o mg.o reentr.o mro.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o doop.o doio.o regexec.o utf8.o taint.o deb.o universal.o globals.o perlio.o perlapi.o numeric.o mathoms.o locale.o pp_pack.o pp_sort.o \
miniperlmain.o opmini.o perlmini.o -lnsl -ldl -lm -lcrypt -lutil -lc
LD_LIBRARY_PATH=/home/reed022/.local/share/Trash/files/perl-5.2.12.3 ./miniperl -w -Ilib -MExporter -e '<?>' || make minitest
./miniperl: 1: Syntax error: word unexpected (expecting ")")
我认为输出的相关部分是。/miniperl -w -Ilib -MExporter -e'<?>'||制作最小的
部分。虽然我不确定。令我感到困惑的是,交叉编译环境将尝试运行测试,因为它所针对的系统与所构建的系统不同。
I think the relevant part of the output is the ./miniperl -w -Ilib -MExporter -e '<?>' || make minitest
part. Though I'm not sure. It seems confusing to me that the cross-compilation environment would try to run tests, since it's targeting a different system than the one it's being built on.
我完全迷失了从这里去的路。我与之交谈的人对交叉编译程序没有太多经验。
I'm completely lost as where to go from here. The people I've talked to haven't had much experience with cross-compiling programs.
UPDATE
我决定删除perl源文件夹然后重新提取它,以为先前针对Ubuntu主机的perl编译可能与当前的交叉编译搞混了。我现在遇到了一个不同但相似的错误。
UPDATE
I decided to delete the perl source folder and re-extract it, thinking that the previous compilation of perl for the Ubuntu host machine might have been messing with the current cross-compilation. I'm now getting a different but similar error.
`sh cflags "optimize='-O2'" generate_uudmap.o` -fexpensive-optimizations -fomit-frame-pointer -O2 -march=armv4 -mtune=strongarm1100 generate_uudmap.c
CCCMD = arm-linux-gcc -DPERL_CORE -c -fexpensive-optimizations -fomit-frame-pointer -O2 -march=armv4 -mtune=strongarm1100 -O2 -Wall
arm-linux-gcc -o generate_uudmap generate_uudmap.o -lnsl -ldl -lm -lcrypt -lutil -lc
./generate_uudmap uudmap.h bitcount.h
./generate_uudmap: 1: Syntax error: word unexpected (expecting ")")
make[1]: *** [bitcount.h] Error 2
make[1]: Leaving directory `/home/reed022/Downloads/perl-5.12.3'
make[1]: Entering directory `/home/reed022/Downloads/perl-5.12.3'
make[1]: *** No rule to make target `more'. Stop.
make[1]: Leaving directory `/home/reed022/Downloads/perl-5.12.3'
make: *** [perl] Error 2
推荐答案
显然,交叉编译perl的方法不是在Cross目录下进行。我需要将标志传递给Configure进行设置。我还需要使用SSH服务器设置ARM计算机(我使用了 dropbear ) 。我使用的标志是
Apparently the way to cross compile perl is not to do it under the Cross directory. I needed to pass flags to Configure to set it up. I also needed to setup the ARM computer with an SSH server (I used dropbear). The flags I used are
sh ./Configure
-Dusecrosscompile
-Dtargethost=<IP of ARM computer>
-Dtargetuser=<user name>
-Dtargetarch=arm-linux
-Dcc=arm-linux-gcc
-Dusrinc=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/include/
-Dincpth=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/include/
-Dlibpth=/opt/FriendlyARM/toolschain/4.4.3/lib
-Dtargetdir=/sdcard/perl
这篇关于交叉编译Perl for ARM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!