Bug #8920
openbuild should ask perl for help
100%
Description
I tried to build the illumos-gate on OI hipster and OmniOSce r151023.
Building the PERL modules under usr/src/cmd/perl/... initially failed with errors like:
sh: line 1: /usr/perl5/5.10.0/bin/xsubpp: not found
- Error code 127
This is because Makefile.master hardcodes values for PERL_* macros and they are set specific to an older version of PERL than available on these distros. Rather than hard coding the values in these macros, the build should interrogate the perl interpreter for the appropriate information.
Files
Updated by Norm Jacobs over 5 years ago
- File 0001-8920-build-should-ask-perl-for-help.patch 0001-8920-build-should-ask-perl-for-help.patch added
The attached patch addresses the issue by using the "Config" modules to gather information from the perl interpreter.
PERL_VERSION_CMD= $(PERL) e 'use Config; print "$$Config{version}"' print "$$Config{revision}$$Config{patchlevel}"'
+PERL_PKGVERS_CMD= $(PERL) -e 'use Config; \
PERL_PREFIX_CMD= $(PERL) -e 'use Config; print $$Config{prefix}'
+PERL_PRIVLIB_CMD= $(PERL) -e 'use Config; print $$Config{privlib}'
+PERL_ARCHLIB_CMD= $(PERL) -e 'use Config; print $$Config{archlib}'
#
# Using $(...:sh) will only cause the PERL interpreter to run in the Makefiles
# that actually use the PERL_* macros, which keeps the build overhead lower.
+#
+PERL_VERSION= $(PERL_VERSION_CMD:sh)
+PERL_PKGVERS= $(PERL_PKGVERS_CMD:sh)
+PERL_PREFIX= $(PERL_PREFIX_CMD:sh)
+PERL_PRIVLIB= $(PERL_PRIVLIB_CMD:sh)
+PERL_ARCHLIB= $(PERL_ARCHLIB_CMD:sh)
While I was in there, I changed the build to ask the perl interpreter for its configured path information (prefix, archlib, and privlib) directories rather than constructing values using PERL_VERSION, which may have not matched the perl configuration.
I adjusted the use of the macros in the affected Makefiles, package manifest, and the environment file.
The changeset seems to build on OI Hipster without issue.
Updated by Andrew Stormont over 5 years ago
Make sure you are interrogating perl in ADJUNCT_PROTO and not the version in /usr/bin.
Updated by Norm Jacobs over 5 years ago
- File 0001-8920-build-should-ask-perl-for-help.patch 0001-8920-build-should-ask-perl-for-help.patch added
I'm updating Makefile.perl to do some Makefile macro substitution to create a PERL_ADJUNCT_PROTO macro that will contain $(ADJUNCT_PROTO) if the PERL used in the build is inside of ADJUNCT_PROTO and empty if it is not. I will prepend this value instead of ADJUNCT_PROTO in setting PERLDIR and PERLLIBDIR so that they refer to the installed bits if they are being used during the build or the ADJUNCT_PROTO bits if they are being used during the build.
The updated patch is attached. It contains the following additional diffs.
diff --git a/usr/src/cmd/perl/Makefile.perl b/usr/src/cmd/perl/Makefile.perl
index 034bc02c68..f1c89c4580 100644
--- a/usr/src/cmd/perl/Makefile.perl
+++ b/usr/src/cmd/perl/Makefile.perl@ -19,8 +19,14
@ include $(SRC)/lib/Makefile.lib
# but as they were also needed in usr/src/pkg/Makefile,
# the definition was moved to usr/src/Makefile.master
-PERLDIR = $(ADJUNCT_PROTO)$(PERL_PREFIX)
-PERLLIBDIR = $(ADJUNCT_PROTO)$(PERL_ARCHLIB)
# Do some macro substitution to figure out if PERL is inside the ADJUNCT_PROTO
# area so that the build uses includes and libraries from the ADJUNCT_PROTO if
# that is where PERL is located.
_PERL_ADJUNCT_PROTO=$(PERL:$(ADJUNCT_PROTO)%=$(ADJUNCT_PROTO))
PERL_ADJUNCT_PROTO=$(_PERL_ADJUNCT_PROTO:$(PERL)=)
+PERLDIR = $(PERL_ADJUNCT_PROTO)$(PERL_PREFIX)
+PERLLIBDIR = $(PERL_ADJUNCT_PROTO)$(PERL_ARCHLIB)
PERLINCDIR = $(PERLLIBDIR)/CORE
PERLMOD = $(MODULE).pm