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

stack setup of GHC 8.0.1 on OpenBSD 6.0 is broken #2822

Closed
bonds opened this Issue Dec 2, 2016 · 35 comments

Comments

Projects
None yet
8 participants
@bonds

bonds commented Dec 2, 2016

General summary/comments (optional)

I cannot install GHC 8.0.1 on OpenBSD 6.0 using stack. My guess is it fails because the 8.0.1 binaries (e.g. ghc-pwd) for OpenBSD were built on OpenBSD 5.9, not OpenBSD 6.0.

Steps to reproduce

For example:

  1. login to your OpenBSD 6.0 machine
  2. run doas pkg_add ghc cabal-install gtar
  3. run cabal update
  4. run cabal install stack
  5. run stack setup 8

Expected

GHC 8.0.1 successfully installs.

Actual

GHC 8.0.1 fails to install:

~/bin (master|✚9…) ❯❯❯ stack setup 8
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Already downloaded.
Running /home/scott/.stack/programs/x86_64-openbsd/ghc-8.0.1.temp/ghc-8.0.1/configure --prefix=/home/scott/.stack/programs/x86_64-openbsd/ghc-8.0.1/ in directory /home/scott/.stack/programs/x86_64-openbsd/ghc-8.0.1.temp/ghc-8.0.1/ exited with ExitFailure 1

checking for path to top of build tree...
ghc-pwd: can't load library 'libc.so.84.2'
configure: error: cannot determine current directory

Error encountered while configuring GHC with
  /home/scott/.stack/programs/x86_64-openbsd/ghc-8.0.1.temp/ghc-8.0.1/configure --prefix=/home/scott/.stack/programs/x86_64-openbsd/ghc-8.0.1/
  run in /home/scott/.stack/programs/x86_64-openbsd/ghc-8.0.1.temp/ghc-8.0.1/

The following directories may now contain files, but won't be used by stack:
  - /home/scott/.stack/programs/x86_64-openbsd/ghc-8.0.1.temp/
  - /home/scott/.stack/programs/x86_64-openbsd/ghc-8.0.1/

Configuring GHC ...⏎~/bin (master|✚9…) ❯❯❯ ls /usr/lib/libc.so.*
/usr/lib/libc.so.88.0     /usr/lib/libc.so.88.0.a
~/bin (master|✚9…) ❯❯❯ uname -a
OpenBSD rain.ggr.com 6.0 GENERIC.MP#0 amd64
~/bin (master|✚9…) ❯❯❯

Stack version

~/bin (master|✚9…) ❯❯❯ stack --version
Version 1.2.0 x86_64 hpack-0.14.0

Method of installation

  • Via cabal-install
@bonds

This comment has been minimized.

bonds commented Dec 2, 2016

Looks like there's only a bindist for 5.9:

https://www.haskell.org/ghc/download_ghc_8_0_1#openbsd_x86_64

Perhaps the lowest scope fix is to either not support bindists for OpenBSD at all, leaving it to OpenBSD's package manager to install ghc versions, or give an error message when there's no bindist available for the version of OpenBSD you're running.

@mgsloan mgsloan added the type: bug label Dec 10, 2016

@mgsloan mgsloan added this to the P2: Should milestone Dec 10, 2016

@seanwestfall

This comment has been minimized.

seanwestfall commented Jan 11, 2017

Yeah, I just started getting the same error while trying to get yesod working, though I was trying to do it without GHC 8.0.

$ /home/goldfish/.cabal/bin/stack build yesod-bin cabal-install --install-ghc
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Already downloaded.
Running /home/goldfish/.stack/programs/x86_64-openbsd/ghc-7.10.3.temp/ghc-7.10.3/configure --prefix=/home/goldfish/.stack/programs/x86_64-openbsd/ghc-7.10.3/ in directory /home/goldfish/.stack/programs/x86_64-openbsd/ghc-7.10.3.temp/ghc-7.10.3/ exited with ExitFailure 1

checking for path to top of build tree...
ghc-pwd: can't load library 'libc.so.84.2'
configure: error: cannot determine current directory


Error: Error encountered while configuring GHC with
         /home/goldfish/.stack/programs/x86_64-openbsd/ghc-7.10.3.temp/ghc-7.10.3/configure --prefix=/home/goldfish/.stack/programs/x86_64-openbsd/ghc-7.10.3/
         run in /home/goldfish/.stack/programs/x86_64-openbsd/ghc-7.10.3.temp/ghc-7.10.3/

The following directories may now contain files, but won't be used by stack:
  - /home/goldfish/.stack/programs/x86_64-openbsd/ghc-7.10.3.temp/
  - /home/goldfish/.stack/programs/x86_64-openbsd/ghc-7.10.3/

this was after a previous attempt that successfully downloaded and installed ghc-7.10.3 i.e. Downloaded ghc-7.10.3.

@Blaisorblade

This comment has been minimized.

Collaborator

Blaisorblade commented May 10, 2017

Perhaps the lowest scope fix is to either not support bindists for OpenBSD at all, leaving it to OpenBSD's package manager to install ghc versions, or give an error message when there's no bindist available for the version of OpenBSD you're running.

If one can tell what's the current OpenBSD version—I assume there's a way, dunno which—and if somebody contributes Haskell code to do it inside Stack, then Stack could also pick the appropriate bindist to use and try downloading one. If there's no appropriate bindist, Stack would give an error.

@bonds

This comment has been minimized.

bonds commented May 11, 2017

@Blaisorblade

This comment has been minimized.

Collaborator

Blaisorblade commented May 11, 2017

Even a non-Haskell way would help. Say, googling openbsd querying version doesn't find what we need. Can I run a command? Look at some file?

Anyway, it seems we can hack a solution WITHOUT WAITING for autodetection (as a hack). But to figure this out, I spent time I really don't have—so the description is pretty concise.

Steps 1 and 2 can be tested by simply configuring GHC. Step 3 requires OpenBSD knowledge. Steps 4 and 5 require some Haskell, including basic mtl (specifically, dealing with MonadIO m), but I already found where this belongs in Stack.

  1. GHC bindists should be tagged by OpenBSD release. I sketched a no-warranty PR to achieve this:

commercialhaskell/stackage-content#25

