Skip to content

Strange stack setup behaviour when DESTDIR is set #1460

Closed
@ehamberg

Description

@ehamberg

Calling stack setup, with DESTDIR set fails since it will end up being installed in $DESTDIR$HOME/.stack/programs/x86_64-linux/ghc-7.10.2/. This happened on a CI server that called make DESTDIR=$BUILD_DIR install and relied on the fact that the install target was calling other targets that eventually called stack setup.

Here's what happens on Debian 8.2 for a user with HOME=/var/lib/buildkite-agent:

$ rm -rf ~/.stack/
$ DESTDIR=/tmp/test stack setup
Downloaded lts-3.16 build plan.
Caching build plan
Fetched package index.
Populated index cache.
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-7.10.2.
Installed GHC.
Executable named ghc not found on path: ["/var/lib/buildkite-agent/.stack/programs/x86_64-linux/ghc-7.10.2/bin","/usr/local/bin","/usr/bin","/bin","/usr/local/games","/usr/games"]
$ ls var/lib/buildkite-agent/.stack/programs/x86_64-linux/ghc-7.10.2/
bin  lib  share

Note that the install ends up in $DESTDIR$HOME which here is /tmp/test/var/lib/buildkite-agent.

(This was solved by changing the build to be make && make DESTDIR=$BUILD_DIR install so that DESTDIR is only set for the install target.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions