Build the GNU Compiler Collection for the z/TPF system

Complete the following steps to build the GCC.

Before you begin

  • Ensure that you have approximately 5 GB of free DASD to build the executable and linking format (ELF)-compatible compiler, which is also known as a cross-compiler.
  • Ensure that you have all the tools on Linux® that are required to build the ELF-compatible compiler by installing Linux using the standard options. Go to the Installing GCC website and see the documentation for installation to verify that you have all of the prerequisites.
  • Ensure that you have the following source files. For more information about how to get these files, see your IBM service representative.

    src-cross.tar.bz2 (the ELF-compatible compiler source files)

  • Download the compressed tpf-sysroot-ibm.version.tar.bz2 sysroot file that corresponds to the version of the compiler that you use from the TPF Family Products: Tools web page.
Note: The directory names that are used in the following instructions and examples are only suggestions. You can use any directory names that are appropriate for your environment. The following procedure uses /opt/tpf-gcc as the root location of the compiler.

Procedure

  1. Set up two subdirectories to use for installing the sysroot files and building the compiler.
    mkdir -p /opt/tpf-gcc/H-s390x-linux-gnu/s390x-ibm-tpf
    mkdir -p /opt/tpf-gcc/build
    
  2. Unpack the compiler source package.
    tar -xjf src-cross.tar.bz2
    mv src-cross /opt/tpf-gcc/
    

    After you complete this step, the /opt/tpf-gcc directory contains the src-cross subdirectory that contains all the compiler source.

  3. Unpack the sysroot files and install them in a subdirectory under the root compiler installation directory.
    tar -xjf tpf-sysroot-ibm.version.tar.bz2
    mv sys-root /opt/tpf-gcc/H-s390x-linux-gnu/s390x-ibm-tpf/

    After you complete this step, the /opt/tpf-gcc/H-s390x-linux-gnu/s390x-ibm-tpf directory contains the sys-root subdirectory that contains all the sysroot files. This location allows the next step to locate the sysroot files by default.

  4. Build and install the compiler.
    cd /opt/tpf-gcc/build
    /opt/tpf-gcc/src-cross/configure --prefix=/opt/tpf-gcc --exec-
    prefix=/opt/tpf-gcc/H-s390x-linux-gnu --host=s390x-linux-gnu --
    target=s390x-ibm-tpf --build=s390x-linux-gnu --disable-bootstrap --
    enable-languages=c,c++ --program-prefix=tpf- --without-newlib --with-
    sysroot
    make
    make install
    

    If you did not install the sysroot files in a relative subdirectory under your root installation location, you need to specify the --with-sysroot=/path/to/sys-root option instead of the --with-sysroot option. Using the relative subdirectory ensures that the cross compiler can run on other systems beyond the one it was built on.

  5. Complete setup and verification.
    1. Start of changeUpdate or create the following environment variables as part of your profile file (such as $HOME/.bash_profile, $HOME/.profile, or /etc/profile.local). For example, enter the following commands to use the GCC 7.3.0 compiler in your current session.
      export PATH=/opt/tpf-gcc/H-s390x-linux-gnu/bin:$PATH
      export TPF_X_GCC=/opt/tpf-gcc/s390x-ibm-tpf/include/c++/7.3.0
      export TPF_X_LIBS=/opt/tpf-gcc/H-s390x-linux-gnu/lib/gcc/s390x-ibm-tpf/7.3.0
      export TPF_INFO=/opt/tpf-gcc/share/info
      export INFOPATH=$TPF_INFO:$INFOPATH
      
      End of change
    2. Optional: To provide a choice of GCC compiler versions to application programmers, customize the tpftools/include_ztpf_user/maketpf.rules_cfg_GNU file to set four environment variables to define the installation location for the supported levels of the compiler. The following example shows a set of environment variables for GCC 7.Start of change
      ifeq ($(TPFGCC_VERSION),7)
        export TPF_X_GCC:=/opt/tpf-gcc-7/tpf_x_gcc
        export TPF_X_LIBS:=/opt/tpf-gcc-7/libs
        export TPF_INFO:=/opt/tpf-gcc-7/share/info
        export PATH:=/opt/tpf-gcc-7/bin:$(PATH)
      endif
      
      End of change
    3. Verify that the compiler was built successfully. Start a new Linux session and enter the following command:
      tpf-gcc -v
      If the compiler was built successfully and you use the GCC 7 compiler, you might see the output as the following example shows.
      Using built-in specs.
      COLLECT_GCC=tpf-gcc
      COLLECT_LTO_WRAPPER=/opt/tpf-17r1-7/H-s390x-linux-gnu/bin/../libexec/gcc/s390x-ibm-tpf/7.3.0/lto-
      wrapper
      Target: s390x-ibm-tpf
      Configured with: /cteam/gcc_src/tpf-17r1-7/src-cross/configure --prefix=/cteam/tpf-17r1-7 --exec-
      prefix=/cteam/tpf-17r1-7/H-s390x-linux-gnu --host=s390x-linux-gnu --target=s390x-ibm-tpf --build=s390x-
      linux-gnu --disable-bootstrap --enable-languages=c,c++ --program-prefix=tpf- --without-newlib --with-
      sysroot
      Thread model: tpf
      gcc version 7.3.0 20230127 (tpf-17r1-7) (GCC)
      
  6. Set up access to the IBM2047 code page. For more information, see Set up access to the IBM2047 code page.
  7. If APAR PJ45408 was installed before the GCC 7 compiler was installed, follow the migration considerations for the APAR.