logo       

Getting (mini) Perl to cross-compile [long]: msg#00202

linux.distributions.gumstix.general

Subject: Getting (mini) Perl to cross-compile [long]

This is my gumstix-users delurk. Sorry for the length and untidiness
of this email, but I'm trying to provide some raw info for whoever is
concerned with getting Perl working on Gumstix. I'll revise and edit
this into a reasonable form as soon as I understand more about make
(and Gumstix, for that matter). "I am only an egg."

* EXECUTIVE SUMMARY

It is possible that I actually now have built a Gumstix u-boot file
that includes miniperl (of unknown quality). I will report after I've
gotten some sleep. :)

At a minimum, I have many questions and some data for the guy(s) at
Gumstix who got miniperl working back in 2004. :)


* DETAILS

My recent efforts have been based on the following hint. Some of the
suggestions (in particular, hacking $PATH) were not on my mind at
first, as you will see from my appended narrative.


* THE HINT

A page on the GMU Flockbots website,

http://cs.gmu.edu/~eclab/projects/robots/flockbots/pmwiki.php?n=Main.Python

(last modified on Jun 23, 2005)

says, in part:

==
Python and Perl Binaries

The tarball python-arm.tar.gz is a working build of Python-ARM for the
Gumstix, which resides in /mnt/mmc/python, and will only work in this
location.

The file perl5.8.4.gz is a working build of Perl for the Gumstix which
can reside anywhere, and it's minimal - perl interpreter only.

Recompiling Python and Perl on the Gumstix Toolchain

The main makefile compiles what is specified by the TARGETS variable.
To compile Python and Perl, add a line to the man Gumstix buildroot
makefile like: TARGETS+= python perl. When you run make, vanilla
versions of Python and Perl are downloaded and compiled for the ARM
architecture.

In the main Gumstix makefile, find the line that says:

TARGETS+=u-boot jffs2root

Leave that uncommented, that target is the one that makes your root_fs_arm.

You might need to add the location of the cross compiler to your PATH
variable, i.e.,

PATH=$PATH:gumstix-buildroot/build-arm/staging-area/bin/

With these patches, Python should compile out of the box. If you get
errors about wince.h and nwutil.h (Windows CE and some Netware stuff),
just remove all references to those header files.
==

Now, I could have just downloaded the gz file, but where's your sense
of adventure?


* NARRATIVE

"Plunge in and quit" narrative of my attempts to get perl to
cross-compile. 4 AM 2005.07.14 by MMB

I cut out some stuff I don't need for my application, such as the
sound stuff, add perl to the TARGET list, and run make. It winds
up doing a wget for the perl sources, and after the download, here's
approximately what happens (this is my nth run of make after the wget
of perl, not my first):

==
dev@colinux:~/gumstix-buildroot$ make
bzcat /home/dev/gumstix-buildroot/sources/dl/dropbear-0.44.tar.bz2 |
tar -C /home/dev/gumstix-buildroot/build_arm -xf -
/home/dev/gumstix-buildroot/sources/patch-kernel.sh
/home/dev/gumstix-buildroot/build_arm/dropbear-0.44
/home/dev/gumstix-buildroot/sources dropbear-*.patch

Applying /home/dev/gumstix-buildroot/sources/dropbear-init.patch using
plaintext:
patching file S50dropbear

Applying /home/dev/gumstix-buildroot/sources/dropbear-options.patch
using plaintext:
patching file options.h
Hunk #1 succeeded at 81 with fuzz 1 (offset -17 lines).
Hunk #2 succeeded at 99 (offset -17 lines).
Hunk #3 succeeded at 139 with fuzz 1.
Hunk #4 succeeded at 169 with fuzz 2 (offset -2 lines).
make -C /home/dev/gumstix-buildroot/build_arm/perl-5.8.4
make[1]: Entering directory `/home/dev/gumstix-buildroot/build_arm/perl-5.8.4'
make[1]: *** No rule to make target `wince.h', needed by `perl.h'. Stop.
make[1]: Leaving directory `/home/dev/gumstix-buildroot/build_arm/perl-5.8.4'
make: *** [/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/perl] Error 2
dev@colinux:~/gumstix-buildroot$
==

OK. So it seems to be complaining about "wince.h", as the Flockbots
website suggested it might.
grep reports two places that look interesting:

makefile:perl.h: wince.h
perl.h:#include "wince.h"

I don't really understand at what times makefile gets
re-created--there is a warning at the top
that it's generated via Makefile.SH , and will be over-written when a
Configure is done, but
I am too much of a newbie to know where / how the dependency actually
gets put into makefile . For experiment's sake, I make a safety copy
of makefile and then delete the wince.h line, save the file, cd
back up to gumstix-buildroot/ and do another make .

Now I get:

==
make -C /home/dev/gumstix-buildroot/build_arm/perl-5.8.4
make[1]: Entering directory `/home/dev/gumstix-buildroot/build_arm/perl-5.8.4'
`sh cflags "optimize='-Os -march=armv5te -mtune=xscale
-Wa,-mcpu=xscale -pipe'" miniperlmain.o` miniperlmain.c
CCCMD = arm-linux-uclibc-gcc -DPERL_CORE -c
-fno-strict-aliasing -I/usr/include/gdbm -Os -march=armv5te
-mtune=xscale -Wa,-mcpu=xscale -pipe -Wall
/bin/sh: line 1: arm-linux-uclibc-gcc: command not found
make[1]: *** [miniperlmain.o] Error 127
make[1]: Leaving directory `/home/dev/gumstix-buildroot/build_arm/perl-5.8.4'
make: *** [/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/perl] Error 2
dev@colinux:~/gumstix-buildroot$
==


Something else seems to be broken. Could it be that there's a naming
problem, or a symbolic link that's not getting created, or some such?
In grepping through the output of a relatively clean make that I saved
to a file, I notice some lines (for example, in the busybox
compilation) that start with the invocation of

/home/dev/gumstix-buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-gcc ...

I am guessing that the miniperl makefile isn't completing this
invocation path in the way that busybox makefile is. It's an ugly
thing to do, but I notice that near the top of perl's makefile is a
line that reads:

CC = arm-linux-uclibc-gcc

So I am going to try hacking a hard full path into that line and see
what happens. This might cost me time in Purgatory, but what the
hell... Hmm. make doesn't seem to see the change I made. I suspect
someone somewhere is caching the old makefile content. Try editing
Makefile next. No dice. How about config.sh ? That looks like the
ticket. Comments inside it warn that I will need to propagate changes
using 'Configure -der'. Hmm. Well, I monkey around a bit re-editing
because makefile loses the change I made to remove the wince.h line,
and now I get another complaint:

==
make[1]: Entering directory `/home/dev/gumstix-buildroot/build_arm/perl-5.8.4'
`sh cflags "optimize='-Os -march=armv5te -mtune=xscale
-Wa,-mcpu=xscale -pipe'" miniperlmain.o` miniperlmain.c
CCCMD =
/home/dev/gumstix-buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-gcc
-DPERL_CORE -c -fno-strict-aliasing -I/usr/include/gdbm -Os
-march=armv5te -mtune=xscale -Wa,-mcpu=xscale -pipe -Wall
make[1]: *** No rule to make target `nwutil.h', needed by `perl.o'. Stop.
make[1]: Leaving directory `/home/dev/gumstix-buildroot/build_arm/perl-5.8.4'
make: *** [/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/perl] Error 2
dev@colinux:~/gumstix-buildroot$
==

This is the other bogus make dependency predicted by the Flocks folks.
So let's just go for broke and delete that line in makefile , too.

Well! It seems to compile! Who knows if it will link...? See below.
There are still more places that need to be hacked into submission,
that reference "arm-linux-uclibc-gcc".

==
`sh cflags "optimize='-Os -march=armv5te -mtune=xscale
-Wa,-mcpu=xscale -pipe'" walk.o` -DPERL_FOR_X2P walk.c
CCCMD =
/home/dev/gumstix-buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-gcc
-c -fno-strict-aliasing -I/usr/include/gdbm -Os -march=armv5te
-mtune=xscale -Wa,-mcpu=xscale -pipe
`sh cflags "optimize='-Os -march=armv5te -mtune=xscale
-Wa,-mcpu=xscale -pipe'" a2p.o` a2p.c
CCCMD =
/home/dev/gumstix-buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-gcc
-c -fno-strict-aliasing -I/usr/include/gdbm -Os -march=armv5te
-mtune=xscale -Wa,-mcpu=xscale -pipe
arm-linux-uclibc-gcc -o a2p hash.o str.o util.o walk.o a2p.o -lm
make[2]: arm-linux-uclibc-gcc: Command not found
make[2]: *** [a2p] Error 127
make[2]: Leaving directory
`/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/x2p'
make[1]: *** [translators] Error 2
make[1]: Leaving directory `/home/dev/gumstix-buildroot/build_arm/perl-5.8.4'
make: *** [/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/perl] Error 2
==

Blearily, I wonder what would happen if I just munged my $PATH
temporarily, to make the link pass happy. I do that. Later, I review
the Flockbots hint and see that I might have done that much earlier,
but what the heck. Try another make. WOW. It allllmost runs without a
fatal error. I try this a couple of times. Just looking at the last
run, the tail is:

==
Making Time::HiRes (static)
make[3]: Entering directory
`/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/ext/Time/HiRes'
make[3]: Leaving directory
`/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/ext/Time/HiRes'
make[3]: Entering directory
`/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/ext/Time/HiRes'
make[3]: Leaving directory
`/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/ext/Time/HiRes'

Making attrs (static)
make[3]: Entering directory
`/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/ext/attrs'
make[3]: Leaving directory
`/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/ext/attrs'
make[3]: Entering directory
`/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/ext/attrs'
make[3]: Leaving directory
`/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/ext/attrs'

Making re (static)
make[3]: Entering directory
`/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/ext/re'
make[3]: Leaving directory
`/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/ext/re'
make[3]: Entering directory
`/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/ext/re'
make[3]: Leaving directory
`/home/dev/gumstix-buildroot/build_arm/perl-5.8.4/ext/re'
make[2]: [extras.install] Error 1 (ignored)
make[2]: Leaving directory `/home/dev/gumstix-buildroot/build_arm/perl-5.8.4'
make[1]: Leaving directory `/home/dev/gumstix-buildroot/build_arm/perl-5.8.4'
mv usr/bin/perl5.8.4 usr/bin/perl
mv: cannot stat `usr/bin/perl5.8.4': No such file or directory
make: *** [/home/dev/gumstix-buildroot/build_arm/root/usr/bin/perl] Error 1
==

This last looks weird and even potentially dangerous to me. Some rule
fired off that might have overwritten my coLinux Perl installation.
Fortunately, it apparently couldn't/didn't.

But it also looks as if it was at the tail end of the make process.

As I said at the top, it is possible that I actually now have a u-boot
file that includes miniperl (of unknown quality).

Regards,

Mike

--
Michael M. Butler : m m b u t l e r ( a t ) g m a i l . c o m
Churchill once said, "When you're going through hell, KEEP GOING".


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise