How to cross compile Perl modules

2019-07-31 06:29发布

问题:

I am trying to install Unix Bench into iMX6 Yocto. I successfully cross-compiled Unix Bench source code. When I run it, get error like this:

root@imx6qsabresd:/home/UnixBench# ./Run
Can't locate POSIX.pm in @INC

It looks like Perl the module is missing. So How to install these dependent modules into Yocto?

use POSIX qw(strftime);
use Time::HiRes;
use IO::Handle;
use FindBin;

BTW, is there any Unix Bench version run without Perl?

回答1:

The OpenEmbedded build system aggressively splits default Perl package into tiny modules minimizing size of the target system (when you don't need all core Perl modules you just don't install all of them), so to install 'perl' package there is not the same as to install 'perl' package in Debian or some other standard distro. You can see what is installed with 'perl' via opkg files perl command (if you're using ipk packages, of course).

So what you need is to install additional packages that are already built when building Perl. They have very simple naming scheme of perl-module-*, so for your package that would be perl-module-posix, perl-module-time-hires, perl-module-io-handle and perl-module-findbin. Of course they can also have some dependencies, so better make a proper recipe for your program and specify RDEPENDS appropriately.