Skip to content

cabal: Error: Could not find module: "Added_prepossor_module_name" with any suffix #6124

@mdgabriel

Description

@mdgabriel

Describe the bug
% cabal v2-sdist
cabal: Error: Could not find module: SciDbAFL with any suffix:
["gc","chs","hsc","x","y","ly","cpphs","hs","lhs","hsig","lhsig"]. If the
module is autogenerated it should be added to 'autogen-modules'.

I have added the preprocessor bnfc to a custom Setup. The file SciDbAFL.cf is not found.

To Reproduce
% cabal v2-sdist

Here is a snip of the custom Setup:

main :: IO ()
main = defaultMainWithHooks simpleUserHooks{hookedPreProcessors =
("cf",ppBnfc):knownSuffixHandlers}

The input file to bnfc is SciDbAFL.cf and the appropriate snip of my scidb-hquery.cabal is

other-modules:
SciDbAFL
AbsSciDbAFL
ErrM
LexSciDbAFL
ParSciDbAFL
PrintSciDbAFL

autogen-modules:
AbsSciDbAFL
ErrM
LexSciDbAFL
ParSciDbAFL
PrintSciDbAFL

Where to find the problem
In the file cabal-install-2.4.1.0/Distribution/Client/CmdSdist.hs, in the the function packageToSdist, the following line of code only uses knownSuffixHandlers:

listPackageSources verbosity (flattenPackageDescription $ packageDescription pkg) knownSuffixHandlers

For example, as a test, if I hard code

listPackageSources verbosity (flattenPackageDescription $ packageDescription pkg) (("cf",undefined):knownSuffixHandlers)

then my hacked cabal v2-sdist works.

Expected behavior
I expect cabal v2-sdist to not only use the the knownSuffixHandlers but also those in hookedPreProcessors.

Work around
I have an (ugly) work around. One just adds SciDbAFL to autogen-modules, which it is of course not, and one adds it also to

extra-source-files:
src/SciDbAFL.cf

As I understand it, this respects what nix wishes to accomplish.

System informataion

  • Operating system: Ubuntu 16.04.6 LTS (Xenial Xerus)
  • $ cabal --version
    cabal-install version 2.4.1.0
    compiled using version 2.4.1.0 of the Cabal library
  • $ ghc --version
    The Glorious Glasgow Haskell Compilation System, version 8.6.5

Additional context
The issue was discovered with a cabal package that I am creating that uses bnfc --haskell via the hookedPreProcessors record.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions