EXCEPTION: browse: module ‘SimpleJSON’ is defined in multiple files
joseedil opened this issue · comments
I'm getting this exceptions on both Ubuntu 17.04 with Emacs 24.5.1 and MacOS Sierra with Emacs 25.2.
EXCEPTION: browse:
module ‘SimpleJSON’ is defined in multiple files: /tmp/ghc-mod23992/SimpleJSON17345751981973594324.hs
SimpleJSON.hs
Here is the output of ghc-debug
on Ubuntu.
Path: check if you are using intended programs.
ghc.el path: /home/edil/.emacs.d/elpa/ghc-5.7.0.0/ghc.el
ghc-mod path: /home/edil/.cabal/bin/ghc-mod
ghc path: /opt/ghc/ghc-8.0.2/bin/ghc
Version: all GHC versions must be the same.
ghc.el version 5.7.0.0
ghc-mod version 5.7.0.0 compiled by GHC 8.0.2
The Glorious Glasgow Haskell Compilation System, version 8.0.2
Environment variables:
PATH=/opt/ghc/ghc-8.0.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/edil/development/eclipse/modeling-neon/eclipse/:/home/edil/.cabal/bin/:/opt/ghc/ghc-8.0.2/bin/
The result of "ghc-mod debug":
Version: ghc-mod-5.7.0.0
Library GHC Version: 8.0.2
System GHC Version: 8.0.2
Root directory: /home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5
Current directory: /home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5
GHC Package flags:
-i/home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5
-i/home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5
-global-package-db -no-user-package-db -package-db
/home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5/.cabal-sandbox/x86_64-linux-ghc-8.0.2-packages.conf.d
-Wall
GHC System libraries: /opt/ghc/ghc-8.0.2/lib/ghc-8.0.2
I get this errors every time I start writing a new function and they keep popping whenever I add something. They look to be related to #609.
Thought they were caused by having buffers from other projects, but it happens even with a fresh emacs. I'm not using Stack, but Cabal.
This is what ghc-mod debug
gives me.
edil:chapt5$ ghc-mod debug
Version: ghc-mod-5.7.0.0
Library GHC Version: 8.0.2
System GHC Version: 8.0.2
Root directory: /home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5
Current directory: /home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5
GHC Package flags:
-hide-all-packages -no-user-package-db -package-db
/home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5/.cabal-sandbox/x86_64-linux-ghc-8.0.2-packages.conf.d
-package-id base-4.9.1.0
GHC System libraries: /opt/ghc/ghc-8.0.2/lib/ghc-8.0.2
cabal-install Version: 1.24.0.2
Cabal Library Versions:
Cabal-1.24.2.0
Cabal file: Just "/home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5/chapt5.cabal"
Project: CabalProject
Cabal entrypoints:
Setup.hs
Main (/home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5/Setup.hs)
exe:chapt5
Main (/home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5/Main.hs)
Cabal components:
Setup.hs
Main (/home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5/Setup.hs)
exe:chapt5
Main (/home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5/Main.hs)
PutJSON
SimpleJSON
PutJSON (/home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5/PutJSON.hs)
SimpleJSON
SimpleJSON (/home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5/SimpleJSON.hs)
GHC Cabal options:
Setup.hs
exe:chapt5
-fbuilding-cabal-package -O -outputdir dist/build/chapt5/chapt5-tmp
-odir dist/build/chapt5/chapt5-tmp -hidir
dist/build/chapt5/chapt5-tmp -stubdir dist/build/chapt5/chapt5-tmp
-i -idist/build/chapt5/chapt5-tmp -i. -idist/build/autogen
-Idist/build/autogen -Idist/build/chapt5/chapt5-tmp -optP-include
-optPdist/build/autogen/cabal_macros.h -hide-all-packages
-no-user-package-db -package-db
/home/edil/development/haskell/haskell-learning/real_world_haskell/chapt5/.cabal-sandbox/x86_64-linux-ghc-8.0.2-packages.conf.d
-package-id base-4.9.1.0 -XHaskell2010
GHC search path options:
Setup.hs
exe:chapt5
-i -idist/build/chapt5/chapt5-tmp -i. -idist/build/autogen
-Idist/build/autogen -Idist/build/chapt5/chapt5-tmp -optP-include
-optPdist/build/autogen/cabal_macros.h
By the way, the project compiles and the executable file seems to be working.
0497267 should alleviate this somewhat. It fixes a silly mistake which made #693 completely useless. As long as you don't run ghc-mod commands on unsaved buffers it should work.
You are right that #609 (i.e. the lack of calling unmap-file) is the real root cause here. This is really just a band-aid.
0497267 landed on v5.8