From YiPs Wiki (i powered)


(click to open)

Quick Page Table of Contents




Most of these instructions are out of date with the times. The new LPP OPS has much better setup of GCC, including chroot development. See OpenSourceBeta - GCC and chroot.

gcc on IBM i

A quick script to help install gcc on IBM i. This information is offered “as is”.

Installing gcc

Thanks to Michael Perzlís fantastic site (, IBM i binaries of many OpenSource projects are available. Though, prior to installing gcc you need to prepare your system according to Open Source Binaries (you donít need to install any packages using Ė this script points to the old IBM binaries).

Once youíve prepared your system according to the wikiís instructions, run (also copied to /QOpenSys/download) in a PASE shell (CALL QP2TERM) to install gcc and all its prereqs. Using --all as the sole argument will do the trick. To see the complete syntax, call this script without any arguments.

> [--package=<package>] [-m=<mode>|--mode=<mode>] [--replace]
 modes (action):
   --mode=complete - wget and install rpms (default)
   --mode=wget     - wget rpms only
     --replace     - When using mode 'complete' or 'wget' existing rpm files will be replaced
   --mode=install  - install rpms only
   --mode=erase    - uninstall/erase rpm packages (risky)
   --mode=destroy  - uninstall/erase all rpm packages matching general name (VERY risky)
   --mode=clean    - remove rpm files not product (after install, not recommended)
 modes (display):
   --mode=info     - display rpms for selected package
   --mode=content  - display rpm content for selected package (rpm -qlp)
   --mode=depend   - display rpm dependencies for selected package (rpm -qRp)
   --mode=query    - display rpm currently installed for selected package (rpm -qa)
   --package=all (default)
 rpm (versions):
  gcc-4.6.2-1  gcc-c++-4.6.2-1  gcc-cpp-4.6.2-1 
  libgcc-4.6.2-1  libgomp-4.6.2-1  libstdc++-4.6.2-1 
  mpfr-3.1.2-1  gmp-5.0.5-1  libmpc-1.0.1-2 

Troubles some versions gcc (see Open Source Binaries this wiki)

bash-4.2$ gcc 
Could not load program gcc:
        Dependent module /opt/freeware/lib/libiconv.a( could not be loaded.
Could not load module /opt/freeware/lib/libiconv.a(
System error: No such file or directory
bash-4.2$ ls -l /opt/freeware/lib/libiconv.a
/opt/freeware/lib/libiconv.a not found
bash-4.2$ pwd
bash-4.2$ ./ aix61 wget libiconv-1.14-2
bash-4.2$ ./ aix61 rpm libiconv-1.14-2

don't forget paths ..

export PATH=/opt/freeware/bin:/usr/local/bin:$PATH
export LIBPATH=/opt/freeware/lib:/usr/local/lib:$LIBPATH

Test gcc

> e fred.c &
#include <stdio.h>
int main(int argc, char *argv[])
  printf("Hello Fred!\n");
> gcc -o fred fred.c 
> ./fred
Hello Fred!

gcc related packages (pecl compile example)

Not all binaries on Perzl will run on IBM i PASE, especially “latest / greatest” AIX (everyone instinctively wants latest), due to IBM i PASE lagging behind AIX technology releases, to wit, PASE is ALWAYS an older version, therefore as you can see below the 2008–10 vintage perzl binaries worked on my machine (V6R1), while “latest / greatest” may cause a core dump (aka m4 does not run … and … so on).

Follow instructions clean ...
> cd /QOpenSys
> ./

Follow instructions setup ...
> cd /QOpenSys/download
> ./                 (see new on web page removes old /usr/bin/rpm, etc. )

Follow instructions gcc load ... --package=all --mode=complete

Addtional files for pecl builds ...
rpm --ignoreos --ignorearch --nodeps --replacepkgs -hUv m4-1.4.10-1.aix5.1.ppc.rpm
rpm --ignoreos --ignorearch --nodeps --replacepkgs -hUv libsigsegv-2.10-1.aix5.1.ppc.rpm
rpm --ignoreos --ignorearch --nodeps --replacepkgs -hUv sed-4.2.1-2.aix5.1.ppc.rpm
rpm --ignoreos --ignorearch --nodeps --replacepkgs -hUv autoconf-2.63-1.aix5.1.ppc.rpm

also may need (see aix53 rpm libiconv-1.14-2)

cd /home/myuid/mypecl
export PHP_HOME=/usr/local/zendsvr
export PASE_TOOLS_HOME=/QOpenSys/usr
export AIX_TOOLS_HOME=/usr/local
export PERZL_TOOLS_HOME=/opt/freeware
export CC=gcc
export CFLAGS="-DPASE -I=.:$PHP_HOME/php/include"
export CCHOST=powerpc-ibm-aix6.1.0.0

./configure --build=$CCHOST --host=$CCHOST --target=$CCHOST --with-whatever=/path
make install
cp /usr/local/zendsvr/lib/php/20090626/*.so /usr/local/zendsvr/lib/php_extensions/.
Note: If you get 'Device busy' stop zendsrv web server then retry copy and restart


Tony “Ranger” Cairns - IBM i PHP / PASE

Retrieved from
Page last modified on August 19, 2016, at 11:38 AM EST