IBM i PASE suite3270 v2.0

Build wc3270 from Source under IBM i/PASE/IBM OSS

4.5ga5  ·  Open-Source deps  ·  ppc64
Technical Build Documentation — Version 2.0

Build wc3270 from Source
under IBM i/PASE/IBM OSS

This second version maximizes the use of IBM i open-source software dependencies rather than mixing PASE and open-source libraries. The previous hybrid approach compiled successfully but did not behave reliably at runtime.

suite3270-4.5ga5 ppc64 / AIX ABI ncurses (open-source) readline (open-source) OpenSSL 1.1 libiconv rpmbuild /QOpenSys/pkgs

Goal & Limitations

Goal
  • Enable screen scraping on IBM i partitions via Python. This requires the wc3270 suite of emulators as an underlying dependency.
  • The p5250 and p3270 python modules are needed to achieve this. They rely on the wc3270 software suite.
Known Limitations
  • The x3270 (GUI) emulator is not supported.
  • DBCS characters are not supported — likely because this was compiled on a non-DBCS machine.

Prerequisites

  • Use an SSH session with bash as the active shell:
    /QOpenSys/pkgs/bin/chsh -s /QOpenSys/pkgs/bin/bash
  • Verify your PATH includes the required directories:
sh
echo $PATH
/QOpenSys/pkgs/bin:/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin
Source Archive

Download and extract suite3270-4.5ga5-src.tgz into ~/wc3270.

x3270.miraheze.org/wiki/Downloads ↗
Patch File

Apply the patch to the source tree before building.

⬇ full_diff.good5.patch See Annex A2 for procedure ↗
IBM OSS Package List

Download and check the required open-source packages list:

⬇ packages_intalled_list_for_compilation_wc3270-20260405.txt

1Environment Variables

No CFLAGS environment variable needs to be exported before configure in this version. All compiler flags are passed directly to the configure command.

2Configure

2.1 — Configure command

Run the single configure command below. It explicitly disables missing PASE functions via ac_cv_func_* cache variables and links against open-source ncurses and readline from /QOpenSys/pkgs:

The triple-escaped backslashes (\\\) in LESSPATH and MOREPATH are intentional — the shell consumes two levels of escaping, leaving one literal \ in the final compiled string value.
sh
./configure \
  --disable-x3270 \
  --prefix=/QOpenSys/pkgs \
  AR="ar -X64" \
  RANLIB="ranlib -X64" \
  ac_cv_func_asprintf=no \
  ac_cv_func_vasprintf=no \
  ac_cv_func_strcasestr=no \
  ac_cv_header_ncurses_h=yes \
  CPPFLAGS="-I/QOpenSys/pkgs/include -I/QOpenSys/pkgs/include/ncurses" \
  CFLAGS="-maix64 -O2 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE -D__EXTENSIONS__ -DLESSPATH=\\\"/QOpenSys/pkgs/bin/less\\\" -DMOREPATH=\\\"/QOpenSys/pkgs/bin/more\\\"" \
  LDFLAGS="-maix64 -L/QOpenSys/pkgs/lib -Wl,-blibpath:/QOpenSys/pkgs/lib:/usr/lib -liconv -lutil -lncurses -lreadline"

2.2 — Build Patch for Missing PASE Functions

Some functions are absent from the PASE libc. Compile them manually from the Common/ subtree. Position yourself at the build root first:

sh — from ~/wc3270/suite3270-4.5/
cp lib/include/unix/conf.h include/conf.h
cd Common
gcc -maix64 -I../include -c asprintf.c    -o asprintf.o
gcc -maix64 -I../include -c ft_strcasestr.c -o ft_strcasestr.o

3Make

Run the make command:

sh
make
Intermittent first-run failure — The first invocation may fail with an ar: No such file or directory error on asprintf.o. This is a known race condition in the build system. Simply re-run the exact same make command; it will complete successfully.

Try up to 3–4 times if needed. Compilation warnings on the second run are harmless.

Example of the transient error (first run):

ar: No such file or directory ar: 0707-117 The fopen system call failed on file asprintf.o. make[3]: *** [../../../lib/32xx/Makefile.obj:55: lib32xx.a] Error 1 make[3]: Leaving directory '.../obj/powerpc-ibm-os400/lib32xx' make[2]: *** [Makefile:40: all] Error 2 make[2]: Leaving directory '.../lib/32xx' make[1]: *** [Makefile.unix:91: lib32xx] Error 2 make[1]: Leaving directory '.../suite3270-4.5.good3' make: *** [Makefile:32: all] Error 2

Immediately re-run — this time it should finish cleanly:

sh — second attempt
make

4Install

Stage the installation into a temporary directory for inspection and later RPM packaging:

sh
mkdir /tmp/wc3270-package
export DESTDIR=/tmp/wc3270-package/
make DESTDIR=$DESTDIR install

After a successful install, verify the binaries under the staged tree:

ls -al /tmp/wc3270-package/QOpenSys/pkgs/bin/
 
drwxr-sr-x 2 ibmi_user 0 8192 Apr 2 12:21 .
drwxr-sr-x 4 ibmi_user 0 8192 Apr 2 12:21 ..
-rwxr-xr-x 1 ibmi_user 0 2245422 Apr 2 12:21 b32702.1 MB
-rwxr-xr-x 1 ibmi_user 0 2366980 Apr 2 12:21 c32702.3 MB
-rwxr-xr-x 1 ibmi_user 0 1258679 Apr 2 12:21 pr32871.2 MB
-rwxr-xr-x 1 ibmi_user 0 2017 Apr 2 12:21 prtodir
-rwxr-xr-x 1 ibmi_user 0 2149841 Apr 2 12:21 s32702.0 MB
-rwxr-xr-x 1 ibmi_user 0 91369 Apr 2 12:21 tcl3270
-rwxr-xr-x 1 ibmi_user 0 87662 Apr 2 12:21 x3270if

5Build RPM Archive

Create the rpmbuild directory tree

sh
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}

Create & populate the SPEC file

sh
nano ~/rpmbuild/SPECS/wc3270.spec
rpm spec
Name:           wc3270
Version:        4.5
Release:        1
Summary:        Console and GUI 3270 emulator for IBM i

License:        BSD
Group:          Applications/Emulators
BuildArch:      ppc
Prefix:         /QOpenSys/pkgs

%description
wc3270 is a suite of 3270 emulators for IBM i including c3270, x3270, and s3270.

%files
/QOpenSys/pkgs/bin/b3270
/QOpenSys/pkgs/bin/c3270
/QOpenSys/pkgs/bin/pr3287
/QOpenSys/pkgs/bin/prtodir
/QOpenSys/pkgs/bin/s3270
/QOpenSys/pkgs/bin/tcl3270
/QOpenSys/pkgs/bin/x3270if
/QOpenSys/pkgs/etc/x3270/ibm_hosts
/QOpenSys/pkgs/share/x3270/ibm_hosts

%install
# Make sure buildroot directories exist
mkdir -p %{buildroot}%{_bindir}
# mkdir -p %{buildroot}%{_sysconfdir}/x3270
mkdir -p %{buildroot}%{_datadir}/x3270
mkdir -p %{buildroot}/QOpenSys/pkgs/etc/x3270

# Copy binaries into standard bindir
cp /tmp/wc3270-package/QOpenSys/pkgs/bin/b3270   %{buildroot}%{_bindir}/
cp /tmp/wc3270-package/QOpenSys/pkgs/bin/c3270   %{buildroot}%{_bindir}/
cp /tmp/wc3270-package/QOpenSys/pkgs/bin/pr3287  %{buildroot}%{_bindir}/
cp /tmp/wc3270-package/QOpenSys/pkgs/bin/prtodir %{buildroot}%{_bindir}/
cp /tmp/wc3270-package/QOpenSys/pkgs/bin/s3270   %{buildroot}%{_bindir}/
cp /tmp/wc3270-package/QOpenSys/pkgs/bin/tcl3270 %{buildroot}%{_bindir}/
cp /tmp/wc3270-package/QOpenSys/pkgs/bin/x3270if %{buildroot}%{_bindir}/
cp /tmp/wc3270-package/QOpenSys/pkgs/etc/x3270/ibm_hosts \
   %{buildroot}/QOpenSys/pkgs/etc/x3270/

# Copy config file to sysconfdir
# cp /tmp/wc3270-package/QOpenSys/pkgs/etc/x3270/ibm_hosts %{buildroot}%{_sysconfdir}/x3270/

# Optionally copy to datadir if needed
cp /tmp/wc3270-package/QOpenSys/pkgs/etc/x3270/ibm_hosts \
   %{buildroot}%{_datadir}/x3270/

Run rpmbuild

sh
rpmbuild -bb ~/rpmbuild/SPECS/wc3270.spec
The RPM will be generated at: ~/rpmbuild/RPMS/ppc/wc3270-4.5-1.ibmi7.4.ppc.rpm  —  ⬇ download wc3270-4.5-1.ibmi7.4.ppc.rpm

Verify installed file list

sh
rpm -qlp ~/rpmbuild/RPMS/ppc/wc3270-*.rpm
/QOpenSys/pkgs/bin/b3270
/QOpenSys/pkgs/bin/c3270
/QOpenSys/pkgs/bin/pr3287
/QOpenSys/pkgs/bin/prtodir
/QOpenSys/pkgs/bin/s3270
/QOpenSys/pkgs/bin/tcl3270
/QOpenSys/pkgs/bin/x3270if
/QOpenSys/pkgs/etc/x3270/ibm_hosts
/QOpenSys/pkgs/share/x3270/ibm_hosts
All binaries and data files install under /QOpenSys/pkgs/, which is the standard location for IBM i open-source software managed through YUM/RPM.

A1Annex — Create a Patch File

To generate full_diff.good5.patch from your customized source tree, both the original and modified directories must sit at the same parent level. Clean the customized tree of all generated files first.

sh
cd suite3270-4.5.good5/
diff -ruN \
  --exclude='config.log' \
  --exclude='config.status' \
  --exclude='*.o' \
  --exclude='Makefile' \
  --exclude='obj' \
  ../suite3270-4.5 . > full_diff.good4.patch

A2Annex — Apply the Patch File

Place full_diff.good4.patch at the same directory level as suite3270-4.5/. The source tree must be vanilla (freshly unpacked). Always run a dry-run first:

sh
cd suite3270-4.5

# Dry-run: verify the patch applies cleanly without modifying any files
patch -p1 -N --dry-run < ../full_diff.good4.patch

# Real apply: modifies the source tree permanently
patch -p1 -N < ../full_diff.good4.patch
The -N flag ignores already-applied hunks. If the dry-run reports no errors, the real apply is safe to run.

A3Annex — Quick Smoke Test

After installing, do a quick sanity check to confirm the c3270 binary works and links correctly. Set the locale variables and connect to localhost:

sh
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
c3270 localhost