jtdaugherty / tart

Tart - draw ASCII art in the terminal with your mouse!
BSD 3-Clause "New" or "Revised" License
383 stars 19 forks source link

Issues building the app #23

Open AeonFr opened 9 months ago

AeonFr commented 9 months ago

I had issues building the app. I think this might work for quick terminal UI prototyping so I wanted to try it.

First of all, a disclaimer. I'm very new to haskell. This is the first time I build a haskell program, I have no idea what cabal is or how it works. I'm very sorry if I'm missing something obvious

So I ran these commands:

brew install ghc
brew install cabal-install
git clone https://github.com/jtdaugherty/tart.git
cd tart
cabal new-build

I get an error in the last command:

Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] trying: tart-0.3 (user goal)
[__1] next goal: vty (dependency of tart)
[__1] rejecting: vty-6.2 (conflict: tart => vty>=5.17.1 && <6.0)
[__1] skipping: vty-6.1, vty-6.0 (has the same characteristics that caused the
previous version to fail: excluded by constraint '>=5.17.1 && <6.0' from
'tart')
[__1] trying: vty-5.39
[__2] trying: vector-0.13.1.0 (dependency of vty)
[__3] trying: primitive-0.9.0.0 (dependency of vector)
[__4] trying: template-haskell-2.21.0.0/installed-inplace (dependency of
primitive)
[__5] next goal: pretty (dependency of template-haskell)
[__5] rejecting: pretty-1.1.3.6/installed-inplace (conflict: vty =>
deepseq>=1.1 && <1.5, pretty => deepseq==1.5.0.0/installed-inplace)
[__5] rejecting: pretty-1.1.3.6, pretty-1.1.3.5, pretty-1.1.3.4,
pretty-1.1.3.3, pretty-1.1.3.2, pretty-1.1.3.1, pretty-1.1.2.1,
pretty-1.1.2.0, pretty-1.1.1.3, pretty-1.1.1.2, pretty-1.1.1.1,
pretty-1.1.1.0, pretty-1.1.0.0, pretty-1.0.1.2, pretty-1.0.1.1,
pretty-1.0.1.0, pretty-1.0.0.0 (conflict: template-haskell =>
pretty==1.1.3.6/installed-inplace)
[__5] fail (backjumping, conflict set: pretty, template-haskell, vty)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, primitive, vty,
template-haskell, pretty, vector, tart
Try running with --minimize-conflict-set to improve the error message.

I tried some ChatGPT suggestions (like using the --allow-newer or --minimize-conflict-set flags), but eventually still run into other kinds of issues.

I'm running this in a mac (Intel). Here is some data that might be useful:

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.8.1
$ cabal --version
cabal-install version 3.10.2.1
compiled using version 3.10.2.1 of the Cabal library

Could you provide some guidance on how to install the dependencies when getting this error? Alternatively, is it possible to have a pre-built version hosted somewhere I could download and run? (No idea if Haskell programs can be compiled and shared like that, but that would be ideal).

Thanks ❤️

pd/ sorry for my bad English, I'm not native

jtdaugherty commented 9 months ago

Run cabal update and then try the build again with cabal new-build.

AeonFr commented 9 months ago

Thanks for the fast reply @jtdaugherty ❤️

Unfortunately I still get the same error. I was checking my shell history and looks like I had already ran that command before (the first time you ran cabal new-build if you haven't run cabal update ever since installing, you are prompted to do so).

The error is still the same:

Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] trying: tart-0.3 (user goal)
[__1] next goal: vty (dependency of tart)
[__1] rejecting: vty-6.2 (conflict: tart => vty>=5.17.1 && <6.0)
[__1] skipping: vty-6.1, vty-6.0 (has the same characteristics that caused the
previous version to fail: excluded by constraint '>=5.17.1 && <6.0' from
'tart')
[__1] trying: vty-5.39
[__2] trying: vector-0.13.1.0 (dependency of vty)
[__3] trying: primitive-0.9.0.0 (dependency of vector)
[__4] trying: template-haskell-2.21.0.0/installed-inplace (dependency of
primitive)
[__5] next goal: pretty (dependency of template-haskell)
[__5] rejecting: pretty-1.1.3.6/installed-inplace (conflict: vty =>
deepseq>=1.1 && <1.5, pretty => deepseq==1.5.0.0/installed-inplace)
[__5] rejecting: pretty-1.1.3.6, pretty-1.1.3.5, pretty-1.1.3.4,
pretty-1.1.3.3, pretty-1.1.3.2, pretty-1.1.3.1, pretty-1.1.2.1,
pretty-1.1.2.0, pretty-1.1.1.3, pretty-1.1.1.2, pretty-1.1.1.1,
pretty-1.1.1.0, pretty-1.1.0.0, pretty-1.0.1.2, pretty-1.0.1.1,
pretty-1.0.1.0, pretty-1.0.0.0 (conflict: template-haskell =>
pretty==1.1.3.6/installed-inplace)
[__5] fail (backjumping, conflict set: pretty, template-haskell, vty)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, primitive, vty,
template-haskell, pretty, vector, tart
Try running with --minimize-conflict-set to improve the error message.

Is it possible some dependency has been removed from the registry? (Just a wild guess)

jtdaugherty commented 9 months ago

Have you tried a slightly older version of GHC such as 9.6.3? I'm able to build it with that version of the compiler. The compiler comes with some packages (such as template-haskell) that some dependencies of tart might not be compatible with, and that can cause dependency resolution failures like the one you're running into.

jtdaugherty commented 9 months ago

If you want to install and use multiple versions of GHC and cabal, then I recommend using ghcup rather than installing via brew.

AeonFr commented 9 months ago

Thank you 👏 changing the ghc version with ghcup fixed the issue!

However I'm still a bit confused on how to proceed..

When Irun cabal new-build the end of the output throws these warnings, and no executable is generated... 🤔

Configuring library for tart-0.3..
Preprocessing library for tart-0.3..
Building library for tart-0.3..
[1 of 6] Compiling Tart.Canvas      ( src/Tart/Canvas.hs, /Users/francisco/Projects/tart/dist-newstyle/build/x86_64-osx/ghc-9.6.3/tart-0.3/build/Tart/Canvas.o, /Users/francisco/Projects/tart/dist-newstyle/build/x86_64-osx/ghc-9.6.3/tart-0.3/build/Tart/Canvas.dyn_o )

src/Tart/Canvas.hs:30:1: warning: [-Wunused-imports]
    The import of ‘Data.Monoid’ is redundant
      except perhaps to import instances from ‘Data.Monoid’
    To import instances alone, use: import Data.Monoid()
   |
30 | import Data.Monoid ((<>))
   | ^^^^^^^^^^^^^^^^^^^^^^^^^

src/Tart/Canvas.hs:226:1: warning: [GHC-62161] [-Wincomplete-patterns]
    Pattern match(es) are non-exhaustive
    In an equation for ‘colorCode'’:
        Patterns of type ‘Bool’, ‘V.Color’ not matched:
            _ (V.RGBColor _ _ _)
    |
226 | colorCode' f (V.Color240 w) =
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

src/Tart/Canvas.hs:338:23: warning: [GHC-62161] [-Wincomplete-patterns]
    Pattern match(es) are non-exhaustive
    In a case alternative:
        Patterns of type ‘V.Color’ not matched: V.RGBColor _ _ _
    |
338 |     let (ty, color) = case c of
    |                       ^^^^^^^^^...
[2 of 6] Compiling Tart.Format.Types ( src/Tart/Format/Types.hs, /Users/francisco/Projects/tart/dist-newstyle/build/x86_64-osx/ghc-9.6.3/tart-0.3/build/Tart/Format/Types.o, /Users/francisco/Projects/tart/dist-newstyle/build/x86_64-osx/ghc-9.6.3/tart-0.3/build/Tart/Format/Types.dyn_o )
[3 of 6] Compiling Tart.Format.V0   ( src/Tart/Format/V0.hs, /Users/francisco/Projects/tart/dist-newstyle/build/x86_64-osx/ghc-9.6.3/tart-0.3/build/Tart/Format/V0.o, /Users/francisco/Projects/tart/dist-newstyle/build/x86_64-osx/ghc-9.6.3/tart-0.3/build/Tart/Format/V0.dyn_o )
[4 of 6] Compiling Tart.Format.V1   ( src/Tart/Format/V1.hs, /Users/francisco/Projects/tart/dist-newstyle/build/x86_64-osx/ghc-9.6.3/tart-0.3/build/Tart/Format/V1.o, /Users/francisco/Projects/tart/dist-newstyle/build/x86_64-osx/ghc-9.6.3/tart-0.3/build/Tart/Format/V1.dyn_o )
[5 of 6] Compiling Tart.Format.V2   ( src/Tart/Format/V2.hs, /Users/francisco/Projects/tart/dist-newstyle/build/x86_64-osx/ghc-9.6.3/tart-0.3/build/Tart/Format/V2.o, /Users/francisco/Projects/tart/dist-newstyle/build/x86_64-osx/ghc-9.6.3/tart-0.3/build/Tart/Format/V2.dyn_o )
[6 of 6] Compiling Tart.Format      ( src/Tart/Format.hs, /Users/francisco/Projects/tart/dist-newstyle/build/x86_64-osx/ghc-9.6.3/tart-0.3/build/Tart/Format.o, /Users/francisco/Projects/tart/dist-newstyle/build/x86_64-osx/ghc-9.6.3/tart-0.3/build/Tart/Format.dyn_o )

src/Tart/Format.hs:12:1: warning: [-Wunused-imports]
    The import of ‘Data.Monoid’ is redundant
      except perhaps to import instances from ‘Data.Monoid’
    To import instances alone, use: import Data.Monoid()
   |
12 | import Data.Monoid ((<>))
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
ld: warning: -single_module is obsolete

This doesn't return anything, just an empty string:

❯ find . -name tart -type f

And if I ls in the folder I get:

❯ ls -la
drwxr-xr-x    - francisco  6 Feb 11:56 .git
.rw-r--r--   36 francisco  6 Feb 11:56 .gitignore
.rw-r--r--    0 francisco  6 Feb 12:31 =
.rw-r--r--    0 francisco  6 Feb 12:31 =1.10
.rw-r--r--    0 francisco  6 Feb 12:31 =4.9
.rw-r--r-- 1.2k francisco  6 Feb 11:56 CHANGELOG.md
drwxr-xr-x    - francisco  6 Feb 12:27 dist-newstyle
.rw-r--r-- 1.5k francisco  6 Feb 11:56 LICENSE
drwxr-xr-x    - francisco  6 Feb 11:56 logo
drwxr-xr-x    - francisco  6 Feb 11:56 programs
.rw-r--r-- 5.0k francisco  6 Feb 11:56 README.md
drwxr-xr-x    - francisco  6 Feb 11:56 screenshots
.rw-r--r--   46 francisco  6 Feb 11:56 Setup.hs
drwxr-xr-x    - francisco  6 Feb 11:56 src
.rwxr-xr-x 3.3k francisco  6 Feb 11:56 tart.cabal
.rw-r--r--  994 francisco  6 Feb 11:56 TODO.md

I understand a tart executable file should be created but I don't see it ... 🤔

If I run cabal new-build again, I get this message (but still no executable)

❯ cabal new-build
Up to date
jtdaugherty commented 9 months ago

I think there's something going on with the build flags in the .cabal file. To fix it, open tart.cabal and change

executable tart
  if flag(libonly)
    Buildable: False

to

executable tart

and then run cabal new-build again.

AeonFr commented 9 months ago

Unfortunately that doesn't work either, I still get the error message.

I'd like to insist in thanking you so much for the patience to help me troubleshoot the issue. (And sorry if I'm not very quick to respond, I sometimes miss notifications in my personal gh account)

On Tue, Feb 6, 2024 at 2:46 PM Jonathan Daugherty @.***> wrote:

I think there's something going on with the build flags in the .cabal file. To fix it, open tart.cabal and change

executable tart if flag(libonly) Buildable: False

to

executable tart

and then run cabal new-build again.

— Reply to this email directly, view it on GitHub https://github.com/jtdaugherty/tart/issues/23#issuecomment-1930803668, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZS4IXCGR7FH6CLNJOPKDLYSKQBXAVCNFSM6AAAAABCX6GYUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZQHAYDGNRWHA . You are receiving this because you authored the thread.Message ID: @.***>

jtdaugherty commented 9 months ago

Happy to help. What error message are you seeing? Or do you mean that there is not a binary being produced?

AeonFr commented 9 months ago

I think the error message was exactly the same, but ai can get back to you tomorrow to paste the exact output

On Mon, 12 Feb 2024 at 18:01, Jonathan Daugherty @.***> wrote:

Happy to help. What error message are you seeing? Or do you mean that there is not a binary being produced?

— Reply to this email directly, view it on GitHub https://github.com/jtdaugherty/tart/issues/23#issuecomment-1939977987, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZS4ITGUQXI6C22KXM7XN3YTK3O5AVCNFSM6AAAAABCX6GYUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZZHE3TOOJYG4 . You are receiving this because you authored the thread.Message ID: @.***>

krakrjak commented 4 months ago

I got the same errors as the user posted. After trying several different versions I did find that using ghcup and setting ghc 9.2.8 as the default version, I was able to get a build.