forked from ghc/ghc
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
system-cxx-std-lib
is a virtual cabal package used to indicate that a package wants to link with C++ stdlibs.
It is virtual because GHC's build system generates directly the following package configuration for it (see mk/system-cxx-std-lib-1.0.conf.in
):
name: system-cxx-std-lib
version: 1.0
visibility: public
id: system-cxx-std-lib-1.0
key: system-cxx-std-lib-1.0
license: BSD-3-Clause
synopsis: A placeholder for the system's C++ standard library implementation.
description: Building against C++ libraries requires that the C++ standard
library be included when linking. Typically when compiling a C++
project this is done automatically by the C++ compiler. However,
as GHC uses the C compiler for linking, users needing the C++
standard library must declare this dependency explicitly.
.
This "virtual" package can be used to depend upon the host system's
C++ standard library implementation in a platform agnostic manner.
category: System
abi: 00000000000000000000000000000000
exposed: True
exposed-modules:
extra-libraries: @CXX_STD_LIB_LIBS@
library-dirs: @CXX_STD_LIB_LIB_DIRS@
dynamic-library-dirs: @CXX_STD_LIB_DYN_LIB_DIRS@
Issues
- we use a C compiler to link C++ code: it is brittle
- the configuration is statically determined at GHC build time (or maybe at GHC installation time too?):
- the package db with this system-cxx-std-lib package isn't portable (e.g. from a platform with Clang++ to a platform with g++)
- if the host C++ toolchain is updated it will likely break
How we could fix it
- we need to have this package otherwise
cabal-install
will complain that it is missing when some package depends on it - but we could keep this package empty (no extra-libraries field, etc.)
- GHC could detect the C++ configuration at link time and inject it into the package configuration when it loads it
- if we do this lazily, it should only be used when linking C++ code, which is already slow so it won't be noticeable
- alternatively we could switch to using the C++ compiler to link when
system-cxx-std-lib
is in the dependencies
Metadata
Metadata
Assignees
Labels
No labels