Skip to content

Compiler: migrate platform support filter to new compiler packages#48818

Draft
johnwparent wants to merge 4 commits intospack:developfrom
johnwparent:compilers/add-platform-support-filter
Draft

Compiler: migrate platform support filter to new compiler packages#48818
johnwparent wants to merge 4 commits intospack:developfrom
johnwparent:compilers/add-platform-support-filter

Conversation

@johnwparent
Copy link
Copy Markdown
Contributor

Previous iterations of compiler detection filtered the compilers by supported platform. Spack recently migrated compiler detection but neglected to migrate this filtering as well.
This filtering was required to resolve bugs on Windows and Linux where detection attempts for compilers that were incompatible with the given host platform caused Spack to hang or crash.

Current mechanism to determine platform support for a compiler is a bit cludgey at the moment, will likely refactor before a final merge.

Resolves #39622 again.

@spackbot-app spackbot-app bot added build-systems compilers core PR affects Spack core functionality update-package labels Feb 1, 2025
@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Feb 1, 2025

Hi @johnwparent! I noticed that the following package(s) don't yet have maintainers:

  • msvc

Are you interested in adopting any of these package(s)? If so, simply add the following to the package class:

    maintainers("johnwparent")

If not, could you contact the developers of this package and see if they are interested? You can quickly see who has worked on a package with spack blame:

$ spack blame msvc

Thank you for your help! Please don't add maintainers without their consent.

You don't have to be a Spack expert or package developer in order to be a "maintainer," it just gives us a list of users willing to review PRs or debug issues relating to this package. A package can have multiple maintainers; just add a list of GitHub handles of anyone who wants to volunteer.

@spackbot-app spackbot-app bot requested review from alalazo and michaelkuhn February 1, 2025 01:15
@johnwparent
Copy link
Copy Markdown
Contributor Author

@alalazo let me know if there's a better way I can integrate this with the new compiler construction. I looked through the compilers as nodes PR and didn't see any obvious conflicts, but it's a large PR and I didn't spend too long looking.

Also if you have an idea better than the lambdas (I really don't like the lambda approach) I'm all ears.

@johnwparent
Copy link
Copy Markdown
Contributor Author

@spackbot fix style

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Feb 1, 2025

Let me see if I can fix that for you!

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Feb 1, 2025

I was able to run spack style --fix for you!

spack style --fix
==> Running style checks on spack
  selected: import, isort, black, flake8, mypy
==> Modified files
  lib/spack/spack/build_systems/compiler.py
  lib/spack/spack/compilers/__init__.py
  var/spack/repos/builtin/packages/apple-clang/package.py
  var/spack/repos/builtin/packages/gcc/package.py
  var/spack/repos/builtin/packages/msvc/package.py
==> Running import checks
import check requires Python 3.9 or later
  import checks were clean
==> Running isort checks
Fixing /tmp/tmp4nqr0w0q/spack/var/spack/repos/builtin/packages/apple-clang/package.py
Fixing /tmp/tmp4nqr0w0q/spack/var/spack/repos/builtin/packages/msvc/package.py
  isort checks were clean
==> Running black checks
reformatted var/spack/repos/builtin/packages/msvc/package.py
reformatted lib/spack/spack/compilers/__init__.py
All done! ✨ 🍰 ✨
2 files reformatted, 3 files left unchanged.
  black checks were clean
==> Running flake8 checks
  flake8 checks were clean
==> Running mypy checks
lib/spack/spack/version/version_types.py:134: error: Incompatible types in assignment (expression has type "Tuple[Any, ...]", variable has type "Tuple[str]")  [assignment]
lib/spack/spack/variant.py:130: error: Unsupported right operand type for in ("Union[Collection[Any], Callable[..., Any]]")  [operator]
lib/spack/spack/build_environment.py:171: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
lib/spack/spack/build_environment.py:171: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
Found 4 errors in 3 files (checked 636 source files)
  mypy found errors
Keep in mind that I cannot fix your flake8 or mypy errors, so if you have any you'll need to fix them and update the pull request. If I was able to push to your branch, if you make further changes you will need to pull from your updated branch before pushing again.

I've updated the branch with style fixes.

@johnwparent johnwparent changed the title Compiler: migrate platform support filter to new compiler packages WIP: Compiler: migrate platform support filter to new compiler packages Feb 6, 2025
@johnwparent johnwparent marked this pull request as draft February 6, 2025 17:43
@spackbot-app spackbot-app bot added architecture tests General test capability(ies) labels Feb 6, 2025
@johnwparent
Copy link
Copy Markdown
Contributor Author

@spackbot fix style

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Feb 12, 2025

Let me see if I can fix that for you!

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Feb 12, 2025

I was able to run spack style --fix for you!

spack style --fix
==> Running style checks on spack
  selected: import, isort, black, flake8, mypy
==> Modified files
  lib/spack/spack/build_systems/compiler.py
  lib/spack/spack/compilers/__init__.py
  lib/spack/spack/platforms/_functions.py
  lib/spack/spack/test/compilers/basics.py
  lib/spack/spack/test/conftest.py
  var/spack/repos/builtin/packages/apple-clang/package.py
  var/spack/repos/builtin/packages/gcc/package.py
  var/spack/repos/builtin/packages/msvc/package.py
==> Running import checks
import check requires Python 3.9 or later
  import checks were clean
==> Running isort checks
  isort checks were clean
==> Running black checks
reformatted lib/spack/spack/test/compilers/basics.py
All done! ✨ 🍰 ✨
1 file reformatted, 7 files left unchanged.
  black checks were clean
==> Running flake8 checks
  flake8 checks were clean
==> Running mypy checks
lib/spack/spack/version/version_types.py:134: error: Incompatible types in assignment (expression has type "Tuple[Any, ...]", variable has type "Tuple[str]")  [assignment]
lib/spack/spack/platforms/_functions.py:22: error: "type" has no attribute "priority"  [attr-defined]
lib/spack/spack/platforms/_functions.py:23: error: "type" has no attribute "detect"  [attr-defined]
lib/spack/spack/variant.py:130: error: Unsupported right operand type for in ("Union[Collection[Any], Callable[..., Any]]")  [operator]
lib/spack/spack/compilers/__init__.py:349: error: "Type[PackageBase]" has no attribute "is_supported_on_platform"  [attr-defined]
lib/spack/spack/build_environment.py:171: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
lib/spack/spack/build_environment.py:171: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
Found 7 errors in 5 files (checked 636 source files)
  mypy found errors
Keep in mind that I cannot fix your flake8 or mypy errors, so if you have any you'll need to fix them and update the pull request. If I was able to push to your branch, if you make further changes you will need to pull from your updated branch before pushing again.

I've updated the branch with style fixes.

@johnwparent johnwparent force-pushed the compilers/add-platform-support-filter branch from c8b8066 to 5c05e4d Compare June 3, 2025 23:20
@johnwparent
Copy link
Copy Markdown
Contributor Author

@spackbot fix style

@johnwparent johnwparent marked this pull request as ready for review June 5, 2025 17:00
@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Jun 5, 2025

Let me see if I can fix that for you!

@johnwparent johnwparent changed the title WIP: Compiler: migrate platform support filter to new compiler packages Compiler: migrate platform support filter to new compiler packages Jun 5, 2025
@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Jun 5, 2025

I was able to run spack style --fix for you!

spack style --fix
==> Running style checks on spack
  selected: import, isort, black, flake8, mypy
==> Modified files
  lib/spack/spack/compilers/config.py
  lib/spack/spack/platforms/__init__.py
  lib/spack/spack/platforms/_platform.py
  lib/spack/spack/platforms/darwin.py
  lib/spack/spack/platforms/freebsd.py
  lib/spack/spack/platforms/linux.py
  lib/spack/spack/platforms/windows.py
  var/spack/repos/spack_repo/builtin/build_systems/compiler.py
  var/spack/repos/spack_repo/builtin/packages/apple_clang/package.py
  var/spack/repos/spack_repo/builtin/packages/msvc/package.py
==> Running import checks
  import checks were clean
==> Running isort checks
Fixing /tmp/tmpvms9gh3c/spack/lib/spack/spack/platforms/_platform.py
  isort checks were clean
==> Running black checks
reformatted lib/spack/spack/platforms/linux.py
reformatted lib/spack/spack/platforms/windows.py
reformatted var/spack/repos/spack_repo/builtin/packages/apple_clang/package.py
reformatted lib/spack/spack/compilers/config.py
All done! ✨ 🍰 ✨
4 files reformatted, 6 files left unchanged.
  black checks were clean
==> Running flake8 checks
  flake8 checks were clean
==> Running mypy checks
Success: no issues found in 612 source files
  mypy checks were clean
==> spack style checks were clean
Keep in mind that I cannot fix your flake8 or mypy errors, so if you have any you'll need to fix them and update the pull request. If I was able to push to your branch, if you make further changes you will need to pull from your updated branch before pushing again.

I've updated the branch with style fixes.

@johnwparent johnwparent marked this pull request as draft August 25, 2025 13:04
@johnwparent johnwparent force-pushed the compilers/add-platform-support-filter branch from ce0812f to 83d470c Compare September 18, 2025 16:46
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had any activity in the last 6 months. It will be closed in 30 days if there is no further activity.

If the pull request is waiting for a reply from reviewers, feel free to ping them as a reminder. If it is waiting and has no assigned reviewer, feel free to ping @spack/spack-releasers or simply leave a comment saying this should not be marked stale. This will reset the pull request's stale state.

To get more eyes on your pull request, you can post a link in the #pull-requests channel of the Spack Slack.
Thank you for your contributions!

@github-actions github-actions bot added the stale label Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

architecture build-systems compilers core PR affects Spack core functionality stale tests General test capability(ies) update-package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The spack command runs my common lisp REPL wrapper for some reason and then hangs.

1 participant