Opened 4 years ago

Closed 3 years ago

#10001 closed bug (invalid)

GHC crash trying to build a project within Nix-shell

Reported by: wolftune Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.8.4
Keywords: Cc: sean.leather@…
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: 9825 Differential Rev(s):
Wiki Page:

Description

<no location info>:
    ghc: panic! (the 'impossible' happened)
  (GHC version 7.8.4 for x86_64-unknown-linux):
        Loading temp shared object failed: /run/user/1000/ghc19915_0/ghc19915_20.so: failed to map segment from shared object

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

[20 of 99] Compiling Settings.StaticFiles ( Settings/StaticFiles.hs, dist/build/Settings/StaticFiles.o )

<no location info>:
    ghc: panic! (the 'impossible' happened)
  (GHC version 7.8.4 for x86_64-unknown-linux):
        Loading temp shared object failed: /run/user/1000/ghc19915_0/ghc19915_21.so: failed to map segment from shared object

Change History (7)

comment:1 Changed 4 years ago by teh

I have a reproducible example: https://gist.github.com/teh/d94a704254c834af6cdf

I get

[...]
Loading package pretty-1.1.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.

<no location info>:
    ghc: panic! (the 'impossible' happened)
  (GHC version 7.8.4 for x86_64-unknown-linux):
	Loading temp shared object failed: /run/user/1000/ghc1352_0/ghc1352_3.so: failed to map segment from shared object

comment:2 Changed 4 years ago by thomie

Status: newinfoneeded

Does your example also fail outside a Nix-shell? I don't know what a Nix-shell is, so I can't reproduce this.

Could this be related to #10131 ("improve error message for build on noexec-mounted device")

comment:3 Changed 4 years ago by siddhanathan

This example does fail outside a Nix-shell. I just had the same issue with GHC 7.10.1

Reproducing should be simple. Just install the nix package manager (http://nixos.org/nix/), copy the files in the gist to a new folder, run nix-shell in the folder, and then cabal sandbox init && cabal install.

comment:4 Changed 4 years ago by rwbarton

Can we get instructions to reproduce that do not include "Just install the nix package manager"? The panic must depend on some feature of the environment.

At a guess, perhaps TMPDIR is pointing at a filesystem (/run) that is mounted with noexec? That won't work (#10131).

comment:5 Changed 4 years ago by johnleuner

I managed to work around this problem by creating a temporary directory in my working directory.

From my nix shell:

export TMPDIR=$(pwd)/temp
cabal install
Last edited 4 years ago by johnleuner (previous) (diff)

comment:6 Changed 4 years ago by spl

Cc: sean.leather@… added

comment:7 Changed 3 years ago by siddhanathan

Resolution: invalid
Status: infoneededclosed

So turns out TMPDIR was not set by default on my machine (using Ubuntu), and in such situations, nix defaults to using a temporary directory in /run which causes the panic. Setting TMPDIR to /tmp should fix the issue.

Note: See TracTickets for help on using tickets.