Skip to content

Linking against gcc_s is problematic on windows #456

Closed

Description

@wz1000

When the path doesn't include gcc_s.dll then binaries linked against text will silently fail.

text-2.0 links against gcc_s.dll when simdutf is unset:

text/text.cabal

Lines 196 to 198 in 971051b

-- https://gitlab.haskell.org/ghc/ghc/-/issues/19900
if os(windows) && impl(ghc < 9.3)
extra-libraries: gcc_s

Related GHC ticket: https://gitlab.haskell.org/ghc/ghc/-/issues/21196

CI job that demonstrates the failure: https://github.com/haskell/text/runs/7337239414

Activity

  1. bgamari commented on Jul 15, 2022

    @bgamari
    Contributor

    As noted in the comment, this extra-libraries entry was introduced as a mitigation for GHC #19900, which is fundamentally a GHC runtime linker bug. However, as we see here, the medicine is worse than the disease as now all binaries link against libgcc_s.dll. This is problematic as libgcc_s is a component of msys2, which in general GHC does not depend upon (beyond the msys2 toolchain which is included in the GHC binary distribution for Windows) and won't be in the Windows library/executable search path (PATH) (this is the same issue seen in haskell/bytestring#497).

    Consequently, I think we should remove the extra-libraries entry. This will regress #19900 but we can mitigate it in the short term by ensuring that we do not depend upon operations supplied by libgcc, as is done in #453. Once the linking bug is resolving we can reintroduce use of the builtin.

  2. Bodigrim commented on Jul 19, 2022

    @Bodigrim
    Contributor

    Fixed in #453.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions