Build a 64-bit Perl for z/OS Unix System Services
You will finish with a tested, 64-bit dynamic Perl installed in a path you choose on z/OS Unix System Services (USS). The route below follows the perlos390(1) shipped with Perl 5.38.2, which covers both ASCII and native EBCDIC builds. Allow roughly an hour for source transfer, configuration, compilation and tests, longer on a busy or lightly provisioned system.
The route
Jump straight to the step you need, or tick off Done means at the end.
- 1. Decide the character set and install path
- 2. Prepare the USS tools and host configuration
- 3. Get and unpack an ASCII source tree
- 4. Configure a dynamic ASCII Perl
- 5. Build and test before installing
- 6. Install the ASCII build
- 7. Build EBCDIC Perl as a separate tree
- 8. Run the installed Perl deliberately
This is a build guide, not a Linux cross-compile recipe. Run the commands in a USS shell on the target z/OS system. You need a z/OS C99 compiler, GNU make 4.1 or later, enough space for the source and build products, and a working Perl if you are producing an EBCDIC tarball. Installing below a system-owned directory usually needs an authorised account; the build itself does not.
1. Decide the character set and install path
Choose the mode before unpacking anything. ASCII Perl is the more familiar choice when the source and surrounding tools are ASCII-oriented. Native EBCDIC Perl is appropriate when the USS environment and its files are EBCDIC. Perl can support both, but each binary must be built explicitly for its character set.
Use separate prefixes so the two installations cannot overwrite one another. The examples use /usr/local/perl/ascii and /usr/local/perl/ebcdic. Replace them with paths approved for your system. The make install step changes that destination, so check it before you run it.
2. Prepare the USS tools and host configuration
Check the tools you will actually invoke. The names and options of USS commands can differ from their Linux counterparts, so do not assume a Linux tar utility is available. The manpage calls out GNU make, the z/OS c99 compiler, and, when needed, native Git and gunzip ports.
make --version
c99 --version
git --version
gunzip --version
For a build that needs network access, check that /etc/protocol and either /etc/resolv.conf or /etc/hosts are present and usable. Also check the process limits before compiling:
ulimit -a
A world-readable /tmp may need its sticky bit enabled for tests. Ask the USS administrator to correct that if required. Do not change shared permissions casually: this is a host configuration change, not a Perl build option.
3. Get and unpack an ASCII source tree
For a stable release, download the source tarball from the official Perl download page on a connected system, then transfer it to USS. For a development tree, clone the Perl repository instead. The placeholder below deliberately leaves the version visible; substitute the filename you downloaded.
gunzip perl-V.R.M.tar.gz
tar -xvf perl-V.R.M.tar
# Alternatively, on USS:
pax -r -f perl-V.R.M.tar
mv perl-V.R.M perl
cd perl
Use one extraction command, not both. Confirm that the source tree contains Configure before continuing:
ls -l Configure
./Configure -h 2>/dev/null | head
The second command is only a presence check. The real configuration happens in the next step.
4. Configure a dynamic ASCII Perl
Tag the source as ISO 8859-1 before an ASCII build. Then put the source directory first in both search paths. LIBPATH is the z/OS library search variable, not a Linux LD_LIBRARY_PATH replacement.
chtag -R -h -t -cISO8859-1 *
export PATH=$PWD:$PATH
export LIBPATH=$PWD:$PATH
./Configure -Dprefix=/usr/local/perl/ascii -des \
-Duse64bitall -Dusedl
The -d portion selects defaults, -e continues through configuration, and -s reduces unnecessary output. The local guide includes -Dusedevel for a development checkout; omit it for a stable release. If you run Configure without these options, it asks interactively about many settings instead.
-Duse64bitall selects the 64-bit build described by this guide. -Dusedl enables dynamic loading, which is needed for XS modules such as DBI and JSON::XS without rebuilding the Perl binary for every module change.
5. Build and test before installing
Compile with GNU make, then run the Perl test harness. The test suite is the checkpoint that separates a configured source tree from a usable interpreter.
make
make test_harness
The Perl 5.38.2 z/OS instructions warn that around a dozen failures may occur among nearly 2,500 tests. Treat that as a prompt to inspect the failures, not as permission to ignore every failure. Save the output, identify whether the failures are known EBCDIC or host issues, and stop if the compiler or core interpreter is failing.
If the build reports Out of memory!, first inspect ulimit -a and the GNU make build. The guide points to rebuilding GNU make for OS/390 and to compiler placement in the LPA or ELPA. A 31-bit build has additional heap and stack constraints; this guide avoids that path by selecting 64 bits.
6. Install the ASCII build
Installation writes into the prefix chosen during configuration and may require elevated USS authority. Review the prefix, then run:
make install
This does not replace the system Perl unless you deliberately selected a system prefix. If you need to undo this installation, remove only the files under the chosen private prefix using your site's approved change procedure. Do not recursively remove /usr/local or any shared Perl tree.
7. Build EBCDIC Perl as a separate tree
An EBCDIC build starts from the populated source tree but must not be tagged as ASCII. With a working Perl available on USS or another connected system, create an EBCDIC tarball:
cd perl
Porting/makerel -e
Transfer the resulting perl-V.R.M.tar.gz to USS, unpack it, and enter the extracted directory. If makerel cannot issue tar, the local instructions provide this fallback on the machine holding the source:
cd ..
tar cf - --format=ustar perl-V.R.M | gzip --best > perl-V.R.M.tar.gz
After unpacking on USS, leave the files untagged. Configure the second tree with its own prefix and the same 64-bit dynamic options:
export PATH=$PWD:$PATH
export LIBPATH=$PWD:$PATH
./Configure -Dprefix=/usr/local/perl/ebcdic -des \
-Duse64bitall -Dusedl
make
make test_harness
EBCDIC test failures need interpretation. Hard-coded ASCII code points, checksums and sort order can make a test report failure even when the operation is correct for EBCDIC. CPAN modules can still range from working to unusable, so test the modules your application actually depends on before deployment. GNU groff may also be needed before make install.
8. Run the installed Perl deliberately
For ASCII Perl, set the conversion and tagging variables before adding the installation to your search paths:
export _BPXK_AUTOCVT=ON
export _CEE_RUNOPTS="FILETAG(AUTOCVT,AUTOTAG),POSIX(ON)"
export _TAG_REDIR_ERR=txt
export _TAG_REDIR_IN=txt
export _TAG_REDIR_OUT=txt
export PATH=/usr/local/perl/ascii:$PATH
export LIBPATH=/usr/local/perl/ascii/lib:$LIBPATH
perl -v
Check that the reported version is the one you installed. For EBCDIC, keep the source untagged and make sure input source files are tagged appropriately with chtag -t -c<CCSID>. When zopen tools are present, put the intended Perl's directories first; mixing zopen and native directories can select the wrong echo or other utility.
Done means
- The chosen source tree was tagged correctly for ASCII, or deliberately left untagged for EBCDIC.
Configurecompleted with a 64-bit prefix and dynamic loading selected.makecompleted andmake test_harnessresults were reviewed.make installwrote only to the intended prefix.PATH,LIBPATHand, for ASCII, the conversion variables select the installed Perl.perl -vreports the expected build, and application modules have been tested in the same character-set mode.