Cross compile perl for QNX 6.6.0 armle v7

1.3k views Asked by At

I'm trying to cross compile perl 5.24 using following method since the target machine does not have ssh installed. https://github.com/arsv/perl-cross

Just for Fyi, my local machine is ubuntu x86_64 GNU/Linux.

I configure the toolchain with the following option:

./configure -Dsysroot=$QNX_TARGET -Dcc=ntoarmv7-gcc -Dtargetarch=armle -Dprefix=$HOME/localperl -Duseshrplib

The reason I think the above scripts worked just fine because it generates the makefile with the following message:

Generating config.h
Extracting config.h (with variable substitutions)
Generating Makefile.config
Configuration completed for native build

        platform:  x86_64-
      c compiler:  ntoarmv7-gcc
              ld:  ntoarmv7-gcc
              ar:  ar
          ranlib:  ranlib

when i run the make -j4 option i end up getting either of the following 2 results:

./generate_uudmap uudmap.h bitcount.h mg_data.h
./generate_uudmap: 1: ./generate_uudmap: Syntax error: word unexpected (expecting ")")
make: *** [uudmap.h] Error 2

OR

cp -f op.c opmini.c
cp -f perl.c perlmini.c
cp -f ext/re/re.pm lib/re.pm
sh cflags.SH
cp -f dist/ExtUtils-ParseXS/lib/ExtUtils/xsubpp lib/ExtUtils/xsubpp
ntoarmv7-gcc -DPERL_CORE --sysroot=/opt/qnx650/target/qnx6 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -fPIC -Wno-unused-function -c -o op.o op.c
./miniperl_top lib/unicore/mktables -w -C lib/unicore -P pod -maketest -makelist -p
./miniperl_top: no ./miniperl found; build it before using miniperl_top
make: *** [lib/unicore/CombiningClass.pl] Error 1

I couldn't find much info on how to resolve the above issues. Could it be because i have not provided correct setting options for ./configure ?? If so, can you provide more insight on this.

EDIT:

It looks like i was passing the wrong information to ./configure script (it was considering it as the native rather than cross), I updated it with the following and was able to make bit of progress.

./configure -Dsysroot=/opt/qnx6 -Dcc=arm-unknown-nto-qnx6.6.0eabi-gcc --target-tools-prefix=arm-unknown-nto-qnx6.6.0eabi- --target=arm-unknown-nto-qnx6.6.0eabi  --host=arm-unknown-nto-qnx6.6.0eabi -Dprefix=$HOME/localperl

with this, the configuration was successfull for the cross platform. Now when I perform the make, it runs fine for a bit and I run it following error

arm-unknown-nto-qnx6.6.0eabi-ar cru libperl.a op.o perl.o gv.o toke.o perly.o pad.o regcomp.o dump.o dquote.o util.o mg.o reentr.o mro_core.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 keywords.o caretx.o time64.o DynaLoader.o
arm-unknown-nto-qnx6.6.0eabi-ranlib libperl.a
./miniperl_top statars  > static.list
./miniperl_top extlibs  > ext.libs
 arm-unknown-nto-qnx6.6.0eabi-gcc -DPERL_CORE --sysroot=/opt/qnx6 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -c -o perlmain.o perlmain.c

arm-unknown-nto-qnx6.6.0eabi-gcc --sysroot=/opt/qnx6 -Wl,-E -o perl perlmain.o libperl.a   
libperl.a(pp.o): In function `Perl_pp_crypt':
pp.c:(.text+0xffd8): warning: The 'crypt' function has been deprecated in libc. Link against liblogin for extended algorithm support.
libperl.a(toke.o): In function `Perl_scan_num':
toke.c:(.text+0x27b82): undefined reference to `pow'
libperl.a(util.o): In function `Perl_drand48_r':
util.c:(.text+0xa36e): undefined reference to `ldexp'
libperl.a(sv.o): In function `S_hextract':
sv.c:(.text+0x13ca0): undefined reference to `frexp'
libperl.a(sv.o): In function `Perl_sv_vcatpvfn_flags':
sv.c:(.text+0x16cc0): undefined reference to `frexp'
libperl.a(time64.o): In function `Perl_gmtime64_r':
time64.c:(.text+0x338c): undefined reference to `fmod'
.
.
time64.c:(.text+0x359c): undefined reference to `floor'
time64.c:(.text+0x37e6): undefined reference to `ceil'
collect2: error: ld returned 1 exit status
make: *** [perl] Error 1
1

There are 1 answers

0
stack764 On

final problem was related to linking the libraries. adding -lm fixed the problem

arm-unknown-nto-qnx6.6.0eabi-gcc --sysroot=/opt/qnx660/target/qnx6 -Wl,-rpath,/home/swgroup/localperl/lib/perl5/5.24.0/arm-/CORE -Wl,-E -o perl perlmain.o libperl.so -lm