Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from readline to haskeline #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joncol
Copy link

@joncol joncol commented Oct 9, 2024

Apparently readline doesn't build with newer versions of cabal.

@joncol joncol force-pushed the switch-from-readline-to-haskeline branch 5 times, most recently from f9e9d1b to d4bb606 Compare October 9, 2024 08:34
Apparently `readline` doesn't build with newer versions of cabal.

Also update CI configuration to make it work, see:
haskell-CI/haskell-ci#738 (comment)
@joncol joncol force-pushed the switch-from-readline-to-haskeline branch from d4bb606 to 8fabf1b Compare October 9, 2024 08:37
@joncol joncol requested a review from arybczak October 9, 2024 08:54
@arybczak
Copy link
Collaborator

arybczak commented Oct 9, 2024

How come? I can build it just fine with cabal-3.12.1.0 and GHC 9.10.1 locally 🤔 Where's the error?

@arybczak
Copy link
Collaborator

arybczak commented Oct 9, 2024

I'm necessarily opposed to the idea of replacing readline with haskeline btw, I'm just wondering what's the error you're getting though, because I'm not getting it.

@arybczak
Copy link
Collaborator

arybczak commented Oct 9, 2024

Although I see haskeline has strict dependency bounds and readline doesn't, so the latter is most likely less annoying to deal with when testing new GHC versions.

@joncol
Copy link
Author

joncol commented Oct 9, 2024

How come? I can build it just fine with cabal-3.12.1.0 and GHC 9.10.1 locally 🤔 Where's the error?

Can you also run cabal build hpqtypes-tests without problems?

I'm on:

➜ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.6.6
~/work/scrive/hpqtypes (master) ✗
➜ cabal --version
cabal-install version 3.12.1.0
compiled using version 3.12.1.0 of the Cabal library

@joncol
Copy link
Author

joncol commented Oct 9, 2024

To be clear, the full error I'm seeing is this:

➜ cabal build hpqtypes-tests
Build profile: -w ghc-9.6.6 -O1
In order, the following will be built (use -v for more details):
 - readline-1.0.3.0 (lib:readline) (requires download & build)
 - hpqtypes-1.12.0.0 (test:hpqtypes-tests) (configuration changed)
Downloading  readline-1.0.3.0
Downloaded   readline-1.0.3.0
Starting     readline-1.0.3.0 (all, legacy fallback: build-type is Configure cabal-version is less than 1.8)

Failed to build readline-1.0.3.0. The failure occurred during the configure
step.
Build log (
/home/jco/.cache/cabal/logs/ghc-9.6.6/readline-1.0.3.0-f7e7ddbf6183a73d4de473c70156ea933231f0968c5c058d277648afe74b2733.log
):
Warning: readline.cabal:27:32: version operators used. To use version
operators the package needs to specify at least 'cabal-version: >= 1.8'.
Warning: readline.cabal:9:1: Tabs used as indentation at 9:1, 10:1, 12:1,
13:1, 15:1, 16:1
Configuring readline-1.0.3.0...
checking for gcc... /nix/store/zznja5f8v3jafffyah1rk46vpfcn38dv-gcc-wrapper-13.3.0/bin/cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /nix/store/zznja5f8v3jafffyah1rk46vpfcn38dv-gcc-wrapper-13.3.0/bin/cc accepts -g... yes
checking for /nix/store/zznja5f8v3jafffyah1rk46vpfcn38dv-gcc-wrapper-13.3.0/bin/cc option to accept ISO C89... none needed
checking for GNUreadline.framework... checking for readline... no
checking for tputs in -lncurses... yes
checking for readline in -lreadline... no
checking for rl_readline_version... no
configure: error: readline not found, so this package cannot be built
See `config.log' for more details.
Error: [Cabal-7125]
Failed to build readline-1.0.3.0 (which is required by test:hpqtypes-tests from hpqtypes-1.12.0.0). See the build log above for details.

@joncol
Copy link
Author

joncol commented Oct 9, 2024

And when I try to add readline package to my system, I get the following build error:

error: builder for '/nix/store/hbjy5pw2fkg09a8w8gy0i25l736pr20x-readline-1.0.3.0-setup.drv' failed with exit code 1;
       last 15 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/fsi8nmsvz677plwqjyd7b6h084mx4bkg-readline-1.0.3.0.tar.gz
       > source root is readline-1.0.3.0
       > setting SOURCE_DATE_EPOCH to timestamp 1361098403 of file readline-1.0.3.0/readline.cabal
       > Running phase: patchPhase
       > Running phase: buildPhase
       > Compiling package Setup.hs
       > Loaded package environment from /nix/store/qlflxpz6cn4bvqx6hn6kk6mfcgph2c04-readline-1.0.3.0-setup-configFiles/ghc-environment
       > [1 of 2] Compiling Main             ( Setup.hs, Setup.o )
       >
       > Setup.hs:6:29: error: [GHC-88464]
       >     Variable not in scope: defaultUserHooks :: UserHooks
       >   |
       > 6 | main = defaultMainWithHooks defaultUserHooks
       >   |                             ^^^^^^^^^^^^^^^^
       For full logs, run 'nix log /nix/store/hbjy5pw2fkg09a8w8gy0i25l736pr20x-readline-1.0.3.0-setup.drv'.

Then I saw this: https://stackoverflow.com/a/67521967/278903

Maybe it's just an issue on my system :/.

@arybczak
Copy link
Collaborator

If you install the readline C library (or make it available in your nix-shell or something), cabal build hpqtypes-tests should successfully install readline, the Haskell package.

@joncol
Copy link
Author

joncol commented Oct 10, 2024

If you install the readline C library (or make it available in your nix-shell or something), cabal build hpqtypes-tests should successfully install readline, the Haskell package.

Installing the readline library doesn't seem to help.

Probably, it's my Nix configuration going wrong. I think the problem I'm running into is that Setup.hs of the readline-1.0.3.0 source contains the following:

main :: IO ()
main = defaultMainWithHooks defaultUserHooks

And that defaultUserHooks was apparently deprecated a long time ago, so I get a build error for it. https://hackage.haskell.org/package/Cabal-2.0.1.0/docs/src/Distribution-Simple.html has the following note:

{-# DEPRECATED defaultUserHooks
     "Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2\n             compatibility in which case you must stick with defaultUserHooks" #-}

Maybe there's some way to specify the Cabal version to use for a specific library that I don't know about.

But this is really not that important really, so feel free to close this PR. Your call :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants