Skip to content

-package and -idir in OPTIONS_GHC are ignored, but manual says that they're dynamic

If I put a -package flag in OPTIONS_GHC, GHC ignores it. For example:

test.hs:

{-# OPTIONS_GHC -package base #-}
main = putStrLn "hello"
$ ghc --make -hide-all-packages -o test test.hs
[1 of 1] Compiling Main             ( test.hs, test.o )

test.hs:1:0:
    Failed to load interface for `Prelude':
      it is a member of package base, which is hidden

It also ignores -idir:

test.hs

{-# OPTIONS_GHC -itestdir #-}
import Foo
main = putStrLn "hello"

testdir/Foo.hs

module Foo where
$ ghc --make test.hs

test.hs:2:7:
    Could not find module `Foo':
      Use -v to see a list of the files searched for.

The manual says that both -package and -i are dynamic, and that dynamic flags can be set in OPTIONS_GHC.

Trac metadata
Trac field Value
Version 6.6
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information