README.new - Cross-compilation for linux
This is second approach to linux cross-compilation, which should allow building full perl and extensions for target platform. Cross-compilation for linux uses similar approach and shares the same files as cross-compilation for WinCE.
We refer to HOST as the platform where the build is performed, and to TARGET as where final executables will run.
Unlike WinCE, output files from GCC cross-compiler are produced in the same directory where C files are. All TARGET binaries have different extensions so to distinguish HOST and TARGET binaries. Namely, object files for arm cross-compilation will have extension .armo, executable files will have .arm.
arm
.armo
.arm
After typical cross-compilation the following files will be built, among others:
sv.c sv.o sv.armo libperl.arma
(this approach may be reconsidered, however.)
miniperl is built. This executable is intended to run on HOST, and it will facilitate the remaining build process; all binaries built after it are foreign (TARGET) and should not run locally (HOST).
miniperl
Unlike HOST build, miniperl will not have Config.pm of HOST within reach; it rather will use the Config.pm from the cross-compilation directories. In fact, if the build process does have Config.pm within reach, this is only an indication of a mistake somewhere in the middle.
Config.pm
# following command is okay: ./miniperl -Ilib -MCross -MConfig -e 1 # following command should cluck, and it is bad if it does not: ./miniperl -Ilib -MConfig -e 1
After miniperl is built, configpm is invoked to create an appropriate Config.pm in the right place and its corresponding Cross.pm.
configpm
Cross.pm
File Cross.pm is dead simple: for given cross-architecture places in @INC a path where perl modules are, and right Config.pm in that place.
That said, miniperl -Ilib -MConfig -we 1 should report an error, because it cannot find Config.pm. If it does not give an error, a wrong Config.pm is substituted, and resulting binaries will be a mess.
miniperl -Ilib -MConfig -we 1
miniperl -MCross -MConfig -we 1 should run okay, and it will provide a correct Config.pm for further compilations.
miniperl -MCross -MConfig -we 1
During extensions build phase, the script ./ext/util/make_ext_cross is invoked.
./ext/util/make_ext_cross
All invocations of Makefile.PL are provided with -MCross so to enable cross-compilation.
Makefile.PL
-MCross
To compile, you need the following:
TODO
better distinguishing of config.h/xconfig.h, dependencies
object files created in ./xlib/cross-name/ ?
To install vars, copy and paste the appropriate command in to your terminal.
cpanm
cpanm vars
CPAN shell
perl -MCPAN -e shell install vars
For more information on module installation, please visit the detailed CPAN module installation guide.