I'm not sure we can meaningfully ship bindists for current, since they don't have compatibility. At least for now, I'd suggest people will have to figure out some custom scheme for their own builds.

  1. Users can tell stack which OpenBSD version they run by overriding Stack's ghc-build parameter—say, ghc-build: 5.9 or ghc-build: 6.0. Do so in the appropriate location in Stack's config (see https://docs.haskellstack.org/en/stable/yaml_configuration/#ghc-build).

You can try out the config in that PR without merging it by configuring
setup-info.

The above PR keep the current support for users that don't specify ghc-build.

  1. Ideally, automate autodetection in any way.

  2. Translate autodetection into Haskell code. You'll need to write getOpenBSDVersion :: MonadIO m => m String—note MonadIO.

  3. If somebody implements autodetection, it should be integrated in getGhcBuild for OpenBSD, so that getGhcBuild returns CompilerBuildSpecialized "X.Y" on OpenBSD X.Y. Then, users would not need to write ghc-build: X.Y in their Stack config.

Relevant code pointers include

stack/src/Stack/Setup.hs

Lines 543 to 544 in 0ddbaa7

case platform of
Platform _ Linux -> do

stack/src/Stack/Setup.hs

Lines 600 to 603 in 0ddbaa7

case libComponents ++ pieComponents of
[] -> useBuild CompilerBuildStandard
components -> useBuild (CompilerBuildSpecialized (intercalate "-" components))
_ -> useBuild CompilerBuildStandard

That shows the current detection algorithm for Linux.

@bonds

This comment has been minimized.

bonds commented May 12, 2017

@Blaisorblade

  1. Ideally, automate autodetection in any way.

I'm not clear on what you're asking for, is it this?:

$ echo `uname`-`uname -r`-`uname -m` | tr [:upper:] [:lower:]
openbsd-6.1-amd64
$

If Stack already knows its running on an OpenBSD box (instead of a Linux or Windows box), then running that command will give it the OpenBSD version and architecture.

@Blaisorblade

This comment has been minimized.

Collaborator

Blaisorblade commented May 12, 2017

Ah cool! I just need uname -r then — the rest of the string is assembled elsewhere. We can probably just run the command via http://hackage.haskell.org/package/shell-conduit-4.6.1/docs/Data-Conduit-Shell-PATH.html#v:uname.

Calling uname directly would be cleaner—but googling only found this, though it's a bit low-level:
https://hackage.haskell.org/package/bindings-uname-0.1/docs/Bindings-Uname.html

Based on their example, it seems this is the code to call to get uname -r—I'm not sure if throwErrnoIfMinus1_ throws the exception we'd want, but maybe we just wrap this function.

 import Foreign.C
 import Foreign.Marshal

 sysRelease :: IO String
 sysRelease = alloca $ \ ptr ->
           do throwErrnoIfMinus1_ "uname" $ uname ptr
              peekCString $ release ptr
@bonds

This comment has been minimized.

bonds commented May 12, 2017

Seems to work ok:

~ ❯❯❯ cat uname.hs                                                          Fri 2017-05-12 14:20:06 -0700
#!/home/scott/.cabal/bin/stack
{- stack
    --verbosity silent
    --system-ghc
    runghc
    --resolver lts-6
    --package bindings-uname
-}
-- vim:ft=haskell:

module Main where

import Bindings.Uname
import Foreign.C
import Foreign.Marshal

main :: IO ()
main = do
    sr <- sysRelease
    putStrLn sr

sysRelease :: IO String
sysRelease = alloca $ \ ptr ->
           do throwErrnoIfMinus1_ "uname" $ uname ptr
              peekCString $ release ptr

~ ❯❯❯ ./uname.hs                                                            Fri 2017-05-12 14:20:11 -0700
6.1
@Blaisorblade

This comment has been minimized.

Collaborator

Blaisorblade commented May 18, 2017

Wanna try integration? Won't have much time to pursue this... If it helps, I've sketched what I had in mind at master...check-openbsd-release, but I haven't even compile-tested it yet.

Not sure where I'd actually place sysRelease, but probably not in Setup.hs.

@Blaisorblade

This comment has been minimized.

Collaborator

Blaisorblade commented May 19, 2017

@bonds Now I got code to compile. See master...check-openbsd-release. Wanna try?

As mentioned, you'll need commercialhaskell/stackage-content#25 as well. You can try out the modified content locally via documented configurations (edit: see https://docs.haskellstack.org/en/stable/yaml_configuration/#setup-info).

@bonds

This comment has been minimized.

bonds commented May 22, 2017

@Blaisorblade not sure how to test this...I tried cloning stack and building it using lts-6.31 (since I'm running the latest OpenBSD and it only supports GHC 7.10.3), I was prompted to add a bunch of extra-deps, but it wasn't enough:

~/t/stack ((b352016a…)|✚1) ❯❯❯ stack build                                  Mon 2017-05-22 08:29:15 -0700
Cabal file warning in /home/scott/tmp/stack/stack.cabal: Ignoring unknown section type: custom-setup
Cabal file warning in /home/scott/tmp/stack/stack.cabal: Ignoring unknown section type: custom-setup
While constructing the BuildPlan the following exceptions were encountered:

--  Failure when adding dependencies:
      Cabal: needed (==1.24.*), 1.22.8.0 found (latest applicable is 1.24.2.0)
      aeson: needed ((>=1.0 && <1.2)), 0.11.3.0 found (latest applicable is 1.1.2.0)
      hpack: needed (>=0.17.0 && <0.18), 0.14.1 found (latest applicable is 0.17.0)
      http-client: needed (>=0.5.3.3), 0.4.31.2 found (latest applicable is 0.5.6.1)
      http-client-tls: needed (>=0.3.4), 0.2.4.1 found (latest applicable is 0.3.4.1)
      http-conduit: needed (>=2.2.3), 2.1.11 found (latest applicable is 2.2.3.1)
      optparse-applicative: needed (==0.13.*), 0.12.1.0 found (latest applicable is 0.13.2.0)
    needed for package stack-1.4.1 with flags:
      hide-dependency-versions: True

...I could rip the version restrictions off in stack.cabal but I'm worried I'll encounter errors and even if I don't, my test results won't be usable on their own. What do you think?

@Blaisorblade

This comment has been minimized.

Collaborator

Blaisorblade commented May 22, 2017

With GHC 7.10.3, you need to use stack-7.10.yaml instead of stack.yaml.

For instance, stack build -f stack-7.10.yaml, but you might need that for all commands. So you can set STACK_YAML=stack-7.10.yaml (for a command or globally) as explained in https://docs.haskellstack.org/en/stable/faq/#how-can-i-make-sure-my-project-builds-against-multiple-ghc-versions. Maybe this should be better documented for Stack, not sure.

I could rip the version restrictions off in stack.cabal but I'm worried I'll encounter errors

If you are in this sort of scenario and have no alternative stack.yaml, there are better options before messing with cabal versions. stack init --solver (maybe specifying the desired resolver with --resolver lts-6.31, otherwise it guesses) would a better way to create a proper stack.yaml given a cabal file. Another tool is https://docs.haskellstack.org/en/stable/yaml_configuration/#allow-newer.

@bonds

This comment has been minimized.

bonds commented May 22, 2017

@bonds

This comment has been minimized.

bonds commented May 22, 2017

Alright, got it (b352016) to build and run, and I get this message:

~/t/stack ((b352016a…)|✔) ❯❯❯ env STACK_YAML=stack-7.10.yaml stack exec stack setup 8
Getting project config file from STACK_YAML environment
Getting project config file from STACK_YAML environment
Invalid package name: "ghc-6.1"

I'm running OpenBSD 6.1.

@Blaisorblade

This comment has been minimized.

Collaborator

Blaisorblade commented May 22, 2017

Oh, thanks a lot!

Let's use maj6-min1 or sth. rather than 6.1. Separating major and minor should be more robust than "rel61". I've opened #3184 and updated commercialhaskell/stackage-content#25 but I still have testing I can do before you need to test.

@Blaisorblade

This comment has been minimized.

Collaborator

Blaisorblade commented May 23, 2017

Tested locally. Stack appears to generate the correct bindist name. I haven't tried proceeding with setup.
I'm not sure I'm doing the right thing if the OpenBSD version is 6.1.1—I guessed I should consider that a different version—if that scenario is possible and I guessed wrong, let me know.
EDIT: @bonds, feel free to retest.

@bonds

This comment has been minimized.

bonds commented May 23, 2017

OpenBSD versions only go to the first decimal place, i.e. 5.9, 6.0, 6.1. AFAIK there has never been another decimal place, nor have they gone above 9, so nothing like 5.10. After you apply any available patches its reflected in the uname like so:

~ ❯❯❯ uname -v
GENERIC.MP#5
~ ❯❯❯ uname -a    
OpenBSD maybe.ggr.com 6.1 GENERIC.MP#5 amd64

But that does not impact which version/build of GHC is compatible, that is only impacted by the architecture (i.e. amd64) and the release (i.e. 6.1).

@bonds

This comment has been minimized.

bonds commented May 23, 2017

I tested c5d884e:

~/t/stack (blah|✔) ❯❯❯ env STACK_YAML=stack-7.10.yaml stack exec stack setup 8
Getting project config file from STACK_YAML environment
Getting project config file from STACK_YAML environment
Unable to find installation URLs for OS key: openbsd64-maj6-min1
@Blaisorblade

This comment has been minimized.

Collaborator

Blaisorblade commented May 23, 2017

Better! If you can use the patched list of bindists, you should get to the next step. I hinted at how to try that, guess I wasn't clear enough. Was I? On the phone and in a rush, let's see what I can do.

@bonds

This comment has been minimized.

bonds commented May 23, 2017

Sorry, missed the hint. Now I see it. I added this to the stack-7.10.yaml:

setup-info:
  ghc:
    openbsd64-maj6-min1:
      8.0.1:
        url: "https://example.com/ghc-8.0.1-amd64-unknown-openbsd61.tar.xz"

and now I get this:

~/t/stack (blah|✔)  [1] ❯❯❯ env STACK_YAML=stack-7.10.yaml stack exec stack setup 8
Getting project config file from STACK_YAML environment
Getting project config file from STACK_YAML environment
Preparing to install GHC (maj6-min1) to an isolated location.
This will not interfere with any system-level installation.
No sha1 found in metadata, download hash won't be checked.
Preparing to download ghc-maj6-min1-8.0.1 ...HttpExceptionRequest Request {
  host                 = "example.com"
  port                 = 443
  secure               = True
  requestHeaders       = []
  path                 = "/ghc-8.0.1-amd64-unknown-openbsd61.tar.xz"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 (StatusCodeException (Response {responseStatus = Status {statusCode = 404, statusMessage = "Not Found"}, responseVersion = HTTP/1.1, responseHeaders = [("Content-Encoding","gzip"),("Accept-Ranges","bytes"),("Cache-Control","max-age=604800"),("Content-Type","text/html"),("Date","Tue, 23 May 2017 17:37:46 GMT"),("Expires","Tue, 30 May 2017 17:37:46 GMT"),("Last-Modified","Tue, 23 May 2017 17:37:46 GMT"),("Server","ECS (rhv/819E)"),("Vary","Accept-Encoding"),("X-Cache","404-HIT"),("Content-Length","606")], responseBody = (), responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}) "<!doctype html>\n<html>\n<head>\n    <title>Example Domain</title>\n\n    <meta charset=\"utf-8\" />\n    <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <style type=\"text/css\">\n    body {\n        background-color: #f0f0f2;\n        margin: 0;\n        padding: 0;\n        font-family: \"Open Sans\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n        \n    }\n    div {\n        width: 600px;\n        margin: 5em auto;\n        padding: 50px;\n        background-color: #fff;\n        border-radius: 1em;\n    }\n    a:link, a:visited {\n        color: #38488f;\n        text-decoration: none;\n    }\n    @media (max-width: 700px) {\n        body {\n            background-color: #fff;\n        }\n        div {\n            width: auto;\n            margin: 0 auto;\n            border-radius: 0;\n            padding: 1em;\n        }\n    }\n    </style>    \n</head>\n\n<body>\n<div>\n    <h1>Example Domain</h1>\n    <p>This domain is established to be used for illustrative examples in documents. You may use this\n    domain in examples without prior coordination or asking for permission.</p>\n    <p><a href=\"http://www.iana.org/domains/example\">More information...</a></p>\n</div>\n</body>\n</html>\n")
@Blaisorblade

This comment has been minimized.

Collaborator

Blaisorblade commented May 23, 2017

@romanzolotarev

This comment has been minimized.

romanzolotarev commented Jul 29, 2017

Folks, could you please check the new ghc-8.2.1 bindist for OpenBSD 6.1? Does it work for you?

Works for me at least:

screen shot 2017-07-29 at 21 48 00

Related ticket: https://ghc.haskell.org/trac/ghc/ticket/14041

@MarkusBarthlen

This comment has been minimized.

MarkusBarthlen commented Jul 29, 2017

Could someone tell me how stack is supposed to be installed under OpenBSD (6.1 on amd64 with ghc and cabal-install installed via pkg_add)?

open# pkg_info | grep ghc
ghc-7.10.3p7        compiler for the functional language Haskell
open# pkg_info | grep cabal
cabal-install-1.22.6.0 command-line interface for Cabal and Hackage

I tried both cabal install stack and
cabal install -j --disable-documentation stack
both as root and as a normal user, and adding chmod -R a+x to /root/.cabal/setup-exe-cache
(I know, I know). After reading this (https://ryanglscott.github.io/2014/07/16/installing-ghc-on-freebsd/), I also checked that /tmp has no noexec setting.

It's probably something trivial, but I cannot make out my mistake.
(The console output is in the attachment).
stack.txt

Afterwards, I would love to try out your wonderful bindist.

@romanzolotarev

This comment has been minimized.

romanzolotarev commented Jul 30, 2017

Hi @MarkusBarthlen

  1. Download OpenBSD 6.1: https://ftp.openbsd.org/pub/OpenBSD/6.1/amd64/install61.iso
  2. Install OpenBSD
  3. In the console:
mount -uo wxallowed /
PKG_PATH=https://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -p)/
export PKG_PATH
pkg_add haskell-platform xz
cabal update
cabal install stack
stack setup 8.0.2

Please note I have only / partition on that machine.

@MarkusBarthlen

This comment has been minimized.

MarkusBarthlen commented Jul 30, 2017

@romanzolotarev

Thanks for the answer. I can confirm that the installation does not abort after first running

mount -uo wxallowed /
pkg_add haskell-platform xz

which I did not do before. I still got some "runInteractiveProcess: exec: permission denied (Permission denied)" output in the console but the build is still ongoing.

Update:
Somehow my console is filling up with 4s. Since I have not used this computer much, I cannot exclude that it is defective. I ran memtest with success before, but I had some application crashes (nautilus.core, firefox.core, emacs.core, chrome.core files in my home as proof).

@raichoo

This comment has been minimized.

raichoo commented Jul 30, 2017

@MarkusBarthlen: I'm having the same issue.

@adamsteen

This comment has been minimized.

adamsteen commented Jul 30, 2017

Make sure where ever you are running ghc and tools (stack etc) the mount point needs wxallowed, i also found /tmp needs to wxallowed too.

reading Setting Up a OpenBSD System for Building GHC
should help too, especially the Prerequisite section.

@MarkusBarthlen

This comment has been minimized.

MarkusBarthlen commented Jul 30, 2017

Thank you, I cancelled the installation and added wxallowed to /tmp and ran pkg_add ghc gmake autoconf%2.69 automake%1.15 gmp libiconv alex happy git as well as

export AUTOCONF_VERSION=2.69
export AUTOMAKE_VERSION=1.15

Not sure if it is overkill, since the manual says "this is for building on OpenBSD Current as of 2017-04-05", but so far things are looking better.

As a side note, kind of interesting that stack uses persistent-sqlite under the hood, I did not know that.

@adamsteen

This comment has been minimized.

adamsteen commented Jul 30, 2017

Sorry, you only needed the stuff about wxallowed.

@MarkusBarthlen

This comment has been minimized.

MarkusBarthlen commented Jul 30, 2017

Looks like stack installed properly. Testing 8.2.1 will have to wait since I did not assign enough memory to / and running stack setup 8.2.1 as a user I ran into a permissions issue. I'll probably try again next weekend if I get far enough with setting up a new laptop.

@romanzolotarev

This comment has been minimized.

romanzolotarev commented Jul 30, 2017

@MarkusBarthlen @raichoo thanks for the feedback. I forgot to add pkg_add gtar gmake gmp.

As @adamsteen suggested the issue can be in absence of wxallowed.

ghc-8.0.2 on OpenBSD 6.1 via stack

If you want to use ghc-8.0.2, I would recommend to install it via stack. You don't need to download, install, or configure anything else.

mount -uo wxallowed /
PKG_PATH=https://ftp.openbsd.org/pub/openbsd/$(uname -r)/packages/$(uname -p)/
export PKG_PATH
pkg_add haskell-platform xz gtar gmake gmp
cabal update
cabal install stack
PATH=/root/.cabal/bin:$PATH
export PATH
stack new app
cd app
stack setup
stack build
stack exec app-exe

Tested on Vultr:

CPU: 1 vCore
RAM: 2048 MB
Storage: 40 GB SSD
# mount
/dev/sd0a on / type ffs (local, wxallowed)
/dev/sd0d on /usr/local type ffs (local, nodev, wxallowed)
# uname -a
OpenBSD build.romanzolotarev.com 6.1 GENERIC.MP#20 amd64
# ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.3
# cabal --version
cabal-install version 1.22.6.0
using version 1.22.5.0 of the Cabal library
# stack --numeric-version
1.5.0
# ~/.cabal/bin/stack ghc -- --version
The Glorious Glasgow Haskell Compilation System, version 8.0.2

ghc-8.2.1 on OpenBSD 6.1 from bindist

If you want to use the latest ghc-8.2.1, then you can try download bindist for OpenBSD 6.1.

mount -uo wxallowed /
PKG_PATH=https://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -p)/
export PKG_PATH
ftp https://downloads.haskell.org/~ghc/8.2.1/ghc-8.2.1-x86_64-openbsd61-openbsd.tar.xz
pkg_add xz gtar gmake gmp
unxz ghc-8.2.1-x86_64-openbsd61-openbsd.tar.xz
tar xvf ghc-8.2.1-x86_64-openbsd61-openbsd.tar
cd ghc-8.2.1
./configure
alias make=gmake
make install

Tested on the same server.

# ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.2.1
# echo 'main=print "hello world"' > Main.hs
# ghc Main.hs
# ./Main
"hello world"

Note: bindist has been updated yesterday. Make sure you download the latest version. I've got the link to bindist from this page: https://www.haskell.org/ghc/download_ghc_8_2_1.html#openbsd_61_x86_64

What does not work yet

I have tried, but could not make it work:

@bonds

This comment has been minimized.

bonds commented Jul 31, 2017

I was able to use stack setup with both ghc-8.0.2 and ghc-8.2.1 on OpenBSD 6.1 by using a custom stack.yaml to work around #3184 not being merged yet, like so:

$ ulimit -d 3000000
$ env STACK_YAML=/home/scott/.stack/global-project/stack.yaml stack setup 8.0.2
$ env STACK_YAML=/home/scott/.stack/global-project/stack.yaml stack setup 8.2.1
$ cat /home/scott/.stack/global-project/stack.yaml
# This is the implicit global project's config file, which is only used when
# 'stack' is run outside of a real project.  Settings here do _not_ act as
# defaults for all projects.  To change stack's default settings, edit
# '/home/scott/.stack/config.yaml' instead.
#
# For more information about stack's configuration, see
# http://docs.haskellstack.org/en/stable/yaml_configuration/
#
resolver: ghc-8.2.1
flags: {}
extra-package-dbs: []
packages: []
extra-deps:
setup-info:
    ghc:
        openbsd64:
            8.0.2:
                url: "https://downloads.haskell.org/~ghc/8.0.2/ghc-8.0.2-x86_64-openbsd61-openbsd.tar.xz"
        openbsd64:
            8.2.1:
                url: "https://downloads.haskell.org/~ghc/8.2.1/ghc-8.2.1-x86_64-openbsd61-openbsd.tar.xz"
                content-length: 115110128
                sha1: 5ac8a867cf1241eeebdef7a6eee74f0a55e4543e
$

I did a small amount of testing of both 8.0.2 and 8.2.1 on my OpenBSD 6.1 amd64 box, and both seem to work ok, at least superficially.

@Blaisorblade

This comment has been minimized.

Collaborator

Blaisorblade commented Aug 1, 2017

Sorry for being MIA—had to finish a PhD thesis—and did. I'll try to re-review and optimistically merge (let merge) #3184 to try and unblock you.

@bonds

This comment has been minimized.

bonds commented Aug 1, 2017

No worries @Blaisorblade, congratulations on finishing your thesis!

@Blaisorblade Blaisorblade referenced this issue Aug 5, 2017

Open

Official OpenBSD support: last steps #3313

3 of 5 tasks complete
@Blaisorblade

This comment has been minimized.

Collaborator

Blaisorblade commented Aug 7, 2017

#3184 is merged! 8.0.1 on 6.0 is still not supported (because the bindist isn't there), but we're now working on 8.0.2 and 8.2.1. I'd say, let's close this and continue at #3313 with an updated summary? Please test master (see details there on what works).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment