From c1d6d73122dc31e8e46c0c2ea3179ae716cecc07 Mon Sep 17 00:00:00 2001 From: brandon s allbery kf8nh Date: Fri, 24 Nov 2023 13:52:23 -0500 Subject: [PATCH 1/3] clarify "configure" messages from Cabal --- Cabal/src/Distribution/Simple/Configure.hs | 12 +++--- Cabal/src/Distribution/Simple/Errors.hs | 49 +++++++++++----------- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/Cabal/src/Distribution/Simple/Configure.hs b/Cabal/src/Distribution/Simple/Configure.hs index b7aabf65f18..55356516e75 100644 --- a/Cabal/src/Distribution/Simple/Configure.hs +++ b/Cabal/src/Distribution/Simple/Configure.hs @@ -187,20 +187,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" @@ -950,7 +950,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" diff --git a/Cabal/src/Distribution/Simple/Errors.hs b/Cabal/src/Distribution/Simple/Errors.hs index dc3e30ab9b6..c15c3616d93 100644 --- a/Cabal/src/Distribution/Simple/Errors.hs +++ b/Cabal/src/Distribution/Simple/Errors.hs @@ -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." @@ -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 ++ "'" @@ -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: " @@ -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" @@ -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 -> @@ -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" @@ -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, " @@ -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 " @@ -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." @@ -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 " @@ -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 @@ -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 " From e3796df97527c8813e8483fb478e384e86525a6e Mon Sep 17 00:00:00 2001 From: brandon s allbery kf8nh Date: Fri, 24 Nov 2023 14:08:38 -0500 Subject: [PATCH 2/3] add changelog --- changelog.d/configure-messages | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 changelog.d/configure-messages diff --git a/changelog.d/configure-messages b/changelog.d/configure-messages new file mode 100644 index 00000000000..77377ec098b --- /dev/null +++ b/changelog.d/configure-messages @@ -0,0 +1,13 @@ +synopsis: clarify Cabal "configure messages +packages: Cabal +prs: #9476 + +synopsis: { + + Cabal can issue a number of error messages referencing "Setup configure", + but it simply references "configure" which could mean any of three + things (Setup configure, the package's "configure" script, or "cabal + configure". This has recently caught out even Cabal devs. Clarify these + messages. + +} From 4b591137368d8175bec8548084264b536dbc0248 Mon Sep 17 00:00:00 2001 From: brandon s allbery kf8nh Date: Wed, 26 Jun 2024 18:40:27 -0400 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Javier Sagredo --- changelog.d/configure-messages | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.d/configure-messages b/changelog.d/configure-messages index 77377ec098b..f0fab79e734 100644 --- a/changelog.d/configure-messages +++ b/changelog.d/configure-messages @@ -1,4 +1,4 @@ -synopsis: clarify Cabal "configure messages +synopsis: clarify Cabal "configure" messages packages: Cabal prs: #9476 @@ -7,7 +7,7 @@ synopsis: { Cabal can issue a number of error messages referencing "Setup configure", but it simply references "configure" which could mean any of three things (Setup configure, the package's "configure" script, or "cabal - configure". This has recently caught out even Cabal devs. Clarify these + configure"). This has recently caught out even Cabal devs. Clarify these messages. }