conda-forge / ghc-feedstock

A conda-smithy repository for ghc.
BSD 3-Clause "New" or "Revised" License
2 stars 14 forks source link

`Could not find module ‘Prelude’` on macOS #19

Closed jakirkham closed 2 years ago

jakirkham commented 3 years ago

Issue:

When trying to compile a simple hello world program, am running into some issues.

-- hello.rs

module Main where

main = putStrLn "Hello World"

Am running this to compile and am getting the error below.

$ ghc hello.hs -o hello
[1 of 1] Compiling Main             ( hello.hs, hello.o )

hello.hs:1:8: error:
    Could not find module ‘Prelude’
    There are files missing in the ‘base-4.14.1.0’ package,
    try running 'ghc-pkg check'.
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
1 | module Main where
  |        ^^^^

Tried running ghc-pkg check and got a bunch of warnings. Running ghc-pkg recache as suggested doesn't seem to fix the issue.

$ ghc-pkg check
WARNING: cache is out of date: /Users/jkirkham/miniconda/envs/ghc/lib/ghc-8.10.4/package.conf.d/package.cache
ghc will see an old view of this package db. Use 'ghc-pkg recache' to fix.
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/directory-1.3.6.0/directory.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/terminfo-0.4.1.4/terminfo.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/stm-2.5.0.0/stm.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/process-1.6.9.0/process.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/time-1.9.3/time.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/filepath-1.4.2.1/filepath.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/libiserv-8.10.4/libiserv.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/pretty-1.1.3.6/pretty.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/integer-gmp-1.0.3.0/integer-gmp.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/mtl-2.2.2/mtl.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/unix-2.7.2.2/unix.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/ghci-8.10.4/ghci.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/hpc-0.6.1.0/hpc.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/template-haskell-2.16.0.0/template-haskell.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/ghc-boot-8.10.4/ghc-boot.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/ghc-prim-0.6.1/ghc-prim.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/base-4.14.1.0/base.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/parsec-3.1.14.0/parsec.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/ghc-heap-8.10.4/ghc-heap.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/ghc-boot-th-8.10.4/ghc-boot-th.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/ghc-compact-0.1.0.0/ghc-compact.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/containers-0.6.2.1/containers.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/deepseq-1.4.4.0/deepseq.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/array-0.5.4.0/array.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/text-1.2.4.1/text.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/Cabal-3.2.1.0/Cabal.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/ghc-8.10.4/ghc.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/binary-0.8.8.0/binary.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/transformers-0.5.6.2/transformers.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/exceptions-0.10.4/exceptions.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/bytestring-0.10.12.0/bytestring.haddock doesn't exist or isn't a file
Warning: haddock-interfaces: /Users/jkirkham/miniconda/envs/ghc/share/doc/ghc-8.10.4/html/libraries/haskeline-0.8.0.1/haskeline.haddock doesn't exist or isn't a file


Environment (conda list):

``` $ conda list # packages in environment at /Users/jkirkham/miniconda/envs/ghc: # # Name Version Build Channel c-compiler 1.3.0 h0d85af4_0 conda-forge cctools 949.0.1 hd9211c8_21 conda-forge cctools_osx-64 949.0.1 h6407bdd_21 conda-forge clang 11.1.0 h694c41f_1 conda-forge clang-11 11.1.0 default_he082bbe_1 conda-forge clang_osx-64 11.1.0 hb91bd55_3 conda-forge clangxx 11.1.0 default_he082bbe_1 conda-forge compiler-rt 11.1.0 h654b07c_0 conda-forge compiler-rt_osx-64 11.1.0 h8c5fa43_0 conda-forge ghc 8.10.4 h695349b_0 conda-forge gmp 6.2.1 h2e338ed_0 conda-forge ld64 530 hd2e7500_21 conda-forge ld64_osx-64 530 he8994da_21 conda-forge ldid 2.1.2 h7660a38_2 conda-forge libclang-cpp11.1 11.1.0 default_he082bbe_1 conda-forge libcxx 12.0.1 habf9029_0 conda-forge libffi 3.3 h046ec9c_2 conda-forge libllvm11 11.1.0 hd011deb_2 conda-forge llvm-openmp 12.0.1 hda6cdc1_1 conda-forge llvm-tools 11.1.0 hd011deb_2 conda-forge ncurses 6.2 h2e338ed_4 conda-forge tapi 1100.0.11 h9ce4665_0 conda-forge xz 5.2.5 haf1e3a3_1 conda-forge zlib 1.2.11 h7795811_1010 conda-forge ```


Details about conda and system ( conda info ):

``` $ conda info active environment : ghc active env location : /Users/jkirkham/miniconda/envs/ghc shell level : 2 user config file : /Users/jkirkham/.condarc populated config files : /Users/jkirkham/.condarc conda version : 4.10.3 conda-build version : 3.21.4 python version : 3.8.10.final.0 virtual packages : __osx=10.15.7=0 __unix=0=0 __archspec=1=x86_64 base environment : /Users/jkirkham/miniconda (writable) conda av data dir : /Users/jkirkham/miniconda/etc/conda conda av metadata url : None channel URLs : https://conda.anaconda.org/conda-forge/osx-64 https://conda.anaconda.org/conda-forge/noarch https://repo.anaconda.com/pkgs/main/osx-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/osx-64 https://repo.anaconda.com/pkgs/r/noarch package cache : /Users/jkirkham/miniconda/pkgs /Users/jkirkham/.conda/pkgs envs directories : /Users/jkirkham/miniconda/envs /Users/jkirkham/.conda/envs platform : osx-64 user-agent : conda/4.10.3 requests/2.26.0 CPython/3.8.10 Darwin/19.6.0 OSX/10.15.7 UID:GID : 523832026:1019530959 netrc file : None offline mode : False ```
step21 commented 3 years ago

Thanks. I think modules are not the only issues as this https://github.com/conda-forge/ghc-feedstock/issues/9 does also still exist, with a hardcoded build path of gcc somewhere. It seems similar to this https://github.com/commercialhaskell/stack/issues/4122 but not exactly. To at least test for this, I added a test with this simple file (not merged yet).

jakirkham commented 3 years ago

Thanks! Yeah saw that issue and wasn't sure if this was the same thing or not. So went ahead and created a new issue just in case.

Also thanks for working on the test. Will be good to see what we are missing.