Search code examples
gcclinuxbrew

Linuxbrew: configure: error: could not find a working compiler


When executing brew install on Ubuntu 16.04.7 LTS (xenial) I am getting the following error which breaks each install:

checking whether to enable maintainer-specific portions of Makefiles... no
checking ABI=64
checking compiler gcc-13  ... no
checking ABI=x32
checking compiler gcc-13  ... no
checking ABI=32
checking compiler gcc-13  ... no
configure: error: could not find a working compiler, see config.log for details

Solution

    1. Create a test file by executing: echo 'int main(){}' > dummy.c
    2. Run gcc-13 dummy.c which will give the error below (please note that gcc dummy.c can work just fine)
    /usr/bin/ld: /home/linuxbrew/.linuxbrew/Cellar/gcc/13.1.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/13/liblto_plugin.so: error loading plugin: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/linuxbrew/.linuxbrew/Cellar/gcc/13.1.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/13/liblto_plugin.so)
    
    1. Run brew link --force binutils
    Linking /home/linuxbrew/.linuxbrew/Cellar/binutils/2.40.reinstall... 86 symlinks created.
    
    If you need to have this software first in your PATH instead consider running:
      echo 'export PATH="/home/linuxbrew/.linuxbrew/opt/binutils/bin:$PATH"' >> ~/.profile
    
    1. Then as recommended run:
    echo 'export PATH="/home/linuxbrew/.linuxbrew/opt/binutils/bin:$PATH"' >> ~/.profile
    
    1. You can now optionally check your PATH by running: echo $PATH
    2. Run brew config
    HOMEBREW_VERSION: 4.0.28
    ORIGIN: https://github.com/Homebrew/brew
    HEAD: 2b4cfb033757b63ab0b128d01c58db76480956f9
    Last commit: 7 days ago
    Core tap JSON: 13 Jul 21:39 UTC
    HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
    HOMEBREW_CASK_OPTS: []
    HOMEBREW_GITHUB_API_TOKEN: set
    HOMEBREW_MAKE_JOBS: 1
    Homebrew Ruby: 2.6.10 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.10_1/bin/ruby
    CPU: single-core 64-bit haswell
    Clang: N/A
    Git: 2.7.4 => /usr/bin/git
    Curl: 7.47.0 => /usr/bin/curl
    Kernel: Linux 4.4.0-1160.80.1.vz7.191.4 x86_64 GNU/Linux
    OS: Ubuntu 16.04.7 LTS (xenial)
    Host glibc: 2.23
    /usr/bin/gcc: 5.4.0
    /usr/bin/ruby: 2.3.1
    glibc: N/A
    gcc@11: N/A
    gcc: N/A
    xorg: N/A
    
    1. Now gcc-13 dummy.c should give no error
    2. And now the brew install should work without any error as well