Skip to content
Snippets Groups Projects
Commit 0167e472 authored by Matthew Pickering's avatar Matthew Pickering Committed by Marge Bot
Browse files

hadrian: Make sure ffi headers are built before using a compiler


When we are using ffi adjustors then we rely on `ffi.h` and
`ffitarget.h` files during code generation when compiling stubs.

Therefore we need to add this dependency to the build system (which this
patch does).

Reproducer, configure with `--enable-libffi-adjustors` and then build
"_build/stage1/libraries/ghc-prim/build/GHC/Types.p_o".

Observe that this fails before this patch and works afterwards.

Fixes #24864

Co-authored-by: default avatarSylvain Henry <sylvain@haskus.fr>
parent cfbff65a
No related branches found
No related tags found
No related merge requests found
......@@ -237,16 +237,25 @@ instance H.Builder Builder where
-- changes (#18001).
_bootGhcVersion <- setting GhcVersion
pure []
Ghc {} -> do
Ghc _ st -> do
root <- buildRoot
unlitPath <- builderPath Unlit
distro_mingw <- settingsFileSetting ToolchainSetting_DistroMinGW
libffi_adjustors <- useLibffiForAdjustors
use_system_ffi <- flag UseSystemFfi
return $ [ unlitPath ]
++ [ root -/- mingwStamp | windowsHost, distro_mingw == "NO" ]
-- proxy for the entire mingw toolchain that
-- we have in inplace/mingw initially, and then at
-- root -/- mingw.
-- ffi.h needed by the compiler when using libffi_adjustors (#24864)
-- It would be nicer to not duplicate this logic between here
-- and needRtsLibffiTargets and libffiHeaderFiles but this doesn't change
-- very often.
++ [ root -/- buildDir (rtsContext st) -/- "include" -/- header
| header <- ["ffi.h", "ffitarget.h"]
, libffi_adjustors && not use_system_ffi ]
Hsc2Hs stage -> (\p -> [p]) <$> templateHscPath stage
Make dir -> return [dir -/- "Makefile"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment