Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass C++ environment variables to configure scripts #10797

Open
Ericson2314 opened this issue Feb 20, 2025 · 1 comment · May be fixed by #10844
Open

Pass C++ environment variables to configure scripts #10797

Ericson2314 opened this issue Feb 20, 2025 · 1 comment · May be fixed by #10844

Comments

@Ericson2314
Copy link
Collaborator

Describe the feature request

Since Cabal has some support for C++ (cxx-options, cxx-sources), I think we should also support passing standard C++ toolchain environment variables to the configure script analogously to how we do with C:

overEnv =
("CFLAGS", Just cflagsEnv)
: [("PATH", Just pathEnv) | not (null extraPath)]
++ cabalFlagEnv
maybeHostFlag = if hp == buildPlatform then [] else ["--host=" ++ show (pretty hp)]
args' = configureFile' : args ++ ["CC=" ++ ccProgShort] ++ maybeHostFlag
shProg = simpleProgram "sh"

I think this would be

  • CXX (like CC)
  • CXXFLAGS (like CFLAGS)

Additional context

This came up in https://gitlab.haskell.org/ghc/ghc/-/issues/25767#note_610831

@mpickering
Copy link
Collaborator

I have implemented this, but I'm not sure why we set the CFLAGS environment variable but pass CC as an argument. I just copied this rather than change anything.

mpickering added a commit that referenced this issue Mar 21, 2025
… Configure

Since the compiler since ghc-9.4.8 requires a C++ toolchain, and that is
configured into the compiler --info, it makes sense to pass that
information onto the ./configure script.

The assumption that the C++ compiler is part of the toolchain is only
since ghc-9.4. Therefore, if no C++ compiler is found, then the options
won't be passed to the configure script.

For compilers older than 9.4, the C++ compiler will always be found as
it is configured into the settings file.

See https://gitlab.haskell.org/ghc/ghc/-/issues/25767#note_610831 for
some discussion about how this would be useful to implement
system-cxx-std-lib in userspace.

Fixes #10797
mpickering added a commit that referenced this issue Mar 21, 2025
… Configure

Since the compiler since ghc-9.4.8 requires a C++ toolchain, and that is
configured into the compiler --info, it makes sense to pass that
information onto the ./configure script.

The assumption that the C++ compiler is part of the toolchain is only
since ghc-9.4. Therefore, if no C++ compiler is found, then the options
won't be passed to the configure script.

For compilers older than 9.4, the C++ compiler will always be found as
it is configured into the settings file.

See https://gitlab.haskell.org/ghc/ghc/-/issues/25767#note_610831 for
some discussion about how this would be useful to implement
system-cxx-std-lib in userspace.

Fixes #10797
mpickering added a commit that referenced this issue Mar 21, 2025
… Configure

Since the compiler since ghc-9.4.8 requires a C++ toolchain, and that is
configured into the compiler --info, it makes sense to pass that
information onto the ./configure script.

The assumption that the C++ compiler is part of the toolchain is only
since ghc-9.4. Therefore, if no C++ compiler is found, then the options
won't be passed to the configure script.

For compilers older than 9.4, the C++ compiler will always be found as
it is configured into the settings file.

See https://gitlab.haskell.org/ghc/ghc/-/issues/25767#note_610831 for
some discussion about how this would be useful to implement
system-cxx-std-lib in userspace.

Fixes #10797
mpickering added a commit that referenced this issue Mar 24, 2025
… Configure

Since the compiler since ghc-9.4.8 requires a C++ toolchain, and that is
configured into the compiler --info, it makes sense to pass that
information onto the ./configure script.

The assumption that the C++ compiler is part of the toolchain is only
since ghc-9.4. Therefore, if no C++ compiler is found, then the options
won't be passed to the configure script.

For compilers older than 9.4, the C++ compiler will always be found as
it is configured into the settings file.

See https://gitlab.haskell.org/ghc/ghc/-/issues/25767#note_610831 for
some discussion about how this would be useful to implement
system-cxx-std-lib in userspace.

Fixes #10797
mpickering added a commit that referenced this issue Mar 24, 2025
… Configure

Since the compiler since ghc-9.4.8 requires a C++ toolchain, and that is
configured into the compiler --info, it makes sense to pass that
information onto the ./configure script.

The assumption that the C++ compiler is part of the toolchain is only
since ghc-9.4. Therefore, if no C++ compiler is found, then the options
won't be passed to the configure script.

For compilers older than 9.4, the C++ compiler will always be found as
it is configured into the settings file.

See https://gitlab.haskell.org/ghc/ghc/-/issues/25767#note_610831 for
some discussion about how this would be useful to implement
system-cxx-std-lib in userspace.

Fixes #10797
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants