How to install tidal-listener?

from https://github.com/tidalcycles/Tidal/blob/main/tidal-listener/README.md
Move to the repository directory and run cabal install.

which for me results in different kinds of failure depending on which commit of the repo i have checked out:

when i'm on branch main (currently at commit Merge pull request #1022 from exitmouse/build-fixes · tidalcycles/Tidal@077b65f · GitHub)

Error: cabal: Unknown target '.'.
There is no component '.'.
The project has no package directory '.'.

when i'm manually checking out 1406416 (which was the release of 1.9.3)

Error: cabal: Could not resolve dependencies:
[__0] next goal: tidal (user goal)
[__0] rejecting: tidal-1.9.4 (constraint from user target requires ==1.9.3)
[__0] trying: tidal-1.9.3
[__1] next goal: transformers (dependency of tidal)
[__1] rejecting: transformers-0.6.1.0/installed-0.6.1.0 (conflict: tidal =>
transformers>=0.5 && <0.6.1)
[__1] skipping: transformers-0.6.1.0 (has the same characteristics that caused
the previous version to fail: excluded by constraint '>=0.5 && <0.6.1' from
'tidal')
[__1] trying: transformers-0.6.0.6
[__2] next goal: mtl (dependency of tidal)
[__2] rejecting: mtl-2.3.1/installed-2.3.1 (conflict: transformers==0.6.0.6,
mtl => transformers==0.6.1.0/installed-0.6.1.0)
[__2] trying: mtl-2.3.1
[__3] next goal: exceptions (dependency of tidal)
[__3] rejecting: exceptions-0.10.7/installed-0.10.7 (conflict: mtl==2.3.1,
exceptions => mtl==2.3.1/installed-2.3.1)
[__3] trying: exceptions-0.10.7
[__4] trying: template-haskell-2.20.0.0/installed-2.20.0.0 (dependency of
exceptions)
[__5] trying: base-4.18.0.0/installed-4.18.0.0 (dependency of tidal)
[__6] next goal: tidal-parse (user goal)
[__6] rejecting: tidal-parse-0.0.1 (conflict: mtl==2.3.1, tidal-parse =>
mtl>=2.2.2 && <2.3)
[__6] fail (backjumping, conflict set: mtl, tidal-parse)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: mtl, tidal, template-haskell,
exceptions, transformers, tidal-parse, haskellish, base
Try running with --minimize-conflict-set to improve the error message.

when checking out 3ac3200 (release of 1.9.4):

Error: cabal: Could not resolve dependencies:
[__0] trying: tidal-1.9.4 (user goal)
[__1] next goal: tidal-listener (user goal)
[__1] rejecting: tidal-listener-0.1.0.0 (conflict: tidal==1.9.4,
tidal-listener => tidal==1.9.3)
[__1] fail (backjumping, conflict set: tidal, tidal-listener)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: tidal, tidal-listener

is there a way to build tidal-listener currently? and if yes, can i only use it with older versions of tidal?

I built it last week on branch 1.9-dev

There was only one trip up - I had to run

cabal install silently --lib

hmm, for me this results in the following output:

Error: cabal: Could not resolve dependencies:
[__0] trying: tidal-parse-0.0.1 (user goal)
[__1] trying: template-haskell-2.20.0.0/installed-2.20.0.0 (dependency of
tidal-parse)
[__2] next goal: haskellish (dependency of tidal-parse)
[__2] rejecting: haskellish-0.3.2.1 (conflict:
template-haskell==2.20.0.0/installed-2.20.0.0, haskellish =>
template-haskell>=2.10.0.0 && <2.20)
[__2] skipping: haskellish-0.3.2, haskellish-0.3.1, haskellish-0.2.4.3,
haskellish-0.2.4.2, haskellish-0.2.4.1, haskellish-0.2.4, haskellish-0.2.3.1,
haskellish-0.2.3, haskellish-0.2.2 (has the same characteristics that caused
the previous version to fail: excludes 'template-haskell' version 2.20.0.0)
[__2] rejecting: haskellish-0.2.0 (conflict: tidal-parse => haskellish>=0.3.2
&& <0.4)
[__2] skipping: haskellish-0.1.2, haskellish-0.1.1, haskellish-0.1.0 (has the
same characteristics that caused the previous version to fail: excluded by
constraint '>=0.3.2 && <0.4' from 'tidal-parse')
[__2] fail (backjumping, conflict set: haskellish, template-haskell,
tidal-parse)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: template-haskell, haskellish,
tidal-parse

i'm using cabal version 3.10.1.0 and ghc 9.6.2 on an apple silicon mac

ok, I'm on Linux and using old ghc (8.8.4) - it looks like you have some gnarly circular dependencies happening there though.

To confirm, are you using this repo:

  • on the 1.9-dev branch, and
  • running cabal install from the tidal-listener subdirectory?

yes, yes and yes :smile:

i'm kind of tempted to try downgrading ghc but i'm pretty sure it's gonna break my tidal install... any other idea what could work?

I don't really know how to wrangle cabal very well.

Looking a bit closer, the issue seems to be the template-haskell=2.20, and haskellish wants a version < 2.20
maybe something to try is forcing an older version of the template-haskell package, or it looks like you can set a constraint - maybe this will work?

cabal install --constraint 'template-haskell < 2.20'

or maybe you can manually install and force the version

cabal install template-haskell-2.10 --lib

(I have no idea if these commands/versions are correct/will run - just clutching at straws)

downgrading might be an option, but since you don't actually need tidal-parse you can just remove it from the cabal.project file:

i've tried downgrading, but cabal has no concept of downgrading. it also has no concept of removing packages, so after consulting stackoverflow i tried removing template-haskell with ghc-pkg, hoping to be able to reinstall it with another version.
while ghc-pkg did remove template-haskell, cabal wasn't acknowledging this fact. so tidal stopped working but cabal refused to install any version of template-haskell.

thus i deleted everything haskell-related from my system (via Uninstall Haskell from Mac OS X · GitHub) and ran the install script again.
tidal is still broken :confused:

edit: i missed some folders (.stack and .ghcup), reinstalling properly now - fingers crossed everything works!

tried this on branch 1.9-dev and it didn't help, still getting this output:

[__0] trying: tidal-1.9.4 (user goal)
[__1] trying: primitive-0.8.0.0 (dependency of tidal)
[__2] next goal: template-haskell (dependency of primitive)
[__2] rejecting: template-haskell-2.20.0.0, template-haskell-2.19.0.0,
template-haskell-2.18.0.0, template-haskell-2.17.0.0,
template-haskell-2.16.0.0, template-haskell-2.15.0.0,
template-haskell-2.14.0.0, template-haskell-2.13.0.0,
template-haskell-2.12.0.0, template-haskell-2.11.1.0,
template-haskell-2.11.0.0 (only already installed instances can be used)
[__2] rejecting: template-haskell-2.10.0.0 (conflict: primitive =>
template-haskell>=2.11)
[__2] skipping: template-haskell-2.9.0.0, template-haskell-2.8.0.0,
template-haskell-2.7.0.0, template-haskell-2.6.0.0, template-haskell-2.5.0.0,
template-haskell-2.4.0.1, template-haskell-2.4.0.0, template-haskell-2.3.0.1,
template-haskell-2.3.0.0, template-haskell-2.2.0.0 (has the same
characteristics that caused the previous version to fail: excluded by
constraint '>=2.11' from 'primitive')
[__2] fail (backjumping, conflict set: primitive, template-haskell)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, tidal, template-haskell,
primitive
Try running with --minimize-conflict-set to improve the error message.

edit2: after a clean reinstall of everything haskell-related and removing tidal-parse from cabal.project i'm getting this instead:

Failed to build tidal-listener-0.1.0.0.
Build log (
/Users/robin/.cache/cabal/logs/ghc-9.6.2/tdl-lstnr-0.1.0.0-5b578e0b.log ):
Configuring library for tidal-listener-0.1.0.0..
Preprocessing library for tidal-listener-0.1.0.0..
Building library for tidal-listener-0.1.0.0..

when making flags consistent: warning:
    -dynamic-too is ignored when using -dynamic
[1 of 5] Compiling Sound.Tidal.Listener.Config ( src/Sound/Tidal/Listener/Config.hs, dist/build/Sound/Tidal/Listener/Config.o )
[2 of 5] Compiling Sound.Tidal.Listener.Command ( src/Sound/Tidal/Listener/Command.hs, dist/build/Sound/Tidal/Listener/Command.o )
[3 of 5] Compiling Sound.Tidal.Listener.Parse ( src/Sound/Tidal/Listener/Parse.hs, dist/build/Sound/Tidal/Listener/Parse.o )
[4 of 5] Compiling Sound.Tidal.Hint ( src/Sound/Tidal/Hint.hs, dist/build/Sound/Tidal/Hint.o )
[5 of 5] Compiling Sound.Tidal.Listener ( src/Sound/Tidal/Listener.hs, dist/build/Sound/Tidal/Listener.o )

src/Sound/Tidal/Listener.hs:41:17: warning: [GHC-62161] [-Wincomplete-uni-patterns]
    Pattern match(es) are non-exhaustive
    In a pattern binding:
        Patterns of type ‘N.SockAddr’ not matched:
            N.SockAddrInet6 _ _ _ _
            N.SockAddrUnix _
   |
41 |             let (N.SockAddrInet _ a) = N.addrAddress remote_addr
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
clang: error: no such file or directory: 'dist/build/Sound/Tidal/Listener.dyn_o'
clang: error: no such file or directory: 'dist/build/Sound/Tidal/Listener/Config.dyn_o'
clang: error: no such file or directory: 'dist/build/Sound/Tidal/Listener/Parse.dyn_o'
clang: error: no such file or directory: 'dist/build/Sound/Tidal/Listener/Command.dyn_o'
clang: error: no such file or directory: 'dist/build/Sound/Tidal/Hint.dyn_o'
`gcc' failed in phase `Linker'. (Exit code: 1)
Error: cabal: Failed to build tidal-listener-0.1.0.0 (which is required by
exe:tidal-listener from tidal-listener-0.1.0.0). See the build log above for
details.