commercialhaskell / commercialhaskell/stack
[NixOS 18.03] Stack exec fails to open Display in OpenGL application
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
### General summary
I am trying to implement a little game in Haskell using Gloss.
To build the project, I am using Stack, with the `haskeleton` template.
My OS is NixOS, version 18.03.
I add the required libraries to `stack.yaml` and the project builds just fine.
However, when I execute it, the following output is generated:
`freeglut (pongExp): failed to open display 'desktop:7'`
I am generally not sure if this is a error with NixOS or stack, but if I build the project via a nix command, I am able to run the example.
### Steps to reproduce
I uploaded a toy project that aims to reproduce the problem.
1. Download the toy repository: [pong](https://github.com/fendor/pong)
2. Nix is already enabled in `stack.yaml`
3. Build with `stack build`, this should be successful
4. Exec the program with `stack exec pongExp`
Here is the yaml stripped off the autogenerated comments.
```
resolver: lts-11.4
packages:
- .
nix:
enable: true
packages:
- mesa
- freeglut
- zlib
```
For `packages`, I tried almost all combinations of the packages `mesa`, `freeglut`, `mesa_glu` and `mesa_noglu`.
### Expected
I would expect `stack exec` to launch an example project of Gloss, where you can play against a Computer.
### Actual
The command fails with the message:
`freeglut (pongExp): failed to open display 'desktop:7'`
Or something similar, depending on the $DISPLAY variable.
I tried to set $DISPLAY to ':0', ':1' and 'desktop:7'.
```
⋊> stack exec --verbose pongExp
Version 1.6.5 x86_64
Compiled with:
- Cabal-2.0.1.1
- Glob-0.9.2
- HUnit-1.5.0.0
- MonadRandom-0.5.1
- QuickCheck-2.9.2
- StateVar-1.1.0.4
- aeson-1.2.4.0
- aeson-compat-0.3.6
- annotated-wl-pprint-0.7.0
- ansi-terminal-0.7.1.1
- ansi-wl-pprint-0.6.8.2
- array-0.5.1.1
- asn1-encoding-0.9.5
- asn1-parse-0.9.4
- asn1-types-0.3.2
- async-2.1.1.1
- attoparsec-0.13.1.0
- attoparsec-iso8601-1.0.0.0
- auto-update-0.1.4
- base-4.9.1.0
- base-compat-0.9.3
- base-orphans-0.6
- base-prelude-1.2.0.1
- base16-bytestring-0.1.1.6
- base64-bytestring-1.0.0.1
- basement-0.0.4
- bifunctors-5.4.2
- binary-0.8.3.0
- bindings-uname-0.1
- bitarray-0.0.1.1
- blaze-builder-0.4.0.2
- blaze-html-0.9.0.1
- blaze-markup-0.8.0.0
- byteable-0.1.1
- bytestring-0.10.8.1
- call-stack-0.1.0
- case-insensitive-1.2.0.10
- cereal-0.5.4.0
- clock-0.7.2
- colour-2.3.4
- comonad-5.0.2
- conduit-1.2.12.1
- conduit-extra-1.1.17
- connection-0.2.8
- containers-0.5.7.1
- contravariant-1.4
- cookie-0.4.3
- cryptohash-0.11.9
- cryptohash-sha256-0.11.101.0
- cryptonite-0.23
- cryptonite-conduit-0.2.2
- data-default-class-0.1.2.0
- deepseq-1.4.2.0
- digest-0.0.1.2
- directory-1.3.0.0
- distributive-0.5.3
- dlist-0.8.0.3
- easy-file-0.2.1
- echo-0.1.3
- ed25519-0.0.5.0
- either-4.4.1.1
- exceptions-0.8.3
- extra-1.6.4
- fail-4.9.0.0
- fast-logger-2.4.10
- file-embed-0.0.10
- filelock-0.1.1.2
- filepath-1.4.1.1
- foundation-0.0.17
- free-4.12.4
- fsnotify-0.2.1.1
- generic-deriving-1.11.2
- ghc-boot-th-8.0.2
- ghc-prim-0.5.0.0
- gitrev-1.3.1
- hackage-security-0.5.2.2
- hashable-1.2.6.1
- hastache-0.6.1
- hinotify-0.3.9
- hourglass-0.2.10
- hpack-0.27.0
- hpc-0.6.0.3
- hspec-2.4.4
- hspec-core-2.4.4
- hspec-discover-2.4.4
- hspec-expectations-0.8.2
- hspec-smallcheck-0.4.2
- http-api-data-0.3.7.1
- http-client-0.5.7.1
- http-client-tls-0.3.5.1
- http-conduit-2.2.4
- http-types-0.9.1
- ieee754-0.8.0
- integer-gmp-1.0.0.1
- integer-logarithms-1.0.2
- lifted-base-0.2.3.11
- logict-0.6.0.2
- memory-0.14.11
- microlens-0.4.8.1
- microlens-mtl-0.1.11.0
- microlens-th-0.4.1.1
- mime-types-0.1.0.7
- mintty-0.1.1
- mmorph-1.0.9
- monad-control-1.0.2.2
- monad-logger-0.3.25.1
- monad-loops-0.4.3
- mono-traversable-1.0.6.0
- mtl-2.2.1
- nats-1.1.1
- neat-interpolation-0.3.2.1
- network-2.6.3.2
- network-uri-2.6.1.0
- old-locale-1.0.0.7
- old-time-1.1.0.3
- open-browser-0.2.1.0
- optparse-applicative-0.13.2.0
- optparse-simple-0.0.4
- parsec-3.1.11
- path-0.6.1
- path-io-1.3.3
- path-pieces-0.2.1
- pem-0.2.2
- persistent-2.7.1
- persistent-sqlite-2.6.3
- persistent-template-2.5.3
- pid1-0.1.2.0
- prelude-extras-0.4.0.3
- pretty-1.1.3.3
- primitive-0.6.2.0
- process-1.4.3.0
- profunctors-5.2.1
- project-template-0.2.0
- quickcheck-io-0.2.0
- random-1.1
- regex-applicative-0.3.3
- regex-applicative-text-0.1.0.1
- resource-pool-0.2.3.2
- resourcet-1.1.9
- retry-0.7.5.1
- rts-1.0
- safe-0.3.15
- scientific-0.3.5.2
- semigroupoids-5.2.1
- semigroups-0.18.3
- setenv-0.1.1.3
- silently-1.2.5
- smallcheck-1.1.2
- socks-0.5.6
- split-0.2.3.2
- stm-2.4.4.1
- stm-chans-3.0.0.4
- store-0.4.3.2
- store-core-0.4.1
- streaming-commons-0.1.17
- syb-0.7
- tagged-0.8.5
- tar-0.5.0.3
- template-haskell-2.11.1.0
- temporary-1.2.1.1
- text-1.2.2.2
- text-metrics-0.3.0
- tf-random-0.5
- th-abstraction-0.2.6.0
- th-expand-syns-0.4.4.0
- th-lift-0.7.7
- th-lift-instances-0.1.11
- th-orphans-0.13.4
- th-reify-many-0.1.8
- th-utilities-0.2.0.1
- time-1.6.0.1
- time-locale-compat-0.1.1.3
- tls-1.3.11
- transformers-0.5.2.0
- transformers-base-0.4.4
- transformers-compat-0.5.1.4
- unicode-transforms-0.3.3
- unix-2.7.2.1
- unix-compat-0.4.3.1
- unix-time-0.3.7
- unliftio-0.2.4.0
- unliftio-core-0.1.1.0
- unordered-containers-0.2.8.0
- uri-bytestring-0.2.3.3
- uuid-types-1.0.3
- vector-0.12.0.1
- vector-algorithms-0.7.0.1
- void-0.7.2
- x509-1.7.2
- x509-store-1.6.5
- x509-system-1.6.6
- x509-validation-1.6.9
- yaml-0.8.28
- zip-archive-0.3.1.1
- zlib-0.6.1.2
Warning: this is an unsupported build that may have been built with different
versions of dependencies and GHC than the officially release binaries, and
therefore may not behave identically. If you encounter problems, please try
the latest official build by running 'stack upgrade --force-download'.
2018-04-10 13:27:57.014700: [debug] Checking for project config at: /home/baldr/Documents/haskell/pongExp/stack.yaml
@(Stack/Config.hs:842:9)
2018-04-10 13:27:57.015482: [debug] Loading project config file stack.yaml
@(Stack/Config.hs:868:13)
2018-04-10 13:27:57.024625: [debug] Decoding build plan from: /home/baldr/.stack/build-plan/lts-11.4.yaml
@(Stack/Snapshot.hs:150:5)
2018-04-10 13:27:57.024728: [debug] Trying to decode /home/baldr/.stack/build-plan-cache/lts-11.4.cache
@(Data/Store/VersionTagged.hs:66:5)
2018-04-10 13:27:57.030617: [debug] Success decoding /home/baldr/.stack/build-plan-cache/lts-11.4.cache
@(Data/Store/VersionTagged.hs:70:13)
2018-04-10 13:27:57.030785: [debug] PATH is: Just "/home/baldr/.local/bin:/home/baldr/.local/bin:/nix/store/id41byxgpxgc2c6b44djxs7m01jxywar-glib-2.54.3-dev/bin:/home/baldr/bin:/run/wrappers/bin:/etc/profiles/per-user/baldr/bin:/home/baldr/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin"
@(Stack/Nix.hs:116:6)
2018-04-10 13:27:57.030874: [debug] Using a nix-shell environment with nix packages: mesa, freeglut, zlib, haskell.compiler.ghc822, git, gcc
@(Stack/Nix.hs:117:6)
2018-04-10 13:27:57.031252: [debug] Run process: /home/baldr/.nix-profile/bin/nix-shell --pure -E "with (import {}); let inputs = [mesa freeglut zlib haskell.compiler.ghc822 git gcc]; libPath = lib.makeLibraryPath inputs; stackExtraArgs = lib.concatMap (pkg: [ ''--extra-lib-dirs=${lib.getLib pkg}/lib'' ''--extra-include-dirs=${lib.getDev pkg}/include'' ]) inputs; in runCommand ''myEnv'' { buildInputs = lib.optional stdenv.isLinux glibcLocales ++ inputs; STACK_PLATFORM_VARIANT=''nix''; STACK_IN_NIX_SHELL=1; LD_LIBRARY_PATH = libPath;STACK_IN_NIX_EXTRA_ARGS = stackExtraArgs; } \"\"" --run "'/nix/store/fhpxqlpfvgirdwga9vbwr71xipqmwq15-stack-1.6.5/bin/stack' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=1.6.5' 'exec' '--verbose' 'pongExp'"
@(System/Process/Log.hs:37:3)
Version 1.6.5 x86_64
Compiled with:
- Cabal-2.0.1.1
- Glob-0.9.2
- HUnit-1.5.0.0
- MonadRandom-0.5.1
- QuickCheck-2.9.2
- StateVar-1.1.0.4
- aeson-1.2.4.0
- aeson-compat-0.3.6
- annotated-wl-pprint-0.7.0
- ansi-terminal-0.7.1.1
- ansi-wl-pprint-0.6.8.2
- array-0.5.1.1
- asn1-encoding-0.9.5
- asn1-parse-0.9.4
- asn1-types-0.3.2
- async-2.1.1.1
- attoparsec-0.13.1.0
- attoparsec-iso8601-1.0.0.0
- auto-update-0.1.4
- base-4.9.1.0
- base-compat-0.9.3
- base-orphans-0.6
- base-prelude-1.2.0.1
- base16-bytestring-0.1.1.6
- base64-bytestring-1.0.0.1
- basement-0.0.4
- bifunctors-5.4.2
- binary-0.8.3.0
- bindings-uname-0.1
- bitarray-0.0.1.1
- blaze-builder-0.4.0.2
- blaze-html-0.9.0.1
- blaze-markup-0.8.0.0
- byteable-0.1.1
- bytestring-0.10.8.1
- call-stack-0.1.0
- case-insensitive-1.2.0.10
- cereal-0.5.4.0
- clock-0.7.2
- colour-2.3.4
- comonad-5.0.2
- conduit-1.2.12.1
- conduit-extra-1.1.17
- connection-0.2.8
- containers-0.5.7.1
- contravariant-1.4
- cookie-0.4.3
- cryptohash-0.11.9
- cryptohash-sha256-0.11.101.0
- cryptonite-0.23
- cryptonite-conduit-0.2.2
- data-default-class-0.1.2.0
- deepseq-1.4.2.0
- digest-0.0.1.2
- directory-1.3.0.0
- distributive-0.5.3
- dlist-0.8.0.3
- easy-file-0.2.1
- echo-0.1.3
- ed25519-0.0.5.0
- either-4.4.1.1
- exceptions-0.8.3
- extra-1.6.4
- fail-4.9.0.0
- fast-logger-2.4.10
- file-embed-0.0.10
- filelock-0.1.1.2
- filepath-1.4.1.1
- foundation-0.0.17
- free-4.12.4
- fsnotify-0.2.1.1
- generic-deriving-1.11.2
- ghc-boot-th-8.0.2
- ghc-prim-0.5.0.0
- gitrev-1.3.1
- hackage-security-0.5.2.2
- hashable-1.2.6.1
- hastache-0.6.1
- hinotify-0.3.9
- hourglass-0.2.10
- hpack-0.27.0
- hpc-0.6.0.3
- hspec-2.4.4
- hspec-core-2.4.4
- hspec-discover-2.4.4
- hspec-expectations-0.8.2
- hspec-smallcheck-0.4.2
- http-api-data-0.3.7.1
- http-client-0.5.7.1
- http-client-tls-0.3.5.1
- http-conduit-2.2.4
- http-types-0.9.1
- ieee754-0.8.0
- integer-gmp-1.0.0.1
- integer-logarithms-1.0.2
- lifted-base-0.2.3.11
- logict-0.6.0.2
- memory-0.14.11
- microlens-0.4.8.1
- microlens-mtl-0.1.11.0
- microlens-th-0.4.1.1
- mime-types-0.1.0.7
- mintty-0.1.1
- mmorph-1.0.9
- monad-control-1.0.2.2
- monad-logger-0.3.25.1
- monad-loops-0.4.3
- mono-traversable-1.0.6.0
- mtl-2.2.1
- nats-1.1.1
- neat-interpolation-0.3.2.1
- network-2.6.3.2
- network-uri-2.6.1.0
- old-locale-1.0.0.7
- old-time-1.1.0.3
- open-browser-0.2.1.0
- optparse-applicative-0.13.2.0
- optparse-simple-0.0.4
- parsec-3.1.11
- path-0.6.1
- path-io-1.3.3
- path-pieces-0.2.1
- pem-0.2.2
- persistent-2.7.1
- persistent-sqlite-2.6.3
- persistent-template-2.5.3
- pid1-0.1.2.0
- prelude-extras-0.4.0.3
- pretty-1.1.3.3
- primitive-0.6.2.0
- process-1.4.3.0
- profunctors-5.2.1
- project-template-0.2.0
- quickcheck-io-0.2.0
- random-1.1
- regex-applicative-0.3.3
- regex-applicative-text-0.1.0.1
- resource-pool-0.2.3.2
- resourcet-1.1.9
- retry-0.7.5.1
- rts-1.0
- safe-0.3.15
- scientific-0.3.5.2
- semigroupoids-5.2.1
- semigroups-0.18.3
- setenv-0.1.1.3
- silently-1.2.5
- smallcheck-1.1.2
- socks-0.5.6
- split-0.2.3.2
- stm-2.4.4.1
- stm-chans-3.0.0.4
- store-0.4.3.2
- store-core-0.4.1
- streaming-commons-0.1.17
- syb-0.7
- tagged-0.8.5
- tar-0.5.0.3
- template-haskell-2.11.1.0
- temporary-1.2.1.1
- text-1.2.2.2
- text-metrics-0.3.0
- tf-random-0.5
- th-abstraction-0.2.6.0
- th-expand-syns-0.4.4.0
- th-lift-0.7.7
- th-lift-instances-0.1.11
- th-orphans-0.13.4
- th-reify-many-0.1.8
- th-utilities-0.2.0.1
- time-1.6.0.1
- time-locale-compat-0.1.1.3
- tls-1.3.11
- transformers-0.5.2.0
- transformers-base-0.4.4
- transformers-compat-0.5.1.4
- unicode-transforms-0.3.3
- unix-2.7.2.1
- unix-compat-0.4.3.1
- unix-time-0.3.7
- unliftio-0.2.4.0
- unliftio-core-0.1.1.0
- unordered-containers-0.2.8.0
- uri-bytestring-0.2.3.3
- uuid-types-1.0.3
- vector-0.12.0.1
- vector-algorithms-0.7.0.1
- void-0.7.2
- x509-1.7.2
- x509-store-1.6.5
- x509-system-1.6.6
- x509-validation-1.6.9
- yaml-0.8.28
- zip-archive-0.3.1.1
- zlib-0.6.1.2
Warning: this is an unsupported build that may have been built with different
versions of dependencies and GHC than the officially release binaries, and
therefore may not behave identically. If you encounter problems, please try
the latest official build by running 'stack upgrade --force-download'.
2018-04-10 13:27:58.144666: [debug] Checking for project config at: /home/baldr/Documents/haskell/pongExp/stack.yaml
@(Stack/Config.hs:842:9)
2018-04-10 13:27:58.144868: [debug] Loading project config file stack.yaml
@(Stack/Config.hs:868:13)
2018-04-10 13:27:58.148050: [debug] Decoding build plan from: /home/baldr/.stack/build-plan/lts-11.4.yaml
@(Stack/Snapshot.hs:150:5)
2018-04-10 13:27:58.148140: [debug] Trying to decode /home/baldr/.stack/build-plan-cache/lts-11.4.cache
@(Data/Store/VersionTagged.hs:66:5)
2018-04-10 13:27:58.152109: [debug] Success decoding /home/baldr/.stack/build-plan-cache/lts-11.4.cache
@(Data/Store/VersionTagged.hs:70:13)
2018-04-10 13:27:58.152231: [debug] Getting system compiler version
@(Stack/Setup.hs:387:17)
2018-04-10 13:27:58.152625: [debug] Run process: /nix/store/qhnchlzc3wlwqdrigimgdrqz9zmgdz7q-ghc-8.2.2/bin/ghc --info
@(System/Process/Log.hs:37:3)
2018-04-10 13:27:58.234519: [debug] Process finished in 81ms: /nix/store/qhnchlzc3wlwqdrigimgdrqz9zmgdz7q-ghc-8.2.2/bin/ghc --info
@(System/Process/Log.hs:44:3)
2018-04-10 13:27:58.235458: [debug] Getting global package database location
@(Stack/GhcPkg.hs:46:5)
2018-04-10 13:27:58.235649: [debug] Asking GHC for its version
@(Stack/Setup/Installed.hs:98:13)
2018-04-10 13:27:58.235746: [debug] Getting Cabal package version
@(Stack/GhcPkg.hs:185:5)
2018-04-10 13:27:58.235790: [debug] Run process: /nix/store/qhnchlzc3wlwqdrigimgdrqz9zmgdz7q-ghc-8.2.2/bin/ghc-pkg --no-user-package-db list --global
@(System/Process/Log.hs:37:3)
2018-04-10 13:27:58.236608: [debug] Run process: /nix/store/qhnchlzc3wlwqdrigimgdrqz9zmgdz7q-ghc-8.2.2/bin/ghc --numeric-version
@(System/Process/Log.hs:37:3)
2018-04-10 13:27:58.236818: [debug] Run process: /nix/store/qhnchlzc3wlwqdrigimgdrqz9zmgdz7q-ghc-8.2.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
@(System/Process/Log.hs:37:3)
2018-04-10 13:27:58.273318: [debug] Process finished in 35ms: /nix/store/qhnchlzc3wlwqdrigimgdrqz9zmgdz7q-ghc-8.2.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
@(System/Process/Log.hs:44:3)
2018-04-10 13:27:58.277263: [debug] Process finished in 41ms: /nix/store/qhnchlzc3wlwqdrigimgdrqz9zmgdz7q-ghc-8.2.2/bin/ghc-pkg --no-user-package-db list --global
@(System/Process/Log.hs:44:3)
2018-04-10 13:27:58.319236: [debug] Process finished in 82ms: /nix/store/qhnchlzc3wlwqdrigimgdrqz9zmgdz7q-ghc-8.2.2/bin/ghc --numeric-version
@(System/Process/Log.hs:44:3)
2018-04-10 13:27:58.319381: [debug] GHC version is: ghc-8.2.2
@(Stack/Setup/Installed.hs:102:13)
2018-04-10 13:27:58.319480: [debug] Resolving package entries
@(Stack/Setup.hs:250:5)
2018-04-10 13:27:58.319599: [debug] Trying to decode /home/baldr/.stack/loaded-snapshot-cache/x86_64-linux-nix/ghc-8.2.2/lts-11.4.cache
@(Data/Store/VersionTagged.hs:66:5)
2018-04-10 13:27:58.354408: [debug] Success decoding /home/baldr/.stack/loaded-snapshot-cache/x86_64-linux-nix/ghc-8.2.2/lts-11.4.cache
@(Data/Store/VersionTagged.hs:70:13)
2018-04-10 13:27:58.355215: [debug] Starting to execute command inside EnvConfig
@(Stack/Runners.hs:170:18)
2018-04-10 13:27:58.355350: [debug] Run process: /home/baldr/Documents/haskell/pongExp/.stack-work/install/x86_64-linux-nix/lts-11.4/8.2.2/bin/pongExp
@(System/Process/Log.hs:37:3)
freeglut (pongExp): failed to open display 'desktop:7'
```
### Method of installation
* An unofficial Installation, via nix-package manager.
Contributor guide
Assessment
This issue has not been assessed yet.