Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

microperl for embedded target

by gklose (Novice)
on Jul 16, 2014 at 12:05 UTC ( #1093857=perlquestion: print w/replies, xml ) Need Help??
gklose has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks -- would appreciate some assistance, if anyone has any experience with building microperl for an embedded target. I am building it using the current perl distribution 5.20.0. I found a few snippets here and there, and the concept seems simple, however I've run into trouble. I've been able to build microperl, and run it, in my host environment (Debian/Jesse). Then I have tried building it for my embedded PPC target:

$ make -f Makefile.micro CC=powerpc-603e-linux-gcc

What I find is that the build process runs on my host, but it builds the "helper" (I think) ugenerate_uudmap and then tries to use it. But since it was built for the target, the binary will not run on the host, for the build. The error message says "./ugenerate_uudmap: ./ugenerate_uudmap: cannot execute binary file".

Prior to that, the make is running these two lines:

powerpc-603e-linux-gcc -o ugenerate_uudmap ugenerate_uudmap.o -lm

./ugenerate_uudmap uuudmap.h ubitcount.h umg_data.h

I would really appreciate any assistance. Thanks.


Replies are listed 'Best First'.
Re: microperl for embedded target
by RMGir (Prior) on Jul 16, 2014 at 13:03 UTC
    My original answer doesn't work, based on what I'm reading in perl5200delta.pod:

    We now build binaries for miniperl and generate_uudmap to be used on the host,
    rather than running every miniperl call on the target; this means that, short
    of 'make test', we no longer need access to the target system once Configure is
    done.  You can provide already-built binaries through the C<hostperl> and
    C<hostgenerate> options to Configure.
    So it sounds like if you're doing the cross-compilation correctly, perl shouldn't be trying to run generate_uudmap locally... Strange! You may want to post a perlbug about this if you can't resolve it, sounds like something strange is going on.

    Make sure you reread the Cross-compilation section of "INSTALL" first, though.

    I've never tried this, but this may work.

    In a separate tree, build ugenerate_uudmap *natively* for your platform.

    Then copy the binary into your cross-compile tree, and make shouldn't try to rebuild it but would just run it (unless the makefile builds and runs it in the same rule).

    Good luck!

    PS: You may have to rinse/repeat for other helper programs, I'm not sure

      > Thank you -- I'll give that a try. Thanks, that did appear to work, but I have yet to try the resulting binary image on my target. However, I'm somewhat alarmed :-)...the image is 2.52M unstripped. After I stripped it, it was down to a measly 2.42M. I suspect I'm not doing something right, but at the moment I don't see it. After all the native perl on the host (in /usr/bin) is only 11.96k. Guy
        Okay -- saw your addendum above. Thanks for checking into this. I appreciate your assistance. Thanks, Guy

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1093857]
Approved by Bloodnok
Front-paged by Bloodnok
[stevieb]: choroba Been there, done that :) Better too many than not enough though!
[stevieb]: I very often write a base set of unit tests before writing any code. It helps dictate the API, and ensures my earliest of ideas stay on track.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2017-07-21 20:07 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (335 votes). Check out past polls.