commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
3.98k stars 842 forks source link

Dynamically-linked Stack binaries for Termux and other non-FHS compliant environments #6345

Closed dhuux closed 10 months ago

dhuux commented 10 months ago

i used ghcup to download cabal and stack on Termux. cabal and ghcup can do network stuff with the patched glibc for Termux since they are dynamically linked. but the stack binary is statically linked so it can't resolve DNS names because /etc/resolv.conf doesn't exist without proot in Termux.

it would be nice if we had dynamically linked Linux AArch64 binaries also.

Screenshot_20231123-193420_Termux

philderbeast commented 10 months ago

I'm looking for this option too. I see that Cabal has executable-dynamic and this is used in the clash-compiler/cabal.project, a project that I'm trying to build with stack.

package clash-benchmark
  executable-dynamic: True
philderbeast commented 10 months ago

@dhuux it is possible to build stack from source with cabal.

dhuux commented 10 months ago

how? did you used it like this --enable-executable-dynamic. i have just started my programming journey with Termux. i'm not used to building programs. hhh

mpilgrem commented 10 months ago

@dhuux, I am not a user of Cabal (the tool) or a Linux user, but if you have a working version of GHC 9.4.7 on your system, I think you can build Stack from source with Cabal (the tool) as follows:

  1. Download the Stack project's source code from GitHub and change to the project's root directory.
  2. Command cabal update to update the latest package list from Hackage.
  3. Command cabal build --with-compiler <path_to_ghc_9.4.7_executable_file>. This will take a little while to complete, because there are about 176 direct and indirect dependencies and then 183 modules, but not so very long. The last step should tell you where Cabal has put the Stack executable. It can be moved anywhere.
mpilgrem commented 10 months ago

Stack's current release process has its origins in the discussion at #2534. There are no plans to provide dynamically-linked binary distributions from this repository, but if other parts of the Haskell community wish to support what you are looking for, we would try to support them in their support.

dhuux commented 10 months ago

@mpilgrem thanks.