Skip to content

Fix ABI detection issues with macOS gcc#3854

Merged
tgamblin merged 1 commit intodevelopfrom
bugfix/apple-clang-abi
Apr 21, 2017
Merged

Fix ABI detection issues with macOS gcc#3854
tgamblin merged 1 commit intodevelopfrom
bugfix/apple-clang-abi

Conversation

@tgamblin
Copy link
Copy Markdown
Member

Fixes #3529.

  • gcc on macOS says it's version 4.2.1, but it's really clang, and it's
    actually the same clang as the system clang.

  • It also doesn't respond with a full path when called with
    --print-file-name=libstdc++.dylib, which is expected from gcc in abi.py.
    Instead, it gives a relative path and _gcc_compiler_compare doesn't
    understand what to do with it. This results in errors like:

    lib/spack/spack/abi.py, line 71, in _gcc_get_libstdcxx_version
        libpath = os.readlink(output.strip())
    OSError: [Errno 2] No such file or directory: 'libstdc++.dylib'
    
  • This commit does two things:

    1. Ignore any gcc that's actually clang in abi.py. We can probably do
      better than this, but it's not clear there is a need to, since we
      should handle the compiler as clang, not gcc.

    2. Don't auto-detect any "gcc" that is actually clang anymore. Ignore
      it and expect people to use clang (which is the default macOS
      compiler anyway).

Note that this means we won't see [email protected] by default on Mac OS X anymore. Only the corresponding clang. I think it was confusing anyway, and users can still add fake gccs to their compilers.yaml if they want, but I think we should discourage it.

- gcc on macOS says it's version 4.2.1, but it's really clang, and it's
  actually the *same* clang as the system clang.

- It also doesn't respond with a full path when called with
  --print-file-name=libstdc++.dylib, which is expected from gcc in abi.py.
  Instead, it gives a relative path and _gcc_compiler_compare doesn't
  understand what to do with it.  This results in errors like:

  ```
  lib/spack/spack/abi.py, line 71, in _gcc_get_libstdcxx_version
      libpath = os.readlink(output.strip())
  OSError: [Errno 2] No such file or directory: 'libstdc++.dylib'
  ```

- This commit does two things:

  1. Ignore any gcc that's actually clang in abi.py.  We can probably do
     better than this, but it's not clear there is a need to, since we
     should handle the compiler as clang, not gcc.

  2. Don't auto-detect any "gcc" that is actually clang anymore.  Ignore
     it and expect people to use clang (which is the default macOS
     compiler anyway).

Users can still add fake gccs to their compilers.yaml if they want, but
it's discouraged.
@tgamblin tgamblin force-pushed the bugfix/apple-clang-abi branch from 9c39810 to 64fa747 Compare April 15, 2017 01:47
@tgamblin
Copy link
Copy Markdown
Member Author

@kielfriedt: FYI

@adamjstewart
Copy link
Copy Markdown
Member

Before

compilers:
- compiler:
    environment: {}
    extra_rpaths: []
    flags: {}
    modules: []
    operating_system: sierra
    paths:
      cc: !!python/unicode '/Library/Developer/CommandLineTools/usr/bin/clang'
      cxx: !!python/unicode '/Library/Developer/CommandLineTools/usr/bin/clang++'
      f77: /usr/local/bin/gfortran
      fc: /usr/local/bin/gfortran
    spec: [email protected]
    target: x86_64
- compiler:
    environment: {}
    extra_rpaths: []
    flags: {}
    modules: []
    operating_system: sierra
    paths:
      cc: /usr/bin/gcc
      cxx: /usr/bin/g++
      f77: null
      fc: null
    spec: [email protected]
    target: x86_64
- compiler:
    environment: {}
    extra_rpaths: []
    flags: {}
    modules: []
    operating_system: sierra
    paths:
      cc: /usr/local/bin/gcc-6
      cxx: /usr/local/bin/g++-6
      f77: /usr/local/bin/gfortran-6
      fc: /usr/local/bin/gfortran-6
    spec: [email protected]
    target: x86_64

After

compilers:
- compiler:
    environment: {}
    extra_rpaths: []
    flags: {}
    modules: []
    operating_system: sierra
    paths:
      cc: !!python/unicode '/Library/Developer/CommandLineTools/usr/bin/clang'
      cxx: !!python/unicode '/Library/Developer/CommandLineTools/usr/bin/clang++'
      f77: /usr/local/bin/gfortran
      fc: /usr/local/bin/gfortran
    spec: [email protected]
    target: x86_64
- compiler:
    environment: {}
    extra_rpaths: []
    flags: {}
    modules: []
    operating_system: sierra
    paths:
      cc: /usr/local/bin/gcc-6
      cxx: /usr/local/bin/g++-6
      f77: /usr/local/bin/gfortran-6
      fc: /usr/local/bin/gfortran-6
    spec: [email protected]
    target: x86_64

I was wondering where that weird %gcc@4 was coming from.

@tgamblin tgamblin merged commit c67f8e4 into develop Apr 21, 2017
@adamjstewart adamjstewart deleted the bugfix/apple-clang-abi branch April 21, 2017 22:54
diaena pushed a commit to diaena/spack that referenced this pull request May 26, 2017
- gcc on macOS says it's version 4.2.1, but it's really clang, and it's
  actually the *same* clang as the system clang.

- It also doesn't respond with a full path when called with
  --print-file-name=libstdc++.dylib, which is expected from gcc in abi.py.
  Instead, it gives a relative path and _gcc_compiler_compare doesn't
  understand what to do with it.  This results in errors like:

  ```
  lib/spack/spack/abi.py, line 71, in _gcc_get_libstdcxx_version
      libpath = os.readlink(output.strip())
  OSError: [Errno 2] No such file or directory: 'libstdc++.dylib'
  ```

- This commit does two things:

  1. Ignore any gcc that's actually clang in abi.py.  We can probably do
     better than this, but it's not clear there is a need to, since we
     should handle the compiler as clang, not gcc.

  2. Don't auto-detect any "gcc" that is actually clang anymore.  Ignore
     it and expect people to use clang (which is the default macOS
     compiler anyway).

Users can still add fake gccs to their compilers.yaml if they want, but
it's discouraged.
xavierandrade pushed a commit to xavierandrade/spack that referenced this pull request Jun 16, 2017
- gcc on macOS says it's version 4.2.1, but it's really clang, and it's
  actually the *same* clang as the system clang.

- It also doesn't respond with a full path when called with
  --print-file-name=libstdc++.dylib, which is expected from gcc in abi.py.
  Instead, it gives a relative path and _gcc_compiler_compare doesn't
  understand what to do with it.  This results in errors like:

  ```
  lib/spack/spack/abi.py, line 71, in _gcc_get_libstdcxx_version
      libpath = os.readlink(output.strip())
  OSError: [Errno 2] No such file or directory: 'libstdc++.dylib'
  ```

- This commit does two things:

  1. Ignore any gcc that's actually clang in abi.py.  We can probably do
     better than this, but it's not clear there is a need to, since we
     should handle the compiler as clang, not gcc.

  2. Don't auto-detect any "gcc" that is actually clang anymore.  Ignore
     it and expect people to use clang (which is the default macOS
     compiler anyway).

Users can still add fake gccs to their compilers.yaml if they want, but
it's discouraged.
EmreAtes pushed a commit to EmreAtes/spack that referenced this pull request Jul 10, 2017
- gcc on macOS says it's version 4.2.1, but it's really clang, and it's
  actually the *same* clang as the system clang.

- It also doesn't respond with a full path when called with
  --print-file-name=libstdc++.dylib, which is expected from gcc in abi.py.
  Instead, it gives a relative path and _gcc_compiler_compare doesn't
  understand what to do with it.  This results in errors like:

  ```
  lib/spack/spack/abi.py, line 71, in _gcc_get_libstdcxx_version
      libpath = os.readlink(output.strip())
  OSError: [Errno 2] No such file or directory: 'libstdc++.dylib'
  ```

- This commit does two things:

  1. Ignore any gcc that's actually clang in abi.py.  We can probably do
     better than this, but it's not clear there is a need to, since we
     should handle the compiler as clang, not gcc.

  2. Don't auto-detect any "gcc" that is actually clang anymore.  Ignore
     it and expect people to use clang (which is the default macOS
     compiler anyway).

Users can still add fake gccs to their compilers.yaml if they want, but
it's discouraged.
amklinv pushed a commit that referenced this pull request Jul 17, 2017
- gcc on macOS says it's version 4.2.1, but it's really clang, and it's
  actually the *same* clang as the system clang.

- It also doesn't respond with a full path when called with
  --print-file-name=libstdc++.dylib, which is expected from gcc in abi.py.
  Instead, it gives a relative path and _gcc_compiler_compare doesn't
  understand what to do with it.  This results in errors like:

  ```
  lib/spack/spack/abi.py, line 71, in _gcc_get_libstdcxx_version
      libpath = os.readlink(output.strip())
  OSError: [Errno 2] No such file or directory: 'libstdc++.dylib'
  ```

- This commit does two things:

  1. Ignore any gcc that's actually clang in abi.py.  We can probably do
     better than this, but it's not clear there is a need to, since we
     should handle the compiler as clang, not gcc.

  2. Don't auto-detect any "gcc" that is actually clang anymore.  Ignore
     it and expect people to use clang (which is the default macOS
     compiler anyway).

Users can still add fake gccs to their compilers.yaml if they want, but
it's discouraged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants