Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#78823 - [cabal-install] default ~/.cabal/config should be configured for dynamic libraries

Attached to Project: Arch Linux
Opened by Amras (amras0x00) - Sunday, 18 June 2023, 15:43 GMT
Last edited by Toolybird (Toolybird) - Monday, 19 June 2023, 01:42 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

The ghc package provides dynamic libraries. By default, cabal expects statically linked base libraries. This behavior can be changed as described here: https://wiki.archlinux.org/title/Haskell#Configuring_Cabal_for_dynamic_linking

When a first-time user tries to set up their environment to start learning haskell, they might try these commands, following cabal's tutorials.
pacman -S ghc cabal-install
mkdir myfirstapp
cd myfirstapp
cabal init
cabal run
This of course won't work as expected. `cabal run` will create a default ~/.cabal/config, which is configured for static libraries, then print an error: Could not find module 'Prelude'.

A savvy user might then check the arch wiki and find out that they need to use the --ghc-options=-dynamic flag, or else modify their ~/.cabal/config .
However, it would be easier for a new user if `cabal run` worked out of the box, without requiring a wiki hunt.

The following strategies should work (pending a resolution to https://github.com/haskell/cabal/issues/9040 to handle ghc-options):

Option 1: provide a ~/.cabal/config file, as follows, then call `cabal user-config update` to fill in the remaining configuration options that cabal expects.
library-vanilla: False
shared: True
executable-dynamic: True
program-default-options
ghc-options: -dynamic

Option 1 will likely clobber any existing user configurations; personally I wouldn't recommend it.

Option 2: use user-config init's --augment flag to provide a default configuration at the end of installation:
$ cabal user-config init -a "
library-vanilla: False
shared: True
executable-dynamic: True
program-default-options
ghc-options: -dynamic"

Option 2 will do nothing if a config file already exists - letting users who have a working static library config continue to use it after an update.

Option 3: use user-config's update at the end of installation:
$ cabal user-config update -a "
library-vanilla: False
shared: True
executable-dynamic: True
program-default-options
ghc-options: -dynamic"

Option 3 will overwrite the specified values, but leave the rest of the config file untouched. This might have an advantage for new users ("I updated my cabal-install and now it works!") but it might be frustrating for users of ghc-static.
This task depends upon

Closed by  Toolybird (Toolybird)
Monday, 19 June 2023, 01:42 GMT
Reason for closing:  Won't implement
Additional comments about closing:  See comments
Comment by Toolybird (Toolybird) - Monday, 19 June 2023, 01:42 GMT
Thanks for reporting, but...

> A savvy user might then check the arch wiki

Disagree. Anyone who is sensible and does *anything* on Arch should firstly read the relevant Wiki topic.

You're talking about a user's *home* dir. I'm failing to see how Arch binary pkgs can influence user dirs. It's just not in pacman's scope. I've notified the Arch Haskell maintainer just in case...but AFAICS there is nothing we can do here given how Haskell is packaged in Arch.

Loading...