Skip to content

error: Can't find src/ClassMain.hs #9185

Closed
@andrewufrank

Description

@andrewufrank

Describe the bug
I have a (perhaps unusual) configuration with two test suits in the cabal file. The project compiles and runs ok.
Running the two tests (each in a separate test suite) runs with cabal test test1 and cabal test test2 ok.

When I run cabal repl test1 I get the following:

Build profile: -w ghc-9.4.5 -O1
In order, the following will be built (use -v for more details):
 - relocation-0.0.1 (test:test1) (ephemeral targets)
Preprocessing test suite 'test1' for relocation-0.0.1..
GHCi, version 9.4.5: https://www.haskell.org/ghc/  :? for help

<no location info>: error: Can't find src/ClassMain.hs
Failed, no modules loaded.
Loaded GHCi configuration from /home/frank/Workspace11/experiments_SSG_related/relocation/.ghci
[1 of 3] Compiling Main             ( tests/Testing.hs, interpreted )
[2 of 3] Compiling Paths_relocation ( /home/frank/Workspace11/experiments_SSG_related/relocation/dist-newstyle/build/x86_64-linux/ghc-9.4.5/relocation-0.0.1/t/test1/build/test1/autogen/Paths_relocation.hs, interpreted )
Ok, two modules loaded.
ghci> 

and processing goes as usual.

The error message error: Can't find src/ClassMain.hs troubles me (because I have with a similar configuration a more serious problem with error: relocation overflow: which might be related).

The cabal file is

cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.3.
--
-- see: https://github.com/sol/hpack

name:           relocation
version:        0.0.1
synopsis:       a new test
description:    test for relocation overflows
license:        BSD2
license-file:   LICENSE
build-type:     Simple

library
  exposed-modules:
      Lib.Top
  other-modules:
      Paths_relocation
  hs-source-dirs:
      src
  ghc-options: -Wall
  build-depends:
      base >=4.7 && <5
  default-language: Haskell2010

executable relocation
  main-is: newtest.hs
  other-modules:
      Paths_relocation
  hs-source-dirs:
      app
  ghc-options: -Wall
  build-depends:
      base >=4.7 && <5
  default-language: Haskell2010

test-suite test1
  type: exitcode-stdio-1.0
  main-is: Testing.hs
  other-modules:
      Paths_relocation
  hs-source-dirs:
      tests
  ghc-options: -Wall
  build-depends:
      base >=4.7 && <5
    , relocation
  default-language: Haskell2010

test-suite test2
  type: exitcode-stdio-1.0
  main-is: Testing2.hs
  other-modules:
      Paths_relocation
  hs-source-dirs:
      tests2
  ghc-options: -Wall
  build-depends:
      base >=4.7 && <5
    , relocation
  default-language: Haskell2010

To Reproduce

$ cabal repl test1

Expected behavior
I expect no error message

cabal run produces expected result.

System information

  • Operating system
  • Linux bhutan 6.1.0-11-amd64 Add support for the Apache license #1 SMP PREEMPT_DYNAMIC Debian 6.1.38-4 (2023-08-08) x86_64 GNU/Linux
  • cabal, ghc versions
    The Glorious Glasgow Haskell Compilation System, version 9.4.5
    frank@bhutan:~/Desktop$ cabal --version
    cabal-install version 3.8.1.0
    compiled using version 3.8.1.0 of the Cabal library

Additional context
Add any other context about the problem here.

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