The 'impossible' happened: getBin: Done with leftovers
Summary
Issue happens when cross-compiling project containing web-app-static using GHC 8.8.2 and iserv-dyn
/label ~bug
Steps to reproduce
Try to cross-compile something like ...
module Main where
import Network.Wai.Application.Static (staticApp, defaultFileServerSettings)
import Network.Wai.Handler.Warp (run)
main :: IO ()
main = run 8080 (staticApp (defaultFileServerSettings "/home/user/projects/thcrosstest/src"))
Expected behavior
Successful build of test program, but error indicated in title occurs (cf. subsequent compiler log extract):
wai-app-static> [8 of 9] Compiling Network.Wai.Application.Static
wai-app-static> ghc: panic! (the 'impossible' happened)
wai-app-static> (GHC version 8.8.2 for aarch64-unknown-linux):
wai-app-static> getBin: Done with leftovers
wai-app-static>
wai-app-static> Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
wai-app-static>
-- While building package wai-app-static-3.1.7.1 using:
/home/farmer/.stack/setup-exe-cache/aarch64-linux/Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.2 --builddir=.stack-work/dist/aarch64-linux/Cabal-3.0.1.0 build --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Environment
- GHC version used:
8.8.2 cross-compiler built from official sources as stage1 on built system
using stack 2.1.3 with nightly-2020-01-30 and option --arch aarch64
using ghc-iserv-dyn during cross-compiling template haskell on target system
via socat (instead of iserv-proxy). Script on built host for bridging to ghc-iserv-dyn on target host:
#!/bin/bash
target="user@192.168.178.1"
snapshot="/home/user/.stack/snapshots/aarch64-linux/"
rsync --numeric-ids --delete-before -prtx -e "ssh" ${snapshot} ${target}:${snapshot}
directory=""
current="${PWD}"
suffix=${current#/tmp/}
prefix=${suffix%%/*}
if [ "$prefix" != "" ]; then
directory="/tmp/${prefix}"
rsync --numeric-ids --delete-before -prtx -e "ssh" ${directory} ${target}:/tmp
fi
socat FD:$2!!FD:$1 EXEC:"ssh -T -e none ${target} /home/user/.stack/programs/aarch64-linux/ghc-8.8.2/lib/aarch64-linux-gnu-ghc-8.8.2/bin/ghc-iserv-dyn 1 0 -v",nofork
if [ "$prefix" != "" ]; then
ssh ${target} rm -R ${directory}
fi
- Operating System & Architecture:
Built host = Ubuntu 18.04.3 LTS, Kernel 4.15.0-76 on x86_64 dell laptop with 8 GB RAM
Target host = Debian 10, Kernel 4.9.x on aarch64 embedded system Nitrogen8M SOC with 2 GB RAM
Built host has multi-arch activated for target platform