Skip to content

Support semaphore-compat 2.0.0 #6934

Open

Description

@sternenseemann

Related resources:


Stack no longer compiles with semaphore-compat 2.0.0 (GHC 9.12.5-rc2):

[155 of 217] Compiling Stack.Build.ExecuteEnv ( src/Stack/Build/ExecuteEnv.hs, dist/build/Stack/Build/ExecuteEnv.o, dist/build/Stack/Build/ExecuteEnv.dyn_o )
src/Stack/Build/ExecuteEnv.hs:122:22: error: [GHC-61689]
    Module ‘System.Semaphore’ does not export ‘Semaphore’.
    |
122 |                    ( Semaphore, destroySemaphore, freshSemaphore )
    |                      ^^^^^^^^^

src/Stack/Build/ExecuteEnv.hs:122:33: error: [GHC-61689]
    Module ‘System.Semaphore’ does not export ‘destroySemaphore’.
    |
122 |                    ( Semaphore, destroySemaphore, freshSemaphore )
    |                                 ^^^^^^^^^^^^^^^^

Activity

  1. mpilgrem commented on Jun 23, 2026

    @mpilgrem
    Member

    @sternenseemann, that is correct. That is because Stack is built against GHC 9.10.3 and its boot package is semaphore-compat-1.0.0. That is also true of all released versions of GHC that have a dependency on semaphore-compat.

    As you may know (see: https://docs.haskellstack.org/en/stable/commands/build_command/#-no-semaphore-flag), semaphore may appear broken on non-musl Linux distributions. The 'solution', I believe, is to build the Stack tool from source. That is relatively straightforward to do:

    $ stack upgrade --source-only --git-branch v3.11.1
    

    (--git-branch accepts version tags as well as branch names. A wrinkle, I have discovered is that you can only build a more recent version of Stack than the currently one on your PATH. So, you may have to first downgrade Stack to build Stack.)

    Depending on what dependencies have been built in the past, that process may take between about 3 and 20 mins.

    EDIT: I see from the NixOS project that a minor version bump of GHC 9.12 may depend on semaphore-2.0.0. So, I am assuming that backwards compatibility has been considered. If that is the case, I think the sequence of events will be this:

    • The GHC project will release versions of GHC that depend on semaphore-compat >= 2.0.0; and
    • in due course, the Stackage project will adopt one of those GHC versions as a basis for a Stackage Haskell LTS snapshot; and
    • Stack will seek to build against one of those Stackage-blessed GHC versions.
  2. self-assigned this
    on Jun 23, 2026
  3. changed the title [-]Support semaphore-compat 2.0.0 / new semaphore protocol[/-] [+]Support semaphore-compat 2.0.0[/+] on Jun 24, 2026
  4. mpilgrem commented on Jun 24, 2026

    @mpilgrem
    Member

    @sternenseemann, having discussed things in the GHC room on matrix and elsewhere, my current plan is this:

    • the GHC project will release a GHC version that has semaphore-compat-2.0.0 as a boot package (likely GHC 9.12.5 and then GHC 9.10.4 - although perhaps the order may be switched);
    • I can imagine that the Stackage project will adopt that version as its LTS pretty quickly; and
    • Stack will then move to build its 'official' binaries against that GHC version and, at that point, will drop its 'experimental' support for semaphore on versions of GHC that support semaphore version 1.

    If the Stackage project adopts such a GHC version as a Nightly, I will then start the process of getting Stack ready for semaphore-compat-2.0.0. I think that will be straightfoward except, perhaps, in having an intelligent Stack error message if semaphore is specified but the specified version of GHC does not support semaphore version 2.

  5. added 12 commits that reference this issue on Jun 25, 2026
  6. mpilgrem commented on Jun 26, 2026

    @mpilgrem
    Member

    @sternenseemann, I now have a draft pull request that builds Stack with GHC 9.12.5-rc2 and supports semaphore-compat-2.0.0:

  7. added 8 commits that reference this issue on Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions