[GHC] #910: --make should have a -j flag for parallel building

GHC ghc-devs at haskell.org
Mon Oct 26 15:40:06 UTC 2015


#910: --make should have a -j flag for parallel building
-------------------------------------+-------------------------------------
        Reporter:  igloo             |                Owner:
            Type:  feature request   |               Status:  closed
        Priority:  normal            |            Milestone:  ⊥
       Component:  Compiler          |              Version:  6.4.2
      Resolution:  fixed             |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:  N/A
      Blocked By:  8184, 8235        |             Blocking:
 Related Tickets:  #9221             |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 Wearing my GHC developer's hat: I don't like environment flags controlling
 the compiler's behavior, since they make it harder to reproduce or
 identify issues. It's very helpful if I can tell the user to run `cabal
 build -v` and extract the ghc command line and know that everything that
 affects ghc's operation is specified on that command line or in the input
 files. Implicit global state is bad, right?

 Of course, in reality there is already implicit global state (versions of
 installed packages, versions of C compiler/CPP/LLVM/etc.), but the less
 the better. Compare for example [https://gcc.gnu.org/onlinedocs/gcc
 /Environment-Variables.html Environment Variables Affecting GCC], which
 roughly amounts to LANG, TMPDIR and where to look for headers and
 libraries.

 In principle `-jN` should not affect ghc's behavior, and then I would not
 really be against adding an environment variable for it, but in practice
 it does: see #9370, which I think is still unfixed, not to mention the
 possibility of bugs in `-jN` itself.

 Wearing my GHC user's hat: I don't really see the need for an environment
 variable here. Doesn't the `stack build --ghc-options="-j4"` that nh2
 mentioned solve your immediate problem? And using this environment
 variable doesn't strike me as the Right Solution to any problem: if you
 are invoking ghc directly then you don't need the environment variable,
 while if you are invoking it from a larger build system then ideally you
 would make the build system aware of the amount of parallelism ghc is
 using, and at that point you might as well make the build system aware of
 the `-jN` flag as well.

 In summary, I don't think there is a good case for adding such an
 environment variable.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/910#comment:66>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list