# main/Main.hs: tidal cycles as a static binary

**URL:** <https://uzu.lurk.org/t/main-main-hs-tidal-cycles-as-a-static-binary/5987>\
**Category:** TidalCycles\
**Tags:** innards\
**Created:** [2 November 2025 18:30 UTC](https://uzu.lurk.org/t/main-main-hs-tidal-cycles-as-a-static-binary/5987 "2025-11-02T18:30:41Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ludens](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ludens/32/3028_2.png) [@ludens](https://uzu.lurk.org/u/ludens)\
**Post date:** [2 November 2025 18:30 UTC](https://uzu.lurk.org/t/main-main-hs-tidal-cycles-as-a-static-binary/5987/1 "2025-11-02T18:30:41Z")

</div>

I am on a new computer again and was going to go through the install process for tidal, and I became curious again about the possibility of having a simple static binary for tidal cycles.

I was poking around the source code and found [`main/Main.hs`](https://codeberg.org/uzu/tidal/src/branch/main/main/Main.hs), which appears to set up a haskell interpereter set up to run tidal cycles. However, it doesn't appear to have an entry in `tidal.cabal` or have its own `.cabal` file. I tried adding a section for it and running `cabal build`:

```haskell
executable tidal
  main-is: main/Main.hs
  Build-depends:
      base >=4.8 && <5
    , tidal <=1.10.1
    , hint >0.9
    , exceptions < 0.11

```

The values there are sort-a guesses as it has been years since I've messed with `cabal`.  
This successfully compiled and built an executable `tidal` that I could run, but I wasn't able to get code to work:

```txt
[TidalCycles version 1.10.1]
Installed in /home/ludens/.cabal/share/x86_64-linux-ghc-9.6.6/tidal-1.10.1
Listening for external controls on 127.0.0.1:6010
[tidal] starting...

[tidal] modules loaded...

[tidal] ready

Waiting for SuperDirt (v.1.7.2 or higher)..
Connected to SuperDirt.
sound "bd"
type : ControlPattern

value: (pure s: "bd")

d1 $ sound "bd"
tidal: /home/ludens/Code/tidal/dist-newstyle/build/x86_64-linux/ghc-9.6.6/tidal-link-1.2.0/build/libHStidal-link-1.2.0-inplace.a: unknown symbol `_ZGVZN16link_asio_1_28_015system_categoryEvE8instance'
tidal: /home/ludens/Code/tidal/dist-newstyle/build/x86_64-linux/ghc-9.6.6/tidal-link-1.2.0/build/libHStidal-link-1.2.0-inplace.a: unknown symbol `abl_link_time_at_beat'
tidal: /home/ludens/Code/tidal/dist-newstyle/build/x86_64-linux/ghc-9.6.6/tidal-1.10.1/build/libHStidal-1.10.1-inplace.a: unknown symbol `tidalzmlinkzm1zi2zi0zminplace_SoundziTidalziClock_SetNudge_con_info'
tidal: /home/ludens/Code/tidal/dist-newstyle/build/x86_64-linux/ghc-9.6.6/tidal-1.10.1/build/libHStidal-1.10.1-inplace.a: unknown symbol `tidalzm1zi10zi1zminplace_SoundziTidalziStreamziUI_streamList1_closure'
tidal: /home/ludens/Code/tidal/dist-newstyle/build/x86_64-linux/ghc-9.6.6/tidal-1.10.1/build/libHStidal-1.10.1-inplace.a: unknown symbol `tidalzm1zi10zi1zminplace_SoundziTidalziSafeziContext_streamReplace1_closure'
tidal: ^^ Could not load 'tidalzm1zi10zi1zminplace_SoundziTidalziSafeziBoot_d1_closure', dependency unresolved. See top entry above.

GhcException

GHC.ByteCode.Linker.lookupCE
During interactive linking, GHCi couldn't find the following symbol:
  tidalzm1zi10zi1zminplace_SoundziTidalziSafeziBoot_d1_closure
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session. Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please report this as a GHC bug:
  https://www.haskell.org/ghc/reportabug

```

I get the feeling this could be fixed with some changes to the `executable` section, or perhaps [`main/Main.hs`](https://codeberg.org/uzu/tidal/src/branch/main/main/Main.hs) just needs some attention, but this makes me wonder.

What's the story behind the [`main/Main.hs`](https://codeberg.org/uzu/tidal/src/branch/main/main/Main.hs) file? Would this make it feasible to make a `tidal` binary and put it on the release page, maybe even package it?

* * *

Edit: I was on the latest commit of main, `d5fb53eca2c699c11d8d31a6a6aa50da6bba5aa7`. Going to try a tagged release.

---

<div class="post-metadata">

**Author:** ![polymorphic.engine](https://uzu.lurk.org/user_avatar/uzu.lurk.org/polymorphic.engine/32/30_2.png) [@polymorphic.engine](https://uzu.lurk.org/u/polymorphic.engine)\
**Post date:** [3 November 2025 08:43 UTC](https://uzu.lurk.org/t/main-main-hs-tidal-cycles-as-a-static-binary/5987/2 "2025-11-03T08:43:55Z")

</div>

hey, so i’ve spent 3 months in 2022 to try and package tidal into a static binary as part of the google summer of code. i had it working with a version of tidal that didn’t have ableton link support yet (but it’s still very tricky since hint needs to be basically “packaged manually” by copying a lot of the files from the cabal store to a location the executable knows about).

but since tidal-link i wasn’t able to fix this approach.. you can read through this issue here:

> <https://github.com/haskell-hint/hint/issues/156>
>
> Hello, 
> some days ago \[tidal\](https://github.com/tidalcycles/Tidal) was updated… to have \[link support\](https://github.com/tidalcycles/Tidal/issues/660), this is done by the following package https://hackage.haskell.org/package/tidal-link.
> 
> unfortunately this seems to break running tidal inside a hint interpreter. Here is a minimal example:
> 
> \`\`\`
> module Main where
> 
> import Language.Haskell.Interpreter
> 
> main :: IO ()
> main = do
> x \<- runInterpreter interpreter
> case x of
> Left e -\> putStrLn (show e)
> Right \_ -\> return ()
> 
> interpreter :: Interpreter ()
> interpreter = do
> setImportsF \[ModuleImport "Sound.Tidal.Context" NotQualified NoImportList, ModuleImport "Prelude" NotQualified NoImportList\]
> runStmt "tidal \<- startTidal (superdirtTarget {oLatency = 0.1, oAddress = \\"127.0.0.1\\", oPort = 57120}) (defaultConfig {cVerbose = True, cFrameTimespan = 1/20})"
> \`\`\`
> 
> it throws the following errors:
> 
> \`\`\`
> hint-try: /home/martin/.cabal/store/ghc-9.2.3/tidal-link-1.0.1-e904e203bf8f1a5046be19d3e454931fcff763f9b9920cad70d59e090bc3569f/lib/libHStidal-link-1.0.1-e904e203bf8f1a5046be19d3e454931fcff763f9b9920cad70d59e090bc3569f.a: ELF TLSGD relocation for symbol \`\_ZN4asio6detail15keyword\_tss\_ptrINS0\_10call\_stackINS0\_14thread\_contextENS0\_16thread\_info\_baseEE7contextEE6value\_E' not supported on the target platform
> hint-try: /home/martin/.cabal/store/ghc-9.2.3/tidal-1.9.2-54c2e1be48d3c91b38aa9169eaa072a94363b15bbbc85dac3185686222ca970e/lib/libHStidal-1.9.2-54c2e1be48d3c91b38aa9169eaa072a94363b15bbbc85dac3185686222ca970e.a: unknown symbol \`abl\_link\_create\_session\_state'
> hint-try: ^^ Could not load 'tidalzm1zi9zi2zm54c2e1be48d3c91b38aa9169eaa072a94363b15bbbc85dac3185686222ca970e\_SoundziTidalziStream\_Target\_con\_info', dependency unresolved. See top entry above.
> 
> hint-try: ^^ Could not load 'tidalzm1zi9zi2zm54c2e1be48d3c91b38aa9169eaa072a94363b15bbbc85dac3185686222ca970e\_SoundziTidalziStream\_Target\_static\_info', dependency unresolved. See top entry above.
> 
> GhcException "\\nGHC.ByteCode.Linker.lookupIE\\nDuring interactive linking, GHCi couldn't find the following symbol:\\n tidalzm1zi9zi2zm54c2e1be48d3c91b38aa9169eaa072a94363b15bbbc85dac3185686222ca970e\_SoundziTidalziStream\_Target\_con\_info or tidalzm1zi9zi2zm54c2e1be48d3c91b38aa9169eaa072a94363b15bbbc85dac3185686222ca970e\_SoundziTidalziStream\_Target\_static\_info\\nThis may be due to you not asking GHCi to load extra object files,\\narchives or DLLs needed by your current session. Restart GHCi, specifying\\nthe missing library using the -L/path/to/object/dir and -lmissinglibname\\nflags, or simply by naming the relevant files on the GHCi command line.\\nAlternatively, this link failure might indicate a bug in GHCi.\\nIf you suspect the latter, please report this as a GHC bug:\\n https://www.haskell.org/ghc/reportabug\\n"
> \`\`\`
> note that running the same line of code in a ghci session works fine.
> i'm really lost here, so i hope someone can help!

it would be amazing to get this to work but i fear it might be more work than you expected.. i’m happy to answer any questions but can’t commit to working on this much unfortunately

---

<div class="post-metadata">

**Author:** ![ludens](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ludens/32/3028_2.png) [@ludens](https://uzu.lurk.org/u/ludens)\
**Post date:** [3 November 2025 13:53 UTC](https://uzu.lurk.org/t/main-main-hs-tidal-cycles-as-a-static-binary/5987/3 "2025-11-03T13:53:04Z")

</div>

Wild idea: since we can get ghc/cabal to produce a `.o` file, I wonder if it makes sense to jump directly to using the GHC c api via C++ or another language and circumvent some of ghc's linking weirdness. I will do some research and see if it is possible to statically link ghc via C bindings, and what we would actually have to do in order to get it to find haskell symbols.

---

<div class="post-metadata">

**Author:** ![jwaldmann](https://uzu.lurk.org/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jwaldmann](https://uzu.lurk.org/u/jwaldmann)\
**Post date:** [3 November 2025 14:31 UTC](https://uzu.lurk.org/t/main-main-hs-tidal-cycles-as-a-static-binary/5987/4 "2025-11-03T14:31:45Z")

</div>

It's been a while since I touched this code. I will have a look again.

Still, I don't think one would magically get a fully self-contained executable here: `hint` will do some kind of compilation, so it needs to read libraries (.hi files, .o files) from disk, these need to be installed in proper places (so `ghc-pkg` or equivalent finds them).

perhaps microhs is another option (of avoiding GHC altogether) [https://hackage.haskell.org/package/MicroHs](https://hackage.haskell.org/package/MicroHs) ...

---

<div class="post-metadata">

**Author:** ![ludens](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ludens/32/3028_2.png) [@ludens](https://uzu.lurk.org/u/ludens)\
**Post date:** [4 November 2025 11:45 UTC](https://uzu.lurk.org/t/main-main-hs-tidal-cycles-as-a-static-binary/5987/5 "2025-11-04T11:45:13Z")

</div>

The linking issues appear to be related specifically to tidal functions. Ideally, these would be statically available to the ghc environment, so if a user only uses tidal functions in a particular `.hs` file, they wouldn't need any extra infrastructure. If they used external libraries, all bets are off.

* * *

## Links

Also, I have been doing some research

- [Linking Haskell with C: The Wrong Way - Komali.dev](https://komali.dev/blogs/haskell/)  
A guide on how to build Haskell code into a `.o` file and then link that into  
a C program, but without using GHC to also compile the c code.
- [Static linking with ghc](https://ro-che.info/articles/2015-10-26-static-linking-ghc)  
A guide to static linking with GHC. See also:  
[Haskell library in a C project](https://ro-che.info/articles/2017-07-26-haskell-library-in-c-project),  
A more in-depth guide explaining how to compile haskell libraries into  
`.a` or `.so` files.
- [Getting your Haskell executable statically linked without Nix · Hasufell's blog](https://hasufell.github.io/posts/2024-04-21-static-linking.html)  
A guide to statically linking a haskell executable, using docker and alpine  
linux. The trick is the need to statically link with `musl` libc, which  
apline and void linux both use. However, this also means either finding a  
way to build all dependencies from source, or relying upon the alpine package  
ecosystem to have the necessary packages. Thankfull, I think the ones required  
by tidal cycles are either built from source already, or are more-or-less the  
default ones that haskell requires, so likely to have them available.

---

<div class="post-metadata">

**Author:** ![jwaldmann](https://uzu.lurk.org/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jwaldmann](https://uzu.lurk.org/u/jwaldmann)\
**Post date:** [4 November 2025 12:08 UTC](https://uzu.lurk.org/t/main-main-hs-tidal-cycles-as-a-static-binary/5987/6 "2025-11-04T12:08:04Z")

</div>

Huh. I get a working `main/Main.hs` with this stanza in tidal.cabal

```haskell
executable tidal-main
  main-is: main/Main.hs
  build-depends: base, tidal, hint, exceptions
  ghc-options: -dynamic

```

(note the last line)

```haskell
$ cabal --version
cabal-install version 3.14.2.0
compiled using version 3.14.2.0 of the Cabal library 
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.12.2
$ uname -morps
Linux 6.17.6-300.fc43.x86_64 x86_64 unknown GNU/Linux

```

---

<div class="post-metadata">

**Author:** ![ludens](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ludens/32/3028_2.png) [@ludens](https://uzu.lurk.org/u/ludens)\
**Post date:** [4 November 2025 12:18 UTC](https://uzu.lurk.org/t/main-main-hs-tidal-cycles-as-a-static-binary/5987/7 "2025-11-04T12:18:12Z")

</div>

To be clear, if you run the executable and evaluate `d1 $ sound "bd"`, you don't get these runtime issues?

```haskell
tidal: /home/ludens/Code/tidal/dist-newstyle/build/x86_64-linux/ghc-9.6.6/tidal-link-1.2.0/build/libHStidal-link-1.2.0-inplace.a: unknown symbol `_ZGVZN16link_asio_1_28_015system_categoryEvE8instance'
tidal: /home/ludens/Code/tidal/dist-newstyle/build/x86_64-linux/ghc-9.6.6/tidal-link-1.2.0/build/libHStidal-link-1.2.0-inplace.a: unknown symbol `abl_link_time_at_beat'
tidal: /home/ludens/Code/tidal/dist-newstyle/build/x86_64-linux/ghc-9.6.6/tidal-1.10.1/build/libHStidal-1.10.1-inplace.a: unknown symbol `tidalzmlinkzm1zi2zi0zminplace_SoundziTidalziClock_SetNudge_con_info'
tidal: /home/ludens/Code/tidal/dist-newstyle/build/x86_64-linux/ghc-9.6.6/tidal-1.10.1/build/libHStidal-1.10.1-inplace.a: unknown symbol `tidalzm1zi10zi1zminplace_SoundziTidalziStreamziUI_streamList1_closure'
tidal: /home/ludens/Code/tidal/dist-newstyle/build/x86_64-linux/ghc-9.6.6/tidal-1.10.1/build/libHStidal-1.10.1-inplace.a: unknown symbol `tidalzm1zi10zi1zminplace_SoundziTidalziSafeziContext_streamReplace1_closure'
tidal: ^^ Could not load 'tidalzm1zi10zi1zminplace_SoundziTidalziSafeziBoot_d1_closure', dependency unresolved. See top entry above.

```

What happens if you run `ld` against the resulting binary?

---

<div class="post-metadata">

**Author:** ![jwaldmann](https://uzu.lurk.org/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jwaldmann](https://uzu.lurk.org/u/jwaldmann)\
**Post date:** [4 November 2025 12:35 UTC](https://uzu.lurk.org/t/main-main-hs-tidal-cycles-as-a-static-binary/5987/8 "2025-11-04T12:35:29Z")

</div>

yes. no errors, `d1 $ s "bd"` works (`sclang` plays the sound)

at least when running from the directory where I also have the sources. From elsewhere - segfaults? Need to investigate more.

```haskell
$ ldd $(which tidal-main)
	linux-vdso.so.1 (0x00007f7d7bb16000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f7d7b9e9000)
	libHStidal-1.10.1-8bf46569f550553b875f2755a6911948c937e7bbe265b7cbb1234bba37afe870-ghc9.12.2.so => /home/waldmann/.cabal/store/ghc-9.12.2-inplace/tidal-1.10.1-8bf46569f550553b875f2755a6911948c937e7bbe265b7cbb1234bba37afe870/lib/libHStidal-1.10.1-8bf46569f550553b875f2755a6911948c937e7bbe265b7cbb1234bba37afe870-ghc9.12.2.so (0x00007f7d7b91c000)
	libHStidal-link-1.2.0-d0c803dd7b6a59c0322fa72d8ddbf35f83658556957b93a166e517d0cf843baa-ghc9.12.2.so => /home/waldmann/.cabal/store/ghc-9.12.2-inplace/tidal-link-1.2.0-d0c803dd7b6a59c0322fa72d8ddbf35f83658556957b93a166e517d0cf843baa/lib/libHStidal-link-1.2.0-d0c803dd7b6a59c0322fa72d8ddbf35f83658556957b93a166e517d0cf843baa-ghc9.12.2.so (0x00007f7d7b889000)
	libHStidal-core-1.10.1-c4ca804d6c52aabd0ee4ba347b9056cef069651fb3313fc5d272c1e3634eb5d4-ghc9.12.2.so => /home/waldmann/.cabal/store/ghc-9.12.2-inplace/tidal-core-1.10.1-c4ca804d6c52aabd0ee4ba347b9056cef069651fb3313fc5d272c1e3634eb5d4/lib/libHStidal-core-1.10.1-c4ca804d6c52aabd0ee4ba347b9056cef069651fb3313fc5d272c1e3634eb5d4-ghc9.12.2.so (0x00007f7d7b200000)
	libHSprimitive-0.9.1.0-0ce4b288752dfe939ba8e56dd3883f95e97513f6875f64317140edecafe8468c-ghc9.12.2.so => /home/waldmann/.cabal/store/ghc-9.12.2-inplace/primitive-0.9.1.0-0ce4b288752dfe939ba8e56dd3883f95e97513f6875f64317140edecafe8468c/lib/libHSprimitive-0.9.1.0-0ce4b288752dfe939ba8e56dd3883f95e97513f6875f64317140edecafe8468c-ghc9.12.2.so (0x00007f7d7b118000)
	libHShosc-0.21.1-25a4e78d73c5792d5a92472bed3387f5c069f723d4d84f4f8ea4ac15febdecdd-ghc9.12.2.so => /home/waldmann/.cabal/store/ghc-9.12.2-inplace/hosc-0.21.1-25a4e78d73c5792d5a92472bed3387f5c069f723d4d84f4f8ea4ac15febdecdd/lib/libHShosc-0.21.1-25a4e78d73c5792d5a92472bed3387f5c069f723d4d84f4f8ea4ac15febdecdd-ghc9.12.2.so (0x00007f7d7b030000)
	libHSsafe-0.3.21-d78d968011b0a75ef53f7a9d5357722269597d499de0a5f99fcf7a7d1574eaa9-ghc9.12.2.so => /home/waldmann/.cabal/store/ghc-9.12.2-inplace/safe-0.3.21-d78d968011b0a75ef53f7a9d5357722269597d499de0a5f99fcf7a7d1574eaa9/lib/libHSsafe-0.3.21-d78d968011b0a75ef53f7a9d5357722269597d499de0a5f99fcf7a7d1574eaa9-ghc9.12.2.so (0x00007f7d7b852000)
	libHSparsec-3.1.18.0-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSparsec-3.1.18.0-inplace-ghc9.12.2.so (0x00007f7d7af11000)
	libHSnetwork-3.2.8.0-8ae81abe235041467e0e1c1e825f58ee57618c8d1fad5e66d80e5c979b705a0e-ghc9.12.2.so => /home/waldmann/.cabal/store/ghc-9.12.2-inplace/network-3.2.8.0-8ae81abe235041467e0e1c1e825f58ee57618c8d1fad5e66d80e5c979b705a0e/lib/libHSnetwork-3.2.8.0-8ae81abe235041467e0e1c1e825f58ee57618c8d1fad5e66d80e5c979b705a0e-ghc9.12.2.so (0x00007f7d7adfe000)
	libHSblaze-builder-0.4.4.1-d2fb71af312adbe4fda32a9246e08c6ead07dcd30401de7deaa931419c974694-ghc9.12.2.so => /home/waldmann/.cabal/store/ghc-9.12.2-inplace/blaze-builder-0.4.4.1-d2fb71af312adbe4fda32a9246e08c6ead07dcd30401de7deaa931419c974694/lib/libHSblaze-builder-0.4.4.1-d2fb71af312adbe4fda32a9246e08c6ead07dcd30401de7deaa931419c974694-ghc9.12.2.so (0x00007f7d7b824000)
	libHStext-2.1.2-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHStext-2.1.2-inplace-ghc9.12.2.so (0x00007f7d7aa00000)
	libHScolour-2.3.6-96f30cfe902cbddd6bd03e5a10693686d3f2b33f456908e84e585e88ec2d26f1-ghc9.12.2.so => /home/waldmann/.cabal/store/ghc-9.12.2-inplace/colour-2.3.6-96f30cfe902cbddd6bd03e5a10693686d3f2b33f456908e84e585e88ec2d26f1/lib/libHScolour-2.3.6-96f30cfe902cbddd6bd03e5a10693686d3f2b33f456908e84e585e88ec2d26f1-ghc9.12.2.so (0x00007f7d7ad5e000)
	libHSclock-0.8.4-37862fe9d005f86096056f41b166000b04d6e7cb09d7ddc78969a50366e83c1c-ghc9.12.2.so => /home/waldmann/.cabal/store/ghc-9.12.2-inplace/clock-0.8.4-37862fe9d005f86096056f41b166000b04d6e7cb09d7ddc78969a50366e83c1c/lib/libHSclock-0.8.4-37862fe9d005f86096056f41b166000b04d6e7cb09d7ddc78969a50366e83c1c-ghc9.12.2.so (0x00007f7d7ad22000)
	libHShint-0.9.0.8-1ec60391af64ed0b3f299ce0ec3ed61087877692fa342ca83b6115935e85bbbf-ghc9.12.2.so => /home/waldmann/.cabal/store/ghc-9.12.2-inplace/hint-0.9.0.8-1ec60391af64ed0b3f299ce0ec3ed61087877692fa342ca83b6115935e85bbbf/lib/libHShint-0.9.0.8-1ec60391af64ed0b3f299ce0ec3ed61087877692fa342ca83b6115935e85bbbf-ghc9.12.2.so (0x00007f7d7a8ba000)
	libHStemporary-1.3-11748f1e77ac7b05f566569a0606f421fbdf5c73e7f9253cdd843744555aaef3-ghc9.12.2.so => /home/waldmann/.cabal/store/ghc-9.12.2-inplace/temporary-1.3-11748f1e77ac7b05f566569a0606f421fbdf5c73e7f9253cdd843744555aaef3/lib/libHStemporary-1.3-11748f1e77ac7b05f566569a0606f421fbdf5c73e7f9253cdd843744555aaef3-ghc9.12.2.so (0x00007f7d7b815000)
	libHSrandom-1.3.1-fa364c627c26292b4af74dc458156ba07b0ee4eea34be850d55cd00aaa22c6b5-ghc9.12.2.so => /home/waldmann/.cabal/store/ghc-9.12.2-inplace/random-1.3.1-fa364c627c26292b4af74dc458156ba07b0ee4eea34be850d55cd00aaa22c6b5/lib/libHSrandom-1.3.1-fa364c627c26292b4af74dc458156ba07b0ee4eea34be850d55cd00aaa22c6b5-ghc9.12.2.so (0x00007f7d7a77e000)
	libHSsplitmix-0.1.3.1-3ba5204f9556e24c34ea3e2d8faca68cc80cd70be55efddf7678c183a87c7900-ghc9.12.2.so => /home/waldmann/.cabal/store/ghc-9.12.2-inplace/splitmix-0.1.3.1-3ba5204f9556e24c34ea3e2d8faca68cc80cd70be55efddf7678c183a87c7900/lib/libHSsplitmix-0.1.3.1-3ba5204f9556e24c34ea3e2d8faca68cc80cd70be55efddf7678c183a87c7900-ghc9.12.2.so (0x00007f7d7b7f7000)
	libHSghc-paths-0.1.0.12-bf2d1bf1292718395a62e95ad58984f4996bc8c926999b8777d5f4283f279934-ghc9.12.2.so => /home/waldmann/.cabal/store/ghc-9.12.2-inplace/ghc-paths-0.1.0.12-bf2d1bf1292718395a62e95ad58984f4996bc8c926999b8777d5f4283f279934/lib/libHSghc-paths-0.1.0.12-bf2d1bf1292718395a62e95ad58984f4996bc8c926999b8777d5f4283f279934-ghc9.12.2.so (0x00007f7d7b7f3000)
	libHSghc-9.12.2-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSghc-9.12.2-inplace-ghc9.12.2.so (0x00007f7d73200000)
	libHSsemaphore-compat-1.0.0-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSsemaphore-compat-1.0.0-inplace-ghc9.12.2.so (0x00007f7d7ad14000)
	libHSprocess-1.6.25.0-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSprocess-1.6.25.0-inplace-ghc9.12.2.so (0x00007f7d7a731000)
	libHShpc-0.7.0.2-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHShpc-0.7.0.2-inplace-ghc9.12.2.so (0x00007f7d7acdc000)
	libHSghci-9.12.2-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSghci-9.12.2-inplace-ghc9.12.2.so (0x00007f7d72e00000)
	libHSghc-heap-9.12.2-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSghc-heap-9.12.2-inplace-ghc9.12.2.so (0x00007f7d7312d000)
	libHSghc-boot-9.12.2-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSghc-boot-9.12.2-inplace-ghc9.12.2.so (0x00007f7d72d4c000)
	libHSghc-platform-0.1.0.0-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSghc-platform-0.1.0.0-inplace-ghc9.12.2.so (0x00007f7d730fa000)
	libHSbinary-0.8.9.3-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSbinary-0.8.9.3-inplace-ghc9.12.2.so (0x00007f7d72c79000)
	libHSdirectory-1.3.9.0-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSdirectory-1.3.9.0-inplace-ghc9.12.2.so (0x00007f7d72bef000)
	libHSfile-io-0.1.5-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSfile-io-0.1.5-inplace-ghc9.12.2.so (0x00007f7d730dd000)
	libHSunix-2.8.6.0-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSunix-2.8.6.0-inplace-ghc9.12.2.so (0x00007f7d72a8a000)
	libHStime-1.14-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHStime-1.14-inplace-ghc9.12.2.so (0x00007f7d728dd000)
	libHSfilepath-1.5.4.0-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSfilepath-1.5.4.0-inplace-ghc9.12.2.so (0x00007f7d72866000)
	libHSos-string-2.0.7-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSos-string-2.0.7-inplace-ghc9.12.2.so (0x00007f7d727e2000)
	libHSbytestring-0.12.2.0-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSbytestring-0.12.2.0-inplace-ghc9.12.2.so (0x00007f7d72668000)
	libHScontainers-0.7-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHScontainers-0.7-inplace-ghc9.12.2.so (0x00007f7d72200000)
	libHSexceptions-0.10.9-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSexceptions-0.10.9-inplace-ghc9.12.2.so (0x00007f7d72620000)
	libHStemplate-haskell-2.23.0.0-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHStemplate-haskell-2.23.0.0-inplace-ghc9.12.2.so (0x00007f7d725ed000)
	libHSghc-boot-th-9.12.2-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSghc-boot-th-9.12.2-inplace-ghc9.12.2.so (0x00007f7d72162000)
	libHSpretty-1.1.3.6-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSpretty-1.1.3.6-inplace-ghc9.12.2.so (0x00007f7d720f1000)
	libHSdeepseq-1.5.1.0-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSdeepseq-1.5.1.0-inplace-ghc9.12.2.so (0x00007f7d725c9000)
	libHSstm-2.5.3.1-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSstm-2.5.3.1-inplace-ghc9.12.2.so (0x00007f7d725a4000)
	libHSarray-0.5.8.0-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSarray-0.5.8.0-inplace-ghc9.12.2.so (0x00007f7d72063000)
	libHSmtl-2.3.1-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSmtl-2.3.1-inplace-ghc9.12.2.so (0x00007f7d7200e000)
	libHStransformers-0.6.1.2-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHStransformers-0.6.1.2-inplace-ghc9.12.2.so (0x00007f7d71eec000)
	libHSbase-4.21.0.0-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSbase-4.21.0.0-inplace-ghc9.12.2.so (0x00007f7d71c00000)
	libHSghc-internal-9.1202.0-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSghc-internal-9.1202.0-inplace-ghc9.12.2.so (0x00007f7d70c00000)
	libHSghc-bignum-1.3-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSghc-bignum-1.3-inplace-ghc9.12.2.so (0x00007f7d71e98000)
	libHSghc-prim-0.13.0-inplace-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSghc-prim-0.13.0-inplace-ghc9.12.2.so (0x00007f7d70800000)
	libHSrts-1.0.2-ghc9.12.2.so => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libHSrts-1.0.2-ghc9.12.2.so (0x00007f7d71b65000)
	libffi.so.8 => /opt/ghc/ghc-9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-inplace/libffi.so.8 (0x00007f7d730c9000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f7d70400000)
	libgmp.so.10 => /lib64/libgmp.so.10 (0x00007f7d71abe000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f7d7020c000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f7d7bb18000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f7d71e6c000)

```

---

<div class="post-metadata">

**Author:** ![ludens](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ludens/32/3028_2.png) [@ludens](https://uzu.lurk.org/u/ludens)\
**Post date:** [4 November 2025 13:22 UTC](https://uzu.lurk.org/t/main-main-hs-tidal-cycles-as-a-static-binary/5987/9 "2025-11-04T13:22:46Z")

</div>

If the issue in `hint` was diagnosed correctly, and if I understood it correctly, the issue without the `-dynamic` flag has to do with how the `ghc` linker finds certain C++ symbols, so it makes sense it works when using the system linker, as this is what `ghci` does according to that thread.

I think `ghc`/`cabal` have a flag to [control linking to particular libraries](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/phases.html#options-affecting-linking): `-optl-l<lib>`. Would it be possible to specify only using the [`link`](https://github.com/Ableton/link) library dynamically? `-optl-llink` or something?

My gut says this could be upstream issue that we should potentially report on [Glasgow Haskell Compiler · GitLab](http://gitlab.haskell.org/ghc/).

My guess with the segfault would be that the binary needs a few shared objects which do not exist on your path: (note that I got rid of the whole crazy hash and compiler version in the names)

- `libHStidal-1.10.1.so`
- `libHStidal-link-1.2.0.so`
- `libHStidal-core-1.10.1.so`

But we could solve this issue with a `.deb`/`.rpm` package, so it would at least be much easier to get up-and-running. Having only `libHStidal-link-1.2.0.so` (or ableton [`link`](https://github.com/Ableton/link)) be dynamic would help reduce the number of files needed as well.

---

<div class="post-metadata">

**Author:** ![jwaldmann](https://uzu.lurk.org/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jwaldmann](https://uzu.lurk.org/u/jwaldmann)\
**Post date:** [4 November 2025 13:39 UTC](https://uzu.lurk.org/t/main-main-hs-tidal-cycles-as-a-static-binary/5987/10 "2025-11-04T13:39:40Z")

</div>

> my segfaults

probably due to version mis-matches (version of source from which I built tidal-main vs. version that I had installed globally). went away after `cabal install --lib`

> .. report upstream

maybe. I have no idea. I built this Main.hs in order to replace IO with a safe shim so that (a ghci session runnig) tidal could be exposed for remote collaborative editing. That worked, but it was dynamically linked. Static linking was not the goal.

---

<div class="post-metadata">

**Author:** ![ludens](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ludens/32/3028_2.png) [@ludens](https://uzu.lurk.org/u/ludens)\
**Post date:** [4 November 2025 13:47 UTC](https://uzu.lurk.org/t/main-main-hs-tidal-cycles-as-a-static-binary/5987/11 "2025-11-04T13:47:49Z")

</div>

Ah I see, I realize now that the `main.hs` file in tidal is maybe different from what gets referenced in the [`hint`](https://github.com/haskell-hint/hint/issues/156) thread. Will try some more stuff this afternoon!

---

<div class="post-metadata">

**Author:** ![ludens](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ludens/32/3028_2.png) [@ludens](https://uzu.lurk.org/u/ludens)\
**Post date:** [6 November 2025 12:17 UTC](https://uzu.lurk.org/t/main-main-hs-tidal-cycles-as-a-static-binary/5987/12 "2025-11-06T12:17:42Z")

</div>

Cross-posting here; someone made ghci run in wasm, and I think it’s possible to load modules somehow. If we could distribute tidal this way, we could distribute a wasm blob with a vscode extension for 1-click install.

> **[Ghc now runs in your browser](https://discourse.haskell.org/t/ghc-now-runs-in-your-browser/13169/18)**
>
> it seems tidal does not make use of ghc api? in which case you could just write a small wasm frontend app that imports the tidal library and exports the haskell functions to be invoked by the frontend. there’s 15. Using the GHC WebAssembly backend...

---

<div class="post-metadata">

**Author:** ![ludens](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ludens/32/3028_2.png) [@ludens](https://uzu.lurk.org/u/ludens)\
**Post date:** [7 November 2025 13:33 UTC](https://uzu.lurk.org/t/main-main-hs-tidal-cycles-as-a-static-binary/5987/13 "2025-11-07T13:33:40Z")

</div>

I got some help from the ghc-dev mailing list, they recommended creating a package-db for tidal's packages; I think this may have been tried already when experimenting with building a hint application and deploying it to another platform.

I also thought that maybe, if I could find the right function which actually loads a haskell module, I could use template haskell to evaluate it at compile time, and thus have the module inside the application, but did not get very far as the ghc/hint libraries are a bit beyond me.
