forked from ghc/ghc
-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
The RTS provides ghcversion.h which contains:
#if !defined(__GHCVERSION_H__)
#define __GHCVERSION_H__
#define __GLASGOW_HASKELL__ 913
#define __GLASGOW_HASKELL_FULL_VERSION__ "9.13"
#define __GLASGOW_HASKELL_PATCHLEVEL1__ 0
#define __GLASGOW_HASKELL_PATCHLEVEL2__ 0
#define MIN_VERSION_GLASGOW_HASKELL(ma,mi,pl1,pl2) ( \
((ma)*100+(mi)) < __GLASGOW_HASKELL__ || \
((ma)*100+(mi)) == __GLASGOW_HASKELL__ \
&& (pl1) < __GLASGOW_HASKELL_PATCHLEVEL1__ || \
((ma)*100+(mi)) == __GLASGOW_HASKELL__ \
&& (pl1) == __GLASGOW_HASKELL_PATCHLEVEL1__ \
&& (pl2) <= __GLASGOW_HASKELL_PATCHLEVEL2__ )
#endif /* __GHCVERSION_H__ */
(adapted for the GHC version of course)
The issue is: if we try to use GHC without having a rts in the package db, then it fails to find this file and crashes.
We can force GHC to use another ghcversion.h
file by using -ghcversion-file=foobar/ghcversion.h
.
However cabal uses GHC to build a dumb C file in configureLd
to test if ld -x
works. But it doesn't pass -ghcversion-file
and if the package db is empty it crashes.
Solutions:
- don't crash, even if no
ghcversion.h
file is found, just display a warning. In https://gitlab.haskell.org/ghc/ghc/-/commit/12a7444463184e9eddbe7b7251a0ee1e976f4d75 @angerman wrote that it is unlikely that someone would use GHC to build a C file like this, but here we are. - allow GHC to generate this header file on the fly! The compiler knows its own version. Why is it in the RTS to begin with?
Metadata
Metadata
Assignees
Labels
No labels