Local Deployment of an AI Coding Tool on Linux: GCC Installation Fixes and Two-Mark Straightedge Geometry Tests

    This article covers how to troubleshoot C++ compilation errors when installing an AI coding tool on older Linux systems. It explains how to check toolchain versions and enable a newer GCC toolset in the current shell. It also covers startup, local network binding, API key handling, and least-privilege execution settings. Finally, it describes two code generation tests based on two-mark straightedge constructions, a regular heptagon and cube duplication, along with the verification criteria used.

    1. Installation Failures: Read the Error First

    When you deploy an AI coding tool locally, the first step is usually installing its command-line package globally:

    1. npm install -g <package_name>

    In most cases, this step completes without problems. On some traditional Linux systems, however, the installation fails with a C++ compilation error. The cause is often a low-level native module.

    These tools often depend on node-pty for terminal emulation. node-pty contains C++ code, so node-gyp compiles it on the local machine during installation. Whether the compilation succeeds depends on three things: the node-pty version, the Node.js version, and the g++ version on the system. These compatibility requirements change over time, so this article does not give fixed version numbers. Use the actual error log and the project documentation as the reference.

    To troubleshoot, first collect the version information for your current environment:

    1. g++ --version
    2. node --version
    3. npm --version
    4. npm ls node-pty

    If npm ls node-pty shows that the package is present but not installed correctly, check the npm log file. The log usually names the source file that failed to compile and includes the compiler message, such as an unrecognized C++ standard flag or a missing language feature.

    2. Default Compiler Versions in Linux Distributions

    The default GCC version varies widely between distributions. The figures below are typical, but the exact version depends on the distribution and its minor release, so confirm it on your own machine:

    • CentOS 7 typically ships with GCC 4.8.5, an old version that cannot build many modern native modules.
    • CentOS 8, Rocky Linux 8, and AlmaLinux 8 typically ship with GCC 8.5.0.
    • Newer RHEL 9 derivatives ship with a later default GCC, but check the actual output of g++ --version.

    When a build fails, do not assume the system has a newer compiler. Check the current g++ version first, then decide how to proceed.

    3. Switching to a Newer GCC Version

    The core approach is to leave the system’s default gcc and g++ unchanged and enable a newer toolchain only in the current shell session. This avoids affecting other programs on the system that depend on the older compiler.

    RHEL-family systems provide newer toolchains as GCC Toolset or Developer Toolset packages. The installation method varies by distribution.

    On CentOS 7, install Developer Toolset from the SCL repository:

    1. sudo yum install -y centos-release-scl
    2. sudo yum install -y devtoolset-11
    3. source /opt/rh/devtoolset-11/enable

    On RHEL 8, RHEL 9, or compatible derivatives, first list the GCC Toolset versions available in your repositories, then install one:

    1. dnf search gcc-toolset
    2. sudo dnf install -y gcc-toolset-<version>
    3. source /opt/rh/gcc-toolset-<version>/enable

    Replace <version> with a version that actually exists in your repository. Available versions differ between systems, so do not copy version numbers from another machine.

    After running source, verify that the compiler has switched in the current session:

    1. which g++
    2. g++ --version

    If the path points to a toolset under /opt/rh/ and the version is the one you expected, run the install again in the same terminal:

    1. npm install -g <package_name>

    The source command affects only the current terminal. Run the enable command again in each new terminal. To make the change permanent, add the command to your personal shell configuration file. Every new session will then use the newer compiler, so decide whether that suits your needs.

    Rolling back is simple. Close the current terminal or open a new shell, and the system default compiler returns.

    The table below summarizes how to check each item and what the results mean:

    Check item Command Expected result Common issue
    Default compiler version g++ --version Version matches what the distribution should ship Version is too old and far below the module’s requirement
    Compiler after switching which g++ Path points to a toolset under /opt/rh/ Path still points to /usr/bin/g++
    Node version node --version Matches the version the tool requires Version is too new or too old, causing node-gyp incompatibility
    Module install status npm ls node-pty Shows the correctly installed version Shows missing or invalid
    Build log Check the npm log file No C++ compilation errors Unrecognized compiler flags or missing header files

    4. Startup and Access Configuration

    After installation, the tool usually starts as a web profile that runs a web service on the local machine. The console prints an address such as http://127.0.0.1:3080. Open that address in a browser to reach the graphical interface.

    Two points need attention.

    First, bind the service only to the loopback address 127.0.0.1, not to 0.0.0.0. Binding to all interfaces would make the service reachable from other machines on the same network. If the tool provides a listen address setting, set it explicitly to the local address.

    Second, first-time use requires an API key for the large language model. Never store the key in a code repository, a configuration file, or a log. A