Stack: How to install stack on FreeBSD 12-RELEASE?

Created on 13 Jan 2019  ·  20Comments  ·  Source: commercialhaskell/stack

I am asking here in addition to StackOverflow because the folks who understand this question might answer it better.

The actual question is "How is it recommended that I install and upgrade stack on FreeBSD 12 RELEASE?" And the second question is "How is it currently possible to install and upgrade stack on the FreeBSD 12 RELEASE?"

I have tried both the obvious ways:
1) curl ... | sh -s - -f
2) pkg install stack
And both produce severely broken setups. In particular, various things that are marked as "fixed" and "merged" in the issues indicated here on github. So maybe it's just awaiting some fix release, but FreeBSD 12 has been out for a while now.

There may be some "path" issues on FreeBSD, or other ones, still not resolved.

Anyway, how am I supposed to do this (once it is working right, if that is the limitation)?

Version: 1.7.1 is installed via 'pkg install stack'. If I then 'stack upgrade --git' everything fails, saying that for several things, .cabal cannot be found.

FreeBSD

Most helpful comment

You don't need stack --system-ghc anymore, everything should work smoothly. I also plan to add necessary bindists of ghc 8.6.5 for 12.0-RELEASE in couple of days.

This bug can be closed.

All 20 comments

I believe this is supposed to be working, in the current stable and master branches, but not yet in any release. @arrowd has been doing a lot of work on FreeBSD support and may know the precise details?

That's right, no stack release installed from pkg or curl-way are working right now. This will be fixed with next release.

For now, you can use stack with --system-ghc --no-install-ghc and lang/ghc port.

@dpreed does that help?

Thanks. I will try that, but it's not really what I want - I want the latest stack and the latest ghc, really. I appreciate arrowd's work, and if I can help with that effort I'm happy to. I've been a serious FreeBSD coder for a while now (though mostly in the kernel, but now I thought I'd do a haskell project on FreeBSD rather than where I have been doing haskell on Linux).

Great and quick response, by the way. Seems like there's an active group of FreeBSD'ers on this.

Thanks. I will try that, but it's not really what I want - I want the latest stack and the latest ghc, really.

The lang/ghc port is at version 8.6.3, as well as devel/stack is at 1.9.3. Isn't these latest versions?

I only say that you should use system GHC and not let stack download its own.

When is the next minor release?

At this point, we don't have a timeline planned. Pretty good chance we won't do another minor release before the next major release, which is under quite active development at the moment.

One more data point: I tried installing stack on FreeBSD 12.0 RELEASE using 'pkg install stack'. It hung at the "installing GHC" step. @arrowd, you're saying that running stack with the --system-ghc --no-install-ghc options will work?

Yep, it should work if you are using resolver for GHC 8.6.3.

And it is probably not hang, just taking a long time to install. There is a problem in BSD strip utility that makes installing GHC binaries very slow. However, after a while it finishes successfully.

You don't need stack --system-ghc anymore, everything should work smoothly. I also plan to add necessary bindists of ghc 8.6.5 for 12.0-RELEASE in couple of days.

This bug can be closed.

I've tried both methods of installation on a recently updated 12.0-RELEASE, and both have been unpleasant experiences...

using pkg install stack

The version of stack that gets installed is quite old (1.9.x IIRC), and the install that results is somewhat broken: stack build fails to install any dependency, as all of them seem to be lacking cabal files, which is just a problem of stack being too old IIRC? The problem was that stack upgrade then also failed, leaving me with an old stack I couldn't use, but I forgot to write down what failed during the upgrade, sorry. :/
EDIT: if this is not a known issue, LMK, I'll try to replicate.

using curl | sh

This directly installs the proper version of stack (2.1.1), but when installing GHC (ino64-8.6.5), it doesn't install haddock; all subsequent calls to stack, even stack install haddock, fail because the compiler is deemed broken. Putting empty placeholder files in the bin folder in lieu of proper binaries is enough to fool stack into doing a normal stack install

The version of stack that gets installed is quite old (1.9.x IIRC),

Not that old. Stack 2.1 was released only 10 days ago.
I already have update prepared, but it is blocked by that haddock problem you are talking later.

and the install that results is somewhat broken: stack build fails to install any dependency, as all of them seem to be lacking cabal files, which is just a problem of stack being too old IIRC?

Can you share exact error log?

This directly installs the proper version of stack (2.1.1), but when installing GHC (ino64-8.6.5), it doesn't install haddock; all subsequent calls to stack, even stack install haddock, fail because the compiler is deemed broken. Putting empty placeholder files in the bin folder in lieu of proper binaries is enough to fool stack into doing a normal stack install

This will be fixed once https://github.com/commercialhaskell/stackage-content/pull/66 is merged.

Ah, my bad, I thought it was older!

I have reinstalled 1.9 using pkg. Here's the output of a stack build:

$ /usr/local/bin/stack new test; cd test
$ /usr/local/bin/stack build
Building all executables for `test' once. After a successful build of all of them, only specified executables will be rebuilt.
test-0.1.0.0: configure (lib + exe)
Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5: No cabal file found.
Please create a package description file <pkgname>.cabal

--  While building package test-0.1.0.0 using:
/usr/home/nicuveo/.stack/setup-exe-cache/x86_64-freebsd/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5
--builddir=.stack-work/dist/x86_64-freebsd/Cabal-2.4.0.1
configure
--with-ghc=/usr/home/nicuveo/.stack/programs/x86_64-freebsd/ghc-8.6.5/bin/ghc
--with-ghc-pkg=/usr/home/nicuveo/.stack/programs/x86_64-freebsd/ghc-8.6.5/bin/ghc-pkg
--user --package-db=clear --package-db=global
--package-db=/usr/home/nicuveo/.stack/snapshots/x86_64-freebsd/lts-13.26/8.6.5/pkgdb
--package-db=/usr/home/nicuveo/src/test/.stack-work/install/x86_64-freebsd/lts-13.26/8.6.5/pkgdb
--libdir=/usr/home/nicuveo/src/test/.stack-work/install/x86_64-freebsd/lts-13.26/8.6.5/lib
--bindir=/usr/home/nicuveo/src/test/.stack-work/install/x86_64-freebsd/lts-13.26/8.6.5/bin
--datadir=/usr/home/nicuveo/src/test/.stack-work/install/x86_64-freebsd/lts-13.26/8.6.5/share
--libexecdir=/usr/home/nicuveo/src/test/.stack-work/install/x86_64-freebsd/lts-13.26/8.6.5/libexec
--sysconfdir=/usr/home/nicuveo/src/test/.stack-work/install/x86_64-freebsd/lts-13.26/8.6.5/etc
--docdir=/usr/home/nicuveo/src/test/.stack-work/install/x86_64-freebsd/lts-13.26/8.6.5/doc/test-0.1.0.0
--htmldir=/usr/home/nicuveo/src/test/.stack-work/install/x86_64-freebsd/lts-13.26/8.6.5/doc/test-0.1.0.0
--haddockdir=/usr/home/nicuveo/src/test/.stack-work/install/x86_64-freebsd/lts-13.26/8.6.5/doc/test-0.1.0.0
--dependency=base=base-4.12.0.0 --enable-tests
--enable-benchmarks
    Process exited with code: ExitFailure 1

EDIT: formatted the command line

What FreeBSD version are you running on and what GHC bindist is stack using?

12.0-RELEASE; and I'm sorry, I don't know how to check which GHC bindist stack is using. FWIW, there was no prior ghc or stack on my machine, and I ran a pkg install stack; so whichever is the default I assume?

GHC bindist version depends on resolver you are using.

Okay, then make sure you are using stack package of version 1.9.3_1. If the version is earlier than that, it means you are using quarterly packages branch instead of latest. Edit /etc/pkg/FreeBSD.conf and replace quarterly with latest, then do pkg install stack again.

Ah, yes, I am indeed using quarterly, that must be why! Okay, so for the pkg approach, either switching to latest or wait for next quarter? I went with the curl | sh approach anyway; after creating the fake haddock binaries it worked just fine.
Thanks!

This will be fixed once commercialhaskell/stackage-content#66 is merged.

That seems done now.

I've just tried with stack 2.1.1, resolver: lts-13.27 (thus GHC 8.6.5) on FreeBSD 12 and my previous problem

```root@freebsd:~/rio # stack test
Preparing to install GHC (ino64) to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-ino64-8.6.4.                                      
rts-1.0: Warning: .:458:1: The field "hugs-options" is deprecated. hugs isn't supported anymore
Installed GHC.    
Found an invalid compiler at "/root/.stack/programs/x86_64-freebsd/ghc-ino64-8.6.4/bin/ghc-8.6.4": Control.Exception.Safe.throwString called with:

Could not find any of: ["/root/.stack/programs/x86_64-freebsd/ghc-ino64-8.6.4/bin/haddock-8.6.4","/root/.stack/programs/x86_64-freebsd/ghc-ino64-8.6.4/bin/haddock-ghc-8.6.4","/root/.stack/programs/x86_64-freebsd/ghc-ino64-8.6.4/bin/haddock","/root/.stack/programs/x86_64-freebsd/ghc-ino64-8.6.4/bin/haddock-ghc"]
Called from:
  throwString (src/Stack/Setup.hs:721:25 in stack-2.1.1-GqQp8RavYdM4mtusf35DCY:Stack.Setup)```

went away.

Should we close this issue, stating in conclusion that you need to use latest stack (>= 2.1.1 ?) with a resolver that gives GHC 8.6.5 or newer?

That sounds reasonable to me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tinkyholloway picture tinkyholloway  ·  4Comments

sjakobi picture sjakobi  ·  4Comments

abhinav picture abhinav  ·  4Comments

bitemyapp picture bitemyapp  ·  3Comments

23ua picture 23ua  ·  4Comments