It would be great if there is FreeBSD support for stack, too.
Have you tried it? In theory, Stack should work just fine on FreeBSD.
It wouldn't be hard to start distributing binaries for FreeBSD either, since there are official GHC bindists available. Basically all we'd need is a Vagrantfile in https://github.com/commercialhaskell/stack/tree/master/etc/vagrant that sets up the environment in which a binary gets built. A pull request would be welcome.
We'd also be very open to anyone who wants to contribute Stack packages/ports to FreeBSD. We can provide any help needed, and would also be willing to take over maintenance for new Stack versions once the legwork to get it all set up has been done.
I'm not much proficient in BSD. I have tried to build it via cabal without Stackage config without success. I should try with Stackage. I'll try with vagrant, too. Thanks!
This seems to work for building stack on a fresh FreeBSD VM:
sudo pkg install ghc hs-cabal-install ca_root_nss
cabal install ignore -f without-pcre # This won't be needed for stack >0.1.6.0
cabal install stack
This stack seems to work fine using the system-installed GHC.
However, there's an issue that blocks us distributing stack binaries for FreeBSD, which need to support stack setup: the GHC bindist's defaults for ./configure don't seem to work quite right. Here's what I did on another fresh FreeBSD VM with the just the stack executable I built earlier (but no system-installed GHC):
sudo pkg install ca_root_nss compat8x-amd64 gmake perl5 gcc libiconv
stack setup
When you build Haskell code after this, there are a lot of clang: warning: argument unused during compilation warnings. According to the GHC bindist's README:
Although GHC may work with Clang, it is recommended to use GCC from the Ports Collection until the Clang support receives more testing on FreeBSD.
$ env CC=gcc48 ./configure --with-gcc=gcc48 --with-ld=/usr/local/bin/ld --prefix=$PREFIX
I guess we could teach stack setup to pass these arguments to the bindists's configure?
Here are links to the FreeBSD bindists on GHC's download site for 7.10.3. Strangely, they're not in the initial yellow box listing the supported OSs, but the download links are there.
freebsd64:
http://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3-x86_64-portbld-freebsd.tar.bz2~~
(not sure the key for this in the metadata, but this is 32 bit)
http://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3-i386-portbld-freebsd.tar.bz2~~
While I love lts-3.20, it'd be nice to upgrade :)
I'll just send a PR for stackage-content.
fpco/stackage-content#16
Does stack setup actually work with the 7.10.3 FreeBSD bindist? Last time I tried there were problems because the ./configure step needed extra arguments that Stack wasn't providing.
I tried to run stack setup on FreeBSD 10.2-RELEASE-p9 and it failed due to a missing libutils.so.8
Running /tmp/stack-setup13907/ghc-7.10.3/configure --prefix=/home/dario/.stack/programs/x86_64-freebsd/ghc-7.10.3/ in directory /tmp/stack-setup13907/ghc-7.10.3/ exited with ExitFailure 1
checking for path to top of build tree...
Shared object "libutil.so.8" not found, required by "ghc-pwd"
configure: error: cannot determine current directory
There's a /lib/libutil.so.9 on my system, so I presume that maybe the bindists have been built on an older version of FreeBSD?
(OTOH, using stackage lts 3.22, which sports GHC 7.10.2, and thus using the system's ghc, it seems to work fine)
Yep, I had to install compat8x and compat9x from pkg to get things going on 10.2.
@borsboom
Yes, the metadata for stack has been updated so now stack setup should work like you expect.
I've built a pkg repository for stack and FreeBSD here: http://stack-pkg.applicative.tech/
Build tools are here in case anyone is interested: https://github.com/applicative-tech/stack-pkg
This looks great! If you don't mind, I'd like to look into integrating this with our standard release process and hosting the packages on our S3 bucket. I didn't have a chance to do this for the just-released stack-1.0.4, unfortunately.
@t6: Also, feel free to make a pull request on the stable branch that adds links to doc/install_and_upgrade.md and doc/README.md so that, until this is integrated, FreeBSD users know to find your work. Just include a note that it's unofficial and may not have the latest version.
@borsboom: Thanks, just updated the package repository to stack 1.0.4 and have opened a pull request for adding links.
Has anyone tried getting this in FreeBSD ports?
Sure that was my initial plan, but I have given up for now for time reasons and the problems described here: https://github.com/applicative-tech/stack-pkg/blob/master/devel/stack/Makefile#L31-L53
I'm pretty sure that they can be solved though by someone who knows, understands (or wants to invest the time to understand) the ports tree and its Cabal support i.e. bsd.cabal.mk better than me.
hi @t6,
yikes, not an easy task.
TWIMC stack works on FreeBSD just fine. Here is simplest way to install it:
sudo pkg install hs-cabal-install
cabal update
cabal install stack
Then copy ~/.cabal/bin/stack somewhere in your $PATH. After that cabal and other Haskell packages are no longer required.
I think these steps could be recommended in the official installation instruction.
Replicated and confirmed @afiskon's simple install guide using a clean install of freebsd 10.3.
@afiskon @Cipherwraith You still need compat8x/compat9x for stack's ghc.
@nd2s I don't have these packages and everything seems to work. Could be true for older LTS`es though.
@afiskon I am on FreeBSD 10.3-RELEASE amd64 and needed to install them a few days ago for GHC 7.10.3 (resolvers lts-5.1 and lts-5.11). Got the (already known) Shared object "libutil.so.8" not found, required by "ghc" error.
Just checked again: I definitely need them.
@nd2s oh, I see. I am on FreeBSD 11.0-CURRENT and I got the same error. But I thought the reason for this is that GHC was built for -STABLE or -RELEASE branch. So I just created a symlink to libutils.so and it solved all problems. @Cipherwraith didn't you encounter this error?
@afiskon
Yeah I encountered that error also. Sorry forgot to mention it.
@t6 I'm trying out the packages you're providing on a fresh system, but stack setup didn't work for me. That's because GHC's Makefile requires GNU make, but that's not installed by default on FreeBSD. stack setup will use gmake if it's installed, and indeed if I pkg install gmake everything is fine, so I think gmake should be made a dependency of your package.
@borsboom Thanks, I've added a run dependency on gmake. It'll be part of the next package.
The just-released stack-1.1.2 now includes an official FreeBSD bindist. Instructions to download and install are here: http://docs.haskellstack.org/en/stable/install_and_upgrade/#freebsd
Wow! Great!
On 21.05.2016 г., at 1:49, Emanuel Borsboom [email protected] wrote:
The just-released stack-1.1.2 now includes an official FreeBSD bindist. Instructions to download and install are here: http://docs.haskellstack.org/en/stable/install_and_upgrade/#freebsd
—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
Instructions on http://docs.haskellstack.org/en/stable/install_and_upgrade/#freebsd have pointing to this issue which is already resolved, i.e. progress finished?
I've removed that bit of text. Thanks for letting me know!
Thanks!
It's in the ports tree now: https://www.freshports.org/devel/stack
Most helpful comment
It's in the ports tree now: https://www.freshports.org/devel/stack