ocharles / weeder

A re-implementation of weeder using HIE files
BSD 3-Clause "New" or "Revised" License
169 stars 28 forks source link

In a multi-GHC environment, weeder seems to pick up the wrong build #66

Closed andreasabel closed 3 years ago

andreasabel commented 3 years ago

In a multi-GHC environment, weeder seems to pick up the wrong build:

$ cat cabal.project.local 
-- Write .hie files for dead-code detection with weeder

packages: BNFC.cabal

package *
  ghc-options: -fwrite-ide-info

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.4 

$ cabal  build --project-file=cabal.project.local
Resolving dependencies...
Build profile: -w ghc-8.10.4 -O1
In order, the following will be built (use -v for more details):
 - BNFC-2.9.2 (lib:BNFC, exe:bnfc) (file src/BNFC/Backend/C/CFtoBisonC.hs changed)
Preprocessing library for BNFC-2.9.2..
Building library for BNFC-2.9.2..
[78 of 83] Compiling BNFC.Backend.C.CFtoBisonC ( src/BNFC/Backend/C/CFtoBisonC.hs, /Users/abel/project/open-source/bnfc/source/dist-newstyle/build/x86_64-osx/ghc-8.10.4/BNFC-2.9.2/build/BNFC/Backend/C/CFtoBisonC.o, /Users/abel/project/open-source/bnfc/source/dist-newstyle/build/x86_64-osx/ghc-8.10.4/BNFC-2.9.2/build/BNFC/Backend/C/CFtoBisonC.dyn_o )
Preprocessing executable 'bnfc' for BNFC-2.9.2..
Building executable 'bnfc' for BNFC-2.9.2..

<built-in>:15:10: error:
     warning: non-portable path to file '"/Users/abel/project/open-source/bnfc/source/dist-newstyle/build/x86_64-osx/ghc-8.10.4/BNFC-2.9.2/build/BNFC/autogen/cabal_macros.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#include "/Users/abel/project/open-source/bnfc/source/dist-newstyle/build/x86_64-osx/ghc-8.10.4/BNFC-2.9.2/build/bnfc/autogen/cabal_macros.h"
...         
Linking /Users/abel/project/open-source/bnfc/source/dist-newstyle/build/x86_64-osx/ghc-8.10.4/BNFC-2.9.2/build/bnfc/bnfc ...

$ weeder
incompatible hie file: /Users/abel/project/open-source/bnfc/source/dist-newstyle/build/x86_64-osx/ghc-9.0.1/BNFC-2.9.2/build/BNFC/Utils.hie
    expected .hie file version 8104 but got 9001
    weeder must be built with the same GHC version as the project it is used on
make: *** [Makefile:43: weed] Error 1

Where does weeder get the idea from to look in .../ghc-9.0.1/...?

Additional info:

$ cat weeder.dhall 
{ roots =
  [ "^Main.main$"
  -- Cabal-generated
  , "^Paths_.*"
  -- BNFC-generated
  , "^AbsBNF\\..*", "^LexBNF\\..*", "^ParBNF\\..*", "^SkelBNF\\..*", "^PrintBNF\\..*"
  -- CF (don't care)
  , "^Algebra\\..*", "^Data\\..*", "^Parsing\\..*"
  -- XML backend (don't care)
  , "Backend\\.XML\\..*"
  -- Utils (keep)
  , "^BNFC\\.Utils\\..*", "Backend\\.Haskell\\.Utils\\.tokenText"
  -- Used by doctest (keep)
  , "BNFC\\.Lexing\\.debugPrint", "BNFC\\.CF\\.np.*"
  ]
, type-class-roots = True
}
andreasabel commented 3 years ago

This might be a problem upstream (in cabal). I also noted some irregularities in my setting with cabal test, where it complained about several packages BNFC-2.9.2 with the same name.

For now, I think you can ignore this issue. If I can pin something down, I'll notify you again.

ocharles commented 3 years ago

Thanks for the update @andreasabel - please feel free to reopen this if it does turn out to be a problem with weeder!