Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile #1

Open
fullofcaffeine opened this issue Jan 1, 2014 · 17 comments
Open

Can't compile #1

fullofcaffeine opened this issue Jan 1, 2014 · 17 comments

Comments

@fullofcaffeine
Copy link

Hi,

I'm pretty new to Haskell, GHC and cabal. I did update GHC to the latest version (7.6.3) and the platform as well. Still, when I try compiling, I get the following:

➜  xmonad-sessions git:(master) ghc saveDocument.hs -v
Glasgow Haskell Compiler, Version 7.6.3, stage 2 booted by GHC version 7.4.1
Using binary package database: /usr/local/lib/ghc-7.6.3/package.conf.d/package.cache
Using binary package database: /home/fullofcaffeine/.ghc/x86_64-linux-7.6.3/package.conf.d/package.cache
hiding package Cabal-1.16.0 to avoid conflict with later version Cabal-1.18.1.2
wired-in package ghc-prim mapped to ghc-prim-0.3.0.0-d5221a8c8a269b66ab9a07bdc23317dd
wired-in package integer-gmp mapped to integer-gmp-0.5.0.0-2f15426f5b53fe4c6490832f9b20d8d7
wired-in package base mapped to base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to template-haskell-2.8.0.0-a3012803fde1dc362e555b35a1a78e6d
wired-in package dph-seq not found.
wired-in package dph-par not found.
Hsc static flags: -static
*** Chasing dependencies:
Chasing modules from: *saveDocument.hs

saveDocument.hs:5:8:
    Could not find module `System.Path'
    Locations searched:
      System/Path.hs
      System/Path.lhs
*** Deleting temp files:
Deleting: 
*** Deleting temp dirs:

Any hints appreciated!

Marcelo.

@zaxtax
Copy link
Owner

zaxtax commented Jan 1, 2014

You will need to install the MissingH library http://hackage.haskell.org/package/MissingH-1.1.1.0/docs/System-Path.html

Do tell me if you any other troubles, or suggestions to making the library easier to use.

@mx781
Copy link

mx781 commented Jul 24, 2017

@zaxtax I am getting a different Not in scope error when compiling -- suggestions?

[1 of 1] Compiling Main             ( saveDocument.hs, saveDocument.o )
saveDocument.hs:15:24: Not in scope: ‘absNormPath’

@zaxtax
Copy link
Owner

zaxtax commented Jul 24, 2017

You also likely need to install MissingH

https://hackage.haskell.org/package/MissingH-1.4.0.1/docs/src/System-Path.html#absNormPath

Perhaps it's time for me to remove that dependency.

@rajaiitp
Copy link

rajaiitp commented Aug 9, 2021

hi there! any updates on fixing this. This seems to be a useful feature if it can reload, windows in the same position in the exact workspace.

I dont understand haskell syntax enough to edit the code. But from what i understand its used only to get the absolute path to the home directory or something. I dont mind if I have to hardcode this piece of info into the file. I find it hard to resolve the dependencies to have MissingH installed. Thanks!

@zaxtax
Copy link
Owner

zaxtax commented Aug 9, 2021

It's in the MissingH library https://hackage.haskell.org/package/MissingH-1.4.3.0/docs/src/System.Path.html#absNormPath

All you need to do is cabal install MissingH --lib

@rajaiitp
Copy link

rajaiitp commented Aug 9, 2021

cabal install MissingH --lib
Resolving dependencies...
Build profile: -w ghc-8.10.5 -O1
In order, the following will be built (use -v for more details):

  • hsc2hs-0.68.7 (exe:hsc2hs) (requires build)
  • random-1.1 (lib) (requires build)
  • network-bsd-2.8.1.0 (lib) (requires build)
  • hslogger-1.3.1.0 (lib) (requires build)
  • MissingH-1.4.3.0 (lib) (requires build)
    Starting random-1.1 (lib)
    Starting hsc2hs-0.68.7 (exe:hsc2hs)
    Building random-1.1 (lib)
    Building hsc2hs-0.68.7 (exe:hsc2hs)

Failed to build exe:hsc2hs from hsc2hs-0.68.7.
Build log (
/home/raja/.cabal/logs/ghc-8.10.5/hsc2hs-0.68.7-6c67f4e98fe895a9afff21c21e716e67da3d702e7122146245379fd46b6abc99.log
):
Configuring executable 'hsc2hs' for hsc2hs-0.68.7..
Preprocessing executable 'hsc2hs' for hsc2hs-0.68.7..
Building executable 'hsc2hs' for hsc2hs-0.68.7..
[ 1 of 12] Compiling ATTParser ( ATTParser.hs, dist/build/hsc2hs/hsc2hs-tmp/ATTParser.o )

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

ATTParser.hs:17:1: error:
Could not find module ‘Control.Applicative’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
17 | import Control.Applicative ((<|>))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ATTParser.hs:18:1: error:
Could not find module ‘Data.Word’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
18 | import Data.Word (Word32, Word64)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ATTParser.hs:19:1: error:
Could not find module ‘Data.Int’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
19 | import Data.Int (Int64)
| ^^^^^^^^^^^^^^^^^^^^^^^

ATTParser.hs:20:1: error:
Could not find module ‘Data.Char’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
20 | import Data.Char (isDigit, isSpace)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ATTParser.hs:21:1: error:
Could not find module ‘Data.Bits’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
21 | import Data.Bits (shiftL, shiftR, (.|.))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ATTParser.hs:22:1: error:
Could not find module ‘Data.Maybe’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
22 | import Data.Maybe (fromMaybe)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Failed to build random-1.1.
Build log (
/home/raja/.cabal/logs/ghc-8.10.5/random-1.1-0dae2dbaf924a733335be9d5cdd0357b2b7c29fdc3273443854bc249af27143c.log
):
Warning: random.cabal:15:2: Tabs used as indentation at 15:2, 16:2, 17:2
Configuring library for random-1.1..
Preprocessing library for random-1.1..
Building library for random-1.1..
[1 of 1] Compiling System.Random ( System/Random.hs, dist/build/System/Random.o, dist/build/System/Random.dyn_o )

System/Random.hs:78:1: error:
Could not find module ‘Prelude’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
78 | import Prelude
| ^^^^^^^^^^^^^^

System/Random.hs:80:1: error:
Could not find module ‘Data.Bits’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
80 | import Data.Bits
| ^^^^^^^^^^^^^^^^

System/Random.hs:81:1: error:
Could not find module ‘Data.Int’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
81 | import Data.Int
| ^^^^^^^^^^^^^^^

System/Random.hs:82:1: error:
Could not find module ‘Data.Word’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
82 | import Data.Word
| ^^^^^^^^^^^^^^^^

System/Random.hs:83:1: error:
Could not find module ‘Foreign.C.Types’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
83 | import Foreign.C.Types
| ^^^^^^^^^^^^^^^^^^^^^^

System/Random.hs:90:1: error:
Could not find module ‘System.CPUTime’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
90 | import System.CPUTime ( getCPUTime )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

System/Random.hs:91:1: error:
Could not find module ‘Data.Time’
There are files missing in the ‘time-1.9.3’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
91 | import Data.Time ( getCurrentTime, UTCTime(..) )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

System/Random.hs:92:1: error:
Could not find module ‘Data.Ratio’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
92 | import Data.Ratio ( numerator, denominator )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

System/Random.hs:94:1: error:
Could not find module ‘Data.Char’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
94 | import Data.Char ( isSpace, chr, ord )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

System/Random.hs:95:1: error:
Could not find module ‘System.IO.Unsafe’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
95 | import System.IO.Unsafe ( unsafePerformIO )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

System/Random.hs:96:1: error:
Could not find module ‘Data.IORef’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
96 | import Data.IORef ( IORef, newIORef, readIORef, writeIORef )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

System/Random.hs:98:1: error:
Could not find module ‘Data.IORef’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
98 | import Data.IORef ( atomicModifyIORef' )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

System/Random.hs:102:1: error:
Could not find module ‘Numeric’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
102 | import Numeric ( readDec )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

System/Random.hs:105:1: error:
Could not find module ‘GHC.Exts’
There are files missing in the ‘base-4.14.2.0’ package,
try running 'ghc-pkg check'.
Use -v (or :set -v in ghci) to see a list of the files searched for.
|
105 | import GHC.Exts ( build )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cabal: Failed to build exe:hsc2hs from hsc2hs-0.68.7 (which is required by
MissingH-1.4.3.0). See the build log above for details.
Failed to build random-1.1 (which is required by MissingH-1.4.3.0). See the
build log above for details.


After that tried installing prelude looking at the error
cabal install Prelude --lib
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: Prelude-0.1.0.1 (user goal)
[__1] next goal: base (dependency of Prelude)
[__1] rejecting: base-4.14.2.0/installed-4.14.2.0 (conflict: Prelude =>
base>=4.3 && <4.14)
[__1] skipping: base-4.15.0.0, base-4.14.3.0, base-4.14.2.0, base-4.14.1.0,
base-4.14.0.0 (has the same characteristics that caused the previous version
to fail: excluded by constraint '>=4.3 && <4.14' from 'Prelude')
[__1] rejecting: base-4.13.0.0, base-4.12.0.0, base-4.11.1.0, base-4.11.0.0,
base-4.10.1.0, base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0,
base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0,
base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0,
base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1,
base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1
(constraint from non-upgradeable package requires installed instance)
[__1] fail (backjumping, conflict set: Prelude, base)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, base-noprelude, Prelude


im using arch. Cabal seems simple but isnt compatible with static libraries say a few wiki. I tried on stack too. similar issues. Not sure how to fix the dependencies... :(

@zaxtax
Copy link
Owner

zaxtax commented Aug 9, 2021 via email

@rajaiitp
Copy link

rajaiitp commented Aug 9, 2021

Originally I installed it from the arcolinux default installation process to begin with. I make changes to xmonad.hs and just run the command recompile and restart. I have been able to successfully get it working also using stack , however, the xmobar command doesnt show up to xmonad for some reason (https://brianbuccola.com/how-to-install-xmonad-and-xmobar-via-stack/). And I didnt know how to fix that, so i just reverted back. (I was supposed to add the path to the user profile and I wasnt sure, how exactly to do it) But I also think the startup is quite slow via the stack installation.

installing MissingH on stack is straightforward too i think, put these packages dont seem to get exposed. adding them to extra-deps creates dependency issues with base package.

Not sure if this makes up, but is it possible to share the ghc compiled file of saveDocument for me to add it :)

@zaxtax
Copy link
Owner

zaxtax commented Aug 9, 2021 via email

@rajaiitp
Copy link

rajaiitp commented Aug 9, 2021

i did use the --lib thing. but then cabal mixes up stuff from the system packages too. And then i need to uninstall my desktop window manager, which sometimes makes it unusable. I dont have cabal, so i think i should start from ghcup installation

A compilation of commands to be executed would be helpful.. thanks man!

@rajaiitp
Copy link

rajaiitp commented Aug 11, 2021

got it to compile. but it aint working.

leaving a list of commands for setting up cabal, installing xmonad, contrib, xmobar and missingH (alongside some additional functionalities)

if on arch uninstall all haskel, xmonad, xmobar.

Install ghcup and stuff that comes alongside. can skip stack and editor integrations.
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh # this installs ghcup locally. Add ~/.ghcup/bin to your path

use: ghcup list : to see what version of ghc is installed and enabled by deefualt

install ghc 8.8.1 (its not a very old version. you can test with other versions too, MissingH creates base dependecy issues with latest base version)
: ghcup install ghc 8.8.1
: ghcup set ghc 8.8.1
can remove other install versions using : ghcup rm ghc version

cabal new-install --lib xmonad xmonad-contrib xmobar X11 dbus MissingH
cabal new-install xmobar --flags="all_extension"

use xmonad --recompile && xmonad --restart

(use new-install instead of install, for some reason install does not expose the packages to ghc, check ghc-pkg list to confirm)
Now we should have xmonad running. I couldnt get it to work properly with a login manager though (restart doesnt take effect if you are using a display manager, weird thingy happening) .. so just sticking to startx.


A few things in the readme,
cp ViewDoc.hs ~/.xmonad/lib
i dont have a lib folder and i presume, you want me to put it one. (so maybe lib/ so that it raises an error rather than rename it as lib)
same here mv saveDocument /home/user/bin (maybe bin/)

these 2 lines are real confusing:
$ ln -s /usr/user/bin/saveDocument /home/user/bin/gv
$ ln -s /usr/user/bin/saveDocument /home/user/bin/evince

/usr/user/bin/.. did you mean /home/user/bin or /bin/some_program

are we symmlinking programs to /home/user/bin/program ?

Can you help me fix this.. thanks bro :)

wt i ended up doing
mkdir ~/.xmonad/lib
cp ViewDoc.hs ~/.xmonad/lib/
ghc --make saveDocument
mkdir /home/raja/bin/
mv saveDocument /home/raja/bin/

ln -s /bin/emacs /home/raja/bin/emacs

opened emacs.
did Mod s. closed it.
then did mod shift s
nothing happened :(

@zaxtax
Copy link
Owner

zaxtax commented Aug 12, 2021

I should clean up the readme. Just to check when you run Mod-s does the border color change

The point of saveDocument is that to save sessions you need a way to record how different applications were run and their PIDs. The way it does this is by recording the program, it's arguments, and the PID of the running program into $HOME/.viewedDocs.

The idea being that you call gv or evince and it's really calling saveDocument which is what launches the real gv or evince. You should try to launch the symlinked emacs, see if there is an entry in $HOME/.viewedDocs, and just make sure $HOME/bin is in your path.

@zaxtax
Copy link
Owner

zaxtax commented Aug 12, 2021

I wrote this a decade ago and if I did it again today I'd have an explicit wrapper program sa or session-add that worked more like rlwrap and just avoid this symlinking nonsense altogether. But for now let's focus on getting this working for you and me updating the docs so it's more clear for others how to build this.

@rajaiitp
Copy link

Yup the border color does change using mod s
However after closing the emacs client, nothing happens on pressing mod shift s
Yup. running the symlink file causes emacs to launch, though not returning to the saved state position or workspace

@zaxtax
Copy link
Owner

zaxtax commented Aug 13, 2021 via email

@rajaiitp
Copy link

rajaiitp commented Aug 14, 2021

yes it is. I exported in the .zshrc file and tested by printing in the terminal
Also added it to the .profile file as I wasnt sure where exactly to add it

contents of my .viewedDocs
["bin","1492662","False","False"]
["emacs","90748","False","False"]
["emacs","90814","False","False"]
["emacs","91076","False","False"]
["emacs","1091778","False","False"]
["emacs","1092364","False","False"]

Nothing happens though when doing mod Shift s

@zaxtax
Copy link
Owner

zaxtax commented Aug 14, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants