[Git][ghc/ghc][master] Only lookup ghcversion.h file in the RTS include-dirs by default.
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Thu Aug 1 04:50:57 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
f954f428 by Sylvain Henry at 2024-08-01T00:49:59-04:00
Only lookup ghcversion.h file in the RTS include-dirs by default.
The code was introduced in 3549c952b535803270872adaf87262f2df0295a4.
It used `getPackageIncludePath` which name doesn't convey that it looks
into all include paths of the preload units too. So this behavior is
probably unintentional and it should be ok to change it.
Fix #25106
- - - - -
1 changed file:
- compiler/GHC/SysTools/Cpp.hs
Changes:
=====================================
compiler/GHC/SysTools/Cpp.hs
=====================================
@@ -263,11 +263,17 @@ generateMacros prefix name version =
-- | Find out path to @ghcversion.h@ file
getGhcVersionPathName :: DynFlags -> UnitEnv -> IO FilePath
getGhcVersionPathName dflags unit_env = do
- candidates <- case ghcVersionFile dflags of
- Just path -> return [path]
- Nothing -> do
- ps <- mayThrowUnitErr (preloadUnitsInfo' unit_env [rtsUnitId])
- return ((</> "ghcversion.h") <$> collectIncludeDirs ps)
+ let candidates = case ghcVersionFile dflags of
+ -- the user has provided an explicit `ghcversion.h` file to use.
+ Just path -> [path]
+ -- otherwise, try to find it in the rts' include-dirs.
+ -- Note: only in the RTS include-dirs! not all preload units less we may
+ -- use a wrong file. See #25106 where a globally installed
+ -- /usr/include/ghcversion.h file was used instead of the one provided
+ -- by the rts.
+ Nothing -> case lookupUnitId (ue_units unit_env) rtsUnitId of
+ Nothing -> []
+ Just info -> (</> "ghcversion.h") <$> collectIncludeDirs [info]
found <- filterM doesFileExist candidates
case found of
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f954f42823f6ca3588425a0d543d93ace86d89e4
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f954f42823f6ca3588425a0d543d93ace86d89e4
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240801/3a2cd5ce/attachment-0001.html>
More information about the ghc-commits
mailing list