Skip to content

Commit

Permalink
clarify "configure" messages from Cabal
Browse files Browse the repository at this point in the history
  • Loading branch information
geekosaur committed Nov 24, 2023
1 parent 21b858f commit 0ce467a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 31 deletions.
12 changes: 6 additions & 6 deletions Cabal/src/Distribution/Simple/Configure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,20 @@ data ConfigStateFileError
dispConfigStateFileError :: ConfigStateFileError -> Doc
dispConfigStateFileError ConfigStateFileNoHeader =
text "Saved package config file header is missing."
<+> text "Re-run the 'configure' command."
<+> text "Re-run the 'Setup configure' command."
dispConfigStateFileError ConfigStateFileBadHeader =
text "Saved package config file header is corrupt."
<+> text "Re-run the 'configure' command."
<+> text "Re-run the 'Setup configure' command."
dispConfigStateFileError ConfigStateFileNoParse =
text "Saved package config file is corrupt."
<+> text "Re-run the 'configure' command."
<+> text "Re-run the 'Setup configure' command."
dispConfigStateFileError ConfigStateFileMissing =
text "Run the 'configure' command first."
text "Run the 'Setup configure' command first."
dispConfigStateFileError (ConfigStateFileBadVersion oldCabal oldCompiler _) =
text "Saved package config file is outdated:"
$+$ badCabal
$+$ badCompiler
$+$ text "Re-run the 'configure' command."
$+$ text "Re-run the 'Setup configure' command."
where
badCabal =
text "• the Cabal version changed from"
Expand Down Expand Up @@ -953,7 +953,7 @@ configure (pkg_descr0, pbi) cfg = do
++ prefix dirs
++ " will not work if you rely on the Path_* module "
++ " or other hard coded paths. Cabal does not yet "
++ " support fully relocatable builds! "
++ " support fully relocatable builds! "
++ " See #462 #2302 #2994 #3305 #3473 #3586 #3909"
++ " #4097 #4291 #4872"

Expand Down
49 changes: 24 additions & 25 deletions Cabal/src/Distribution/Simple/Errors.hs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ versionRequirement range
exceptionMessage :: CabalException -> String
exceptionMessage e = case e of
NoBenchMarkProgram cmd -> "Could not find benchmark program \"" ++ cmd ++ "\". Did you build the package first?"
EnableBenchMark -> "No benchmarks enabled. Did you remember to configure with " ++ "\'--enable-benchmarks\'?"
EnableBenchMark -> "No benchmarks enabled. Did you remember to \'Setup configure\' with " ++ "\'--enable-benchmarks\'?"
BenchMarkNameDisabled bmName -> "Package configured with benchmark " ++ bmName ++ " disabled."
NoBenchMark bmName -> "no such benchmark: " ++ bmName
NoLibraryFound -> "No executables and no library found. Nothing to do."
Expand All @@ -327,8 +327,8 @@ exceptionMessage e = case e of
++ ".\n"
++ "If the module "
++ "is autogenerated it should be added to 'autogen-modules'."
RegMultipleInstancePkg -> "HcPkg.register: the compiler does not support,registering multiple instances of packages."
SuppressingChecksOnFile -> "HcPkg.register: the compiler does not support ,suppressing checks on files."
RegMultipleInstancePkg -> "HcPkg.register: the compiler does not support registering multiple instances of packages."
SuppressingChecksOnFile -> "HcPkg.register: the compiler does not support suppressing checks on files."
NoSupportDirStylePackageDb -> "HcPkg.writeRegistrationFileDirectly: compiler does not support dir style package dbs"
OnlySupportSpecificPackageDb -> "HcPkg.writeRegistrationFileDirectly: only supports SpecificPackageDB for now"
FailedToParseOutputDescribe programId pkgId -> "failed to parse output of '" ++ programId ++ " describe " ++ prettyShow pkgId ++ "'"
Expand All @@ -349,7 +349,7 @@ exceptionMessage e = case e of
++ " but "
++ "haddock is using GHC version "
++ prettyShow haddockGhcVersion
MustHaveSharedLibraries -> "Must have vanilla or shared libraries " ++ "enabled in order to run haddock"
MustHaveSharedLibraries -> "Must have vanilla or shared libraries enabled in order to run haddock"
HaddockPackageFlags inf ->
"internal error when calculating transitive "
++ "package dependencies.\nDebug info: "
Expand Down Expand Up @@ -387,7 +387,7 @@ exceptionMessage e = case e of
GlobalPackageDBLimitation ->
"With current ghc versions the global package db is always used "
++ "and must be listed first. This ghc limitation may be lifted in "
++ "future, see https://gitlab.haskell.org/ghc/ghc/-/issues/5977"
++ "the future, see https://gitlab.haskell.org/ghc/ghc/-/issues/5977"
GlobalPackageDBSpecifiedFirst ->
"If the global package db is specified, it must be "
++ "specified first and cannot be specified multiple times"
Expand Down Expand Up @@ -483,8 +483,7 @@ exceptionMessage e = case e of
++ "suite type "
++ prettyShow tt
NoSupportForPreProcessingBenchmark tt ->
"No support for preprocessing benchmark "
++ "type "
"No support for preprocessing benchmark type "
++ prettyShow tt
CantFindSourceForPreProcessFile errorStr -> errorStr
NoSupportPreProcessingTestExtras tt ->
Expand All @@ -507,11 +506,11 @@ exceptionMessage e = case e of
SanityCheckHookedBuildInfo exe1 ->
"The buildinfo contains info for an executable called '"
++ prettyShow exe1
++ "' but the package does not have a "
++ "' but the package does not have an "
++ "executable with that name."
ConfigureScriptNotFound -> "configure script not found."
NoValidComponent -> "No valid component targets found"
ConfigureEitherSingleOrAll -> "Can only configure either single component or all of them"
ConfigureEitherSingleOrAll -> "Can only configure either a single component or all of them"
ConfigCIDValidForPreComponent -> "--cid is only supported for per-component configure"
SanityCheckForEnableComponents ->
"--enable-tests/--enable-benchmarks are incompatible with"
Expand All @@ -521,23 +520,23 @@ exceptionMessage e = case e of
++ " are incompatible with each other."
UnsupportedLanguages pkgId compilerId langs ->
"The package "
++ prettyShow (pkgId)
++ prettyShow pkgId
++ " requires the following languages which are not "
++ "supported by "
++ prettyShow (compilerId)
++ prettyShow compilerId
++ ": "
++ intercalate ", " langs
UnsupportedLanguageExtension pkgId compilerId exts ->
"The package "
++ prettyShow (pkgId)
++ prettyShow pkgId
++ " requires the following language extensions which are not "
++ "supported by "
++ prettyShow (compilerId)
++ prettyShow compilerId
++ ": "
++ intercalate ", " exts
CantFindForeignLibraries unsupportedFLibs ->
"Cannot build some foreign libraries: "
++ intercalate "," unsupportedFLibs
++ intercalate ", " unsupportedFLibs
ExpectedAbsoluteDirectory fPath -> "expected an absolute directory name for --prefix: " ++ fPath
FlagsNotSpecified diffFlags ->
"'--exact-configuration' was given, "
Expand Down Expand Up @@ -568,7 +567,7 @@ exceptionMessage e = case e of
++ "' refers to a library which is defined within the same "
++ "package. To use this feature the package must specify at "
++ "least 'cabal-version: >= 1.8'."
ReportFailedDependencies failed hackageUrl -> (intercalate "\n\n" (map reportFailedDependency failed))
ReportFailedDependencies failed hackageUrl -> intercalate "\n\n" (map reportFailedDependency failed)
where
reportFailedDependency (DependencyNotExists pkgname) =
"there is no version of "
Expand Down Expand Up @@ -613,7 +612,7 @@ exceptionMessage e = case e of
NoWorkingGcc ->
unlines
[ "No working gcc"
, "This package depends on foreign library but we cannot "
, "This package depends on a foreign library but we cannot "
++ "find a working C compiler. If you have it in a "
++ "non-standard location you can use the --with-gcc "
++ "flag to specify it."
Expand Down Expand Up @@ -669,8 +668,8 @@ exceptionMessage e = case e of
++ "where it is."
++ "If the library file does exist, it may contain errors that "
++ "are caught by the C compiler at the preprocessing stage. "
++ "In this case you can re-run configure with the verbosity "
++ "flag -v3 to see the error messages."
++ "In this case you can re-run 'Setup configure' with the "
++ "verbosity flag -v3 to see the error messages."
messagePlural =
"This problem can usually be solved by installing the system "
++ "packages that provide these libraries (you may need the "
Expand All @@ -680,18 +679,18 @@ exceptionMessage e = case e of
++ "where they are."
++ "If the library files do exist, it may contain errors that "
++ "are caught by the C compiler at the preprocessing stage. "
++ "In this case you can re-run configure with the verbosity "
++ "flag -v3 to see the error messages."
++ "In this case you can re-run 'Setup configure' with the "
++ "verbosity flag -v3 to see the error messages."
headerCppMessage =
"If the header file does exist, it may contain errors that "
++ "are caught by the C compiler at the preprocessing stage. "
++ "In this case you can re-run configure with the verbosity "
++ "flag -v3 to see the error messages."
++ "In this case you can re-run 'Setup configure' with the "
++ "verbosity flag -v3 to see the error messages."
headerCcMessage =
"The header file contains a compile error. "
++ "You can re-run configure with the verbosity flag "
++ "You can re-run 'Setup configure' with the verbosity flag "
++ "-v3 to see the error messages from the C compiler."
CheckPackageProblems errors -> (intercalate "\n\n" $ errors)
CheckPackageProblems errors -> intercalate "\n\n" errors
LibDirDepsPrefixNotRelative l p ->
"Library directory of a dependency: "
++ show l
Expand Down Expand Up @@ -753,7 +752,7 @@ exceptionMessage e = case e of
RegisMultiplePkgNotSupported -> "Registering multiple package instances is not yet supported for this compiler"
RegisteringNotImplemented -> "Registering is not implemented for this compiler"
NoTestSuitesEnabled ->
"No test suites enabled. Did you remember to configure with "
"No test suites enabled. Did you remember to 'Setup configure' with "
++ "\'--enable-tests\'?"
TestNameDisabled tName ->
"Package configured with test suite "
Expand Down

0 comments on commit 0ce467a

Please sign in to comment.