Stack does not support yet Ubuntu 16.10 #2542

Blaisorblade opened this Issue Aug 29, 2016 · 4 comments


None yet

2 participants


@hvr reported this in Let me quote:

The Stack or HP+Stack options currently both fail to provide a
good beginner experience on all Linux distributions.

Currently, for the just released Ubuntu 16.10 beta you need to use the
system-packaged GHC 7.10.3 package as otherwise you'll likely run into
linker errors due to PIE (and other Linux distros appear to be switching
to PIE by default in their GCC toolchain as well).

I still haven't had time to patch up my GHC PPA to add support for
Ubuntu 16.10, nor do GHC HQ provided GHC bindists work there yet
out-of-the-box, nor do we have addressed the issue for GHC 8.0.2 yet. So
it's unclear to me when the HP distro will have a GHC that works on
PIE-by-default Linux distros.

While that distro is in beta, it'd be good to address the trouble before that Ubuntu is released (which should be on October 13th).

@Blaisorblade Blaisorblade added this to the P1: Must milestone Aug 29, 2016

Does anyone know what's involved in building a GHC bindist that works on Ubuntu 16.10? Is it just a matter of building the bindist on Ubuntu 16.10? stack setup support for selecting different bindists depending on contents of the Linux distribution has improved recently, so this may not be too hard to deal with.


For 7.10.3 one could look at the Ubuntu patches IIUC (in the worst case). Or you could ping HVR if you think it's appropriate (I didn't just to avoid spamming notifications).


I looked at and its changelog, and the relevant patches seem to be

Disable PIE on amd64 and ppc64el
Disable PIE on s390x, since Ubuntu's toolchain defaults to enabling it there (closes: #807366).

Relevant code in debian/rules:

ifneq (,$(filter $(DEB_HOST_ARCH),$(pie_archs)))
        CONF_CC_OPTS_STAGE2=-fno-PIE \
        CONF_GCC_LINKER_OPTS_STAGE2=-no-pie \
# [...]
ifneq (,$(filter $(DEB_HOST_ARCH),$(pie_archs)))
        echo "SRC_CC_OPTS += -fno-PIE" >> mk/
        echo "SRC_LD_OPTS += -no-pie" >> mk/
borsboom commented Sep 10, 2016 edited

After some trial-and-error, it turns out that the configure options GHC was built with don't matter for this case, only the ones that it was installed with (which affect the runtime settings in lib/ghc-<VER>/settings). That means Stack can use the standard GHC bindist, but it will have to adjust the installation process slightly to use the equivalent of CONF_CC_OPTS_STAGE2=-fno-PIE CONF_GCC_LINKER_OPTS_STAGE2=-no-pie CONF_LD_LINKER_OPTS_STAGE2=-no-pie ./configure --prefix=~/.stack/programs/x86_64-linux/ghc-7.10.3.

@borsboom borsboom closed this in e3aa238 Sep 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment