Update a Port - Thinstation/thinstation GitHub Wiki

Update GCC and libstdc++ in the Environment

This documentation guides you through the process of updating GCC (with an example using GCC 12.2). As part of this update, libstdc++.so.6 will also be updated.

Prerequisites:

  1. Verify GLIBC Versions:
    strings /usr/lib/libstdc++.so.6 | grep GLIBC
    
  2. Fresh Environment: To ensure a smooth process, it's recommended to start with a fresh environment.

Steps:

  1. Clone the Repository:

    • Clone the Thinstation repository.
      git clone --depth 1 https://github.com/Thinstation/thinstation.git
      
    • This creates a folder named thinstation.
  2. Initialize Base Environment:

    • Navigate to the cloned directory and run the setup.
      cd thinstation
      ./setup-chroot
      
  3. Navigate to GCC Port:

    cd /ts/ports/core/gcc
    
  4. Edit the Pkgfile:

    • Modify the Pkgfile to update the GCC and ISL version. Ensure their versions are compatible. Also, verify the download links.
      name=gcc
      version=12.2.0
      _version=7
      _islver=0.24
      release=1
      _commit=c2103c17
      checkdepends=('dejagnu' 'inetutils')
      options=('!emptydirs')
      source=(ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-${_islver}.tar.bz2 
              ftp://gcc.gnu.org/pub/gcc/releases/gcc-$_version/$_name-$_version.tar.xz)
      
  5. Modify pkgmk Tool:

    vi /usr/bin/pkgmk
    
    • Comment out the line:
      #export LC_ALL=POSIX
      
  6. Set the Locale:

    • This is required to prevent bsdtar failures.
      localedef -c -f UTF-8 -i en_US en_US.UTF-8
      export LC_ALL=en_US.UTF-8
      
  7. Initiate Package Download:

    pkgmk -i -d
    
    • Note: If the MD5 checksum of the downloaded file doesn't match the locally stored one, reset the MD5 checksum using:
      pkgmk -um
      
  8. Build the Package:

    • Start the build process. This might take a few hours.
      pkgmk -i -u
      
    • If you encounter an error:
      ERROR: Building '/ts/ports/core/gcc/gcc#12.2.0-1.pkg.tar.xz' failed.
      
    • Reset the footprint using:
      pkgmk -uf
      
  9. Reattempt the Build:

    pkgmk -i -u
    
  10. Compress the Build:

    • For this you need memory, 16GB seems to be minimum
    shrink gcc
    
  11. Completion:

    • At the end of this process, the new GCC version is installed in the build environment. A new port file will also be generated. You can use this file, along with the Pkgfile, to set up a new build environment, saving compilation time and bypassing the steps mentioned above.