Perl dynamic modules


I am dealing with / attempting to solve this issue:

The basic issue is, perl package build uses a bootstrap approach, where previously compiled modules are used in subsequent build steps. When target != host, perl compile fails due to required dynamic libraries being of wrong $ARCH.

I have mostly solved this by altering perl_build_dir/Makefile (as created by configure. Snippet:

d_dummy $(dynamic_ext):	$(MINIPERL_EXE) lib/ preplibrary makeppport $(DYNALOADER) FORCE $(PERLEXPORT) $(LIBPERL)
	if [ $@ == lib/auto/File/ ]; then ls -la ext/File-Glob/; fi
	for f in $(dynamic_ext); \
	do \
		if [ -f $$f ] && [ ! -L $$f ]; \
		then \
			echo file: $$f; \
			ls -la $${f%/*}; \
			mkdir -p aarch64/$${f%/*}; \
			mv $$f aarch64/$$f; \
			ln -sf /home/rossb/OpenWrt/CortexA53/trunk/openwrt/build_dir/hostpkg/perl/perl-5.28.1/$$f $$f; \
		fi \

What I am doing is capturing all cross-compiled perl (aarch64) dynamic libraries to a parallel library directory and linking the library to the host/perl equivalent library so perl can use them for subsequent build steps. Later, during install step, the $ARCH correct libraries replace the host/perl equivalents.

This is mostly working except for the File/Glob module. My debug instrumentation yields this failure (and, the module is not built,although build completes:

LD_LIBRARY_PATH=/home/rossb/OpenWrt/CortexA53/trunk/openwrt/build_dir/target-aarch64_cortex-a53_glibc/perl/perl-5.28.1:/home/rossb/OpenWrt/CortexA53/trunk/openwrt/staging_dir/hostpkg/lib:/home/rossb/OpenWrt/CortexA53/trunk/openwrt/staging_dir/hostpkg/usr/lib:/home/rossb/OpenWrt/CortexA53/trunk/openwrt/staging_dir/host/lib ./miniperl -Ilib -I. -v lib/auto/File/  MAKE="make" LINKTYPE=dynamic
Can't find extension File in any of cpan dist ext at line 251.
if [ lib/auto/File/ == lib/auto/File/ ]; then ls -la ext/File-Glob/; fi
total 84
drwxr-xr-x  3 rossb rossb  4096 Nov 28  2018 .
drwxr-xr-x 43 rossb rossb  4096 Nov 28  2018 ..
-r--r--r--  1 rossb rossb  1893 Mar  1  2018 Changes
-r--r--r--  1 rossb rossb 13147 Nov  1  2018
-r--r--r--  1 rossb rossb 10440 Nov  1  2018 Glob.xs
-r--r--r--  1 rossb rossb  1067 Mar  1  2018 Makefile.PL
-r--r--r--  1 rossb rossb   882 Mar  1  2018 TODO
-r--r--r--  1 rossb rossb 26989 Nov  1  2018 bsd_glob.c
-r--r--r--  1 rossb rossb  3816 Mar  1  2018 bsd_glob.h
drwxr-xr-x  2 rossb rossb  4096 Nov 28  2018 t

The exact error is:
Can't find extension File in any of cpan dist ext at line 251

resulting in File:Glob not being built

I am unsure (no clue) how to specify the missing extension file.

I can provide perl/Makefile, files and patches if anyone wants to test drive.


Stupid error:

perl source path lib/auto/File/ path changed to lib/auto/File/Glob/ the $spec file was not found
may be a bug in stock openwrt perl also


For people requiring ability to build dynamic perl packages (which requires dynamic host/perl), the files are here:

extracting (from openwrt $TOPDIR):

mv feeds/packages/lang/perl/Makefile feeds/packages/lang/perl/Makefile_old
mv feeds/packages/lang/perl feeds/packages/lang/perl_old
tar -zxvf  perl-dynamic.tar.gz
make package/feeds/packages/perl/clean
make package/feeds/packages/perl/compile

should work for all targets.

I really think perl dynamic should be default for openwrt. Feed free to make it so.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.