Building MAXIT v11.300 on Ubuntu 24.04 with GCC 13.3.0

Here I describe my experience compiling the RCSB MAXIT software on my Ubuntu machine.

Well, first we will start with the requirements. This should be all you need, but please adjust it accordingly. I use my machine for development and it is possible that some requirements were already installed beforehand.

Required Packages

sudo apt update
sudo apt install build-essential flex bison g++ make

My System information

  • OS: Ubuntu 24.04 LTS
  • Compiler: GCC 13.3.0 (Default on Ubuntu 24.04)
  • Build system: GNU make 4.3
  • Tools: flex (2.6.4) and bison (3.8.2)

Problems I encountered and solutions

This is a description of which problems I found just in case you are interested. You can skip this and go directly to the Step-by-Step Build Instructions

Problem 1: Unsupported Operating System

The first message I found when running make bin:

Warning: this seems to be an unsupported operating system.

This happens because the etc/platform.sh script only supported GCC versions up to 11.x, but Ubuntu 24.04 ships with 13.x.
The platform detection in etc/platform.sh uses a series of grep commands to detect the GCC versions.

  • It checked for GCC 11.x, 10.x, 9.x 8.x, and assigned them to the gnu8 platform
  • It then fell back to checking older versions (5.x, 4.x,…)
  • If not match was found, it set sysid="unknown" and exited with an error

Solution: added detection for GCC 12.x and 13.x+ versions

# Added at the line 70 in the Linux section:
gcc_ver=$(gcc --version | grep -E " (1[3-9]|[2-9][0-9])\.")  # GCC 13.x or higher
if [ -z "$gcc_ver" ]
then
    gcc_ver=$(gcc --version | grep -e " 12\.")  # GCC 12.x
fi
# ... existing checks for 11.x, 10.x, etc.

This change routes GCC 12.x and 13.x to use existing gnu8 platform configuration.

Problem 2: Address Comparison Warning (-Werror=address)

Error message:

error: comparing the result of pointer addition '(Glob_dataBlockNameDIC + 5)' and NULL [-Werror=address]
cc1plus: all warnings being treated as errors

GCC 13 has stricter warning about pointer arithmetic comparisons with NULL. The code was checking &(array)[5] against NULL, which GCC 13 correctly identifies as always non-NULL.
Solution: Added -who-address to the compiler flags in etc/make.platform.gnu8:

NO_ADDRESS_WARNING=-Wno-address
WARNINGS=$(WARNINGS_AS_ERRORS) $(ALL_WARNINGS) $(NO_ADDRESS_WARNING)

Problem 3: Overloaded Virtual Function Warning (-Werror=overloaded-virtual)

Error message:

error: 'virtual bool ARGraph_impl::CompatibleEdge(void*, void*)' was hidden [-Werror=overloaded-virtual=]

GCC 13 is more strict detecting when virtual functions are hidden by overloaded versions in derived classes.
Solution: Added -Wno-overloaded-virtual to disable this specific warning.

NO_OVERLOADED_VIRTUAL_WARNING=-Wno-overloaded-virtual
WARNINGS=$(WARNINGS_AS_ERRORS) $(ALL_WARNINGS) $(NO_ADDRESS_WARNING) $(NO_OVERLOADED_VIRTUAL_WARNING)

Problem 4: Maybe-Uninitialized Warning (-Werror=maybe-uninitialized)

Error message:

error: 'str' may be used uninitialized [-Werror=maybe-uninitialized]

GCC 13 has enhanced flow analysis that can produce false positives for uninitialized variable detection.
Solution: Added -Wno-maybe-uninitialized to the compiler flags:

NO_MAYBE_UNINITIALIZED_WARNING=-Wno-maybe-uninitialized
WARNINGS=$(WARNINGS_AS_ERRORS) $(ALL_WARNINGS) $(NO_ADDRESS_WARNING) $(NO_OVERLOADED_VIRTUAL_WARNING) $(NO_MAYBE_UNINITIALIZED_WARNING)

Step-by-Step Build Instructions

1. Download and extract MAXIT

wget https://sw-tools.rcsb.org/apps/MAXIT/maxit-v11.300-prod-src.tar.gz
tar -xzfv maxit-v11.300-prod-src.tar.gz
cd maxit-v11.300-prod-src

2. Apply the GCC 13 Compatibility Fixes

Fix platform detection
Edit etc/platform.sh and locate the Linux section (around line 68). Replace the GCC version detection block with:

Linux)
#     Check if it is GCC version 13.x or higher
      gcc_ver=$(gcc --version | grep -E " (1[3-9]|[2-9][0-9])\.")
#     Check if it is GCC version 12.x
      if [ -z "$gcc_ver" ]
      then
          gcc_ver=$(gcc --version | grep -e " 12\.")
      fi
#     Check if it is GCC version 11.x
      if [ -z "$gcc_ver" ]
      then
          gcc_ver=$(gcc --version | grep -e " 11\.")
      fi
      # ... 

Fix Compiler Warning
Edit the etc/make.platform.gnu8 and update the warnings section (around line 43):

# NO_DEPRECATED defines flags to instruct C++ compiler not to report
# warnings about deprecated constructs still used in C++ code.
NO_DEPRECATED=-Wno-deprecated

# NO_ADDRESS_WARNING defines flags to disable address comparison warnings
# for GCC 13+ which treats pointer arithmetic comparisons with NULL as errors
NO_ADDRESS_WARNING=-Wno-address

# NO_OVERLOADED_VIRTUAL_WARNING defines flags to disable overloaded virtual warnings
# for GCC 13+ which is stricter about virtual function hiding
NO_OVERLOADED_VIRTUAL_WARNING=-Wno-overloaded-virtual

# NO_MAYBE_UNINITIALIZED_WARNING defines flags to disable maybe-uninitialized warnings
# for GCC 13+ which has enhanced flow analysis that may produce false positives
NO_MAYBE_UNINITIALIZED_WARNING=-Wno-maybe-uninitialized

# Collect all general warnings related flags
WARNINGS=$(WARNINGS_AS_ERRORS) $(ALL_WARNINGS) $(NO_ADDRESS_WARNING) $(NO_OVERLOADED_VIRTUAL_WARNING) $(NO_MAYBE_UNINITIALIZED_WARNING)

3. Build the Software

export RCSBROOT=$(pwd)
export PATH="$RCSBROOT/bin:$PATH"

make binary

4. Verify the Build

# Should show: maxit, process_entry, generate_assembly_cif_file
ls -la bin/

# Should display usage information
./bin/maxit

Posted in Uncategorized | Tagged , , , , | Leave a comment