Skip to content

Adding an explicit pgmcxx flag for interaction with GHC#11763

Open
zlonast wants to merge 1 commit into
haskell:masterfrom
zlonast:zlonast/pgmcxx-option
Open

Adding an explicit pgmcxx flag for interaction with GHC#11763
zlonast wants to merge 1 commit into
haskell:masterfrom
zlonast:zlonast/pgmcxx-option

Conversation

@zlonast
Copy link
Copy Markdown
Collaborator

@zlonast zlonast commented Apr 24, 2026

Add an explicit pgmcxx flag to Cabal's GHC invocation logic. This aligns
with the existing pgmc behavior and accounts for the GHC 9.4+ toolchain
requirements, resolving inconsistencies in how C++ compiler options are handled.

This change allows users to remove extra-libraries: stdc++ from their
configuration files, as g++ automatically handles C++ standard library
linking, unlike the legacy approach of invoking C++ via gcc.

Main idea #9801 (comment)

IMHO, cc-options (and ld-options and cpp-options and ...) should be always passed when invoking GHC, similarly as ghc-options should be always used when invoking ghc - regardless of what is the intention of a particular GHC-call. GHC might use or not use the options, Cabal cannot know and should not guess.

Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

@zlonast zlonast force-pushed the zlonast/pgmcxx-option branch 2 times, most recently from 8fc0a6f to 92d0cb0 Compare April 24, 2026 13:33
@zlonast zlonast force-pushed the zlonast/pgmcxx-option branch from 92d0cb0 to 124be87 Compare May 9, 2026 10:41
@zlonast
Copy link
Copy Markdown
Collaborator Author

zlonast commented May 9, 2026

This pr is a logical continuation of this #11713

@zlonast zlonast force-pushed the zlonast/pgmcxx-option branch from 124be87 to 729c3d7 Compare May 17, 2026 08:15
@zlonast zlonast marked this pull request as ready for review May 17, 2026 08:15
@zlonast zlonast requested review from ffaf1 and sheaf May 17, 2026 08:16
@zlonast zlonast added attention: needs-review re: ghc-options Concerning passing options to GHC re: ghc 9.4 Concerning GHC 9.4 cabal-install: v2-build system Affecting v2-build and related commands that use v2-architecture (aka "nix local builds"). labels May 17, 2026
@zlonast zlonast force-pushed the zlonast/pgmcxx-option branch from 729c3d7 to 62cd6cb Compare May 24, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

attention: needs-review cabal-install: v2-build system Affecting v2-build and related commands that use v2-architecture (aka "nix local builds"). re: ghc 9.4 Concerning GHC 9.4 re: ghc-options Concerning passing options to GHC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatically set --pgmcxx for C++ sources when a C++ compiler is available

1 participant