Opened 9 years ago

Last modified 21 months ago

#3122 new feature request

Enhance --info

Reported by: igloo Owned by: duncan
Priority: lowest Milestone:
Component: Compiler Version: 6.10.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

We should:

  • Add things like C compiler, assembler, linker, libdir into the --info output
  • Generalise --print-libdir such that --print-foo prints the foo field from the --info output.

Change History (15)

comment:1 Changed 9 years ago by duncan

We should double-check what Cabal needs to ask ghc and make sure we can get it all in a single call to ghc --info.

Currently Cabal has to guess which ghc-pkg and gcc to use. We have an algorithm for guessing the ghc-pkg given the name of the ghc program. Eg if ghc is called "ghc-6.10.1" then we look for "ghc-pkg-6.10.1". Then we double check by calling ghc-pkg --version and checking the version numbers are the same. That's pretty good, though it doesn't guarantee they share the same global package db. Perhaps this is enough and perhaps asking ghc to know where ghc-pkg is all the time is too annoying.

Strictly speaking we should be using ghc's libexec dir not lib dir for programs like ghc-pkg etc.

It is useful to know which gcc ghc is using, but ghc has potentially different programs for C compiler, assembler and linker. Perhaps we need to know all three. If ghc --info tells us this then it had better work when we do:

ghc --info -pgmc=foobar

and have it tell us that the C compiler is foobar and not gcc. Similarly for the location of the global package db.

Things that should not be in there: location of random other programs like haddock and hsc2hs. They are not intimately tied to ghc, don't pretend that it's a monolithic distribution.

comment:2 Changed 8 years ago by igloo

Owner: changed from igloo to duncan

I've done the --print-foo part of this ticket.

The gcc situation is rather complex. We have

pgm_c :: (String,[Option])
opt_c :: [String]

and we also do this when running gcc:

-- If the -B<dir> option is set, add <dir> to PATH.  This works around
-- a bug in gcc on Windows Vista where it can't find its auxiliary
-- binaries (see bug #1110).
getGccEnv :: [Option] -> IO (Maybe [(String,String)])
getGccEnv opts =
  if null b_dirs
     then return Nothing
     else do env <- getEnvironment
             return (Just (map mangle_path env))
 where
  (b_dirs, _) = partitionWith get_b_opt opts

  get_b_opt (Option ('-':'B':dir)) = Left dir
  get_b_opt other = Right other

  mangle_path (path,paths) | map toUpper path == "PATH"
        = (path, '\"' : head b_dirs ++ "\";" ++ paths)
  mangle_path other = other

Likewise for cpp, as and ld. What exactly does Cabal want to know?

comment:3 Changed 7 years ago by igloo

Milestone: 6.12 branch6.12.3

comment:4 Changed 7 years ago by igloo

Milestone: 6.12.36.14.1
Priority: normallow

comment:5 Changed 7 years ago by igloo

Milestone: 7.0.17.0.2

comment:6 Changed 7 years ago by igloo

Milestone: 7.0.27.2.1

comment:7 Changed 6 years ago by igloo

Type of failure: None/Unknown

We now have more stuff in the --info output:

 ,("C compiler command","/usr/bin/gcc")
 ,("C compiler flags"," -fno-stack-protector")
 ,("ar command","/usr/bin/ar")
 ,("ar flags","q")
 ,("ar supports at file","YES")
 ,("perl command","/usr/bin/perl")

comment:8 Changed 6 years ago by igloo

Milestone: 7.2.17.4.1

comment:9 Changed 6 years ago by igloo

Milestone: 7.4.17.6.1
Priority: lowlowest

comment:10 Changed 5 years ago by igloo

Milestone: 7.6.17.6.2

comment:11 Changed 3 years ago by thoughtpolice

Milestone: 7.6.27.10.1

Moving to 7.10.1.

comment:12 Changed 3 years ago by thoughtpolice

Milestone: 7.10.17.12.1

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:13 Changed 3 years ago by thoughtpolice

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:14 Changed 2 years ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

comment:15 Changed 21 months ago by thomie

Milestone: 8.0.1
Note: See TracTickets for help on using tickets.