Ok. I think I find what's the root cause. Instead of using Debian (my env is stretch/sid) haskell-stack package, (removing Debian's haskell-stack and) installing stack from Haskell's script fixes the problem.

https://docs.haskellstack.org/en/stable/README/#how-to-install

So steps are:
1. rm -r ~/.stack
2. rm -r projects/capdl/capDL-tool/.stack-world (I didn't have .stack in capDL-tool dir)
3. apt-get purge haskell-stack
4. curl -sSL https://get.haskellstack.org/ | sh (adding ~/.local/bin to .profile)

Thanks for all your help!
 

-------- Original Message --------
Subject: Re: [seL4] Invalid package ID: "array-0.5.1.1 base-4.9.0.0 binary-0.8.3.0 bytestring-0.10.8.1"
Local Time: July 11, 2017 4:12 AM
UTC Time: July 11, 2017 2:12 AM
From: Peter.Chubb@data61.csiro.au
To: tj5527@protonmail.com
devel@sel4.systems

>>>>> "tj5527" == tj5527 <tj5527@protonmail.com> writes:

tj5527> With commands `stack upgrade` and
tj5527> `stack upgrade --git` I still get Invalid package ID error
tj5527> message or failing during `make`.


The only differences I see between your log output and a successful
one are that stack is using (for me) a version of GHC it has built for
itself, rather than the one packaged by Ubuntu.
I suggest you do
rm -r ~/.stack
rm -r projects/capdl/capDL-tool/.stack

and then
make clobber
make


This is what I see:

[parse-capDL] building...
make: Entering directory "/home/peterc/src/work/camkes-vm/projects/capdl/capDL-tool"
stack setup
Downloaded lts-7.10 build plan.
Updating package index Hackage (mirrored at https://github.com/commercialhaskell 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-8.0.1.
Installing GHC ...
stack will use a sandboxed GHC it installed
For more information on paths, see "stack path" and "stack exec env"
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec
stack build --only-dependencies
[1 of 2] Compiling Main ( /home/peterc/.stack/setup-exe-src/setup-mPHDZzAJ.hs, /home/peterc/.stack/setup-exe-src/setup-mPHDZzAJ.o )
[2 of 2] Compiling StackSetupShim ( /home/peterc/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /home/peterc/.stack/setup-exe-src/setup-shim-mPHDZzAJ.o )
Linking /home/peterc/.stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_mPHDZzAJ_1.24.0.0_ghc-8.0.1 ...
old-locale-1.0.0.7: download
random-1.1: download
HUnit-1.3.1.2: download
base-compat-0.9.1: download
mtl-2.2.1: download
network-2.6.3.1: download
split-0.2.3.1: download
text-1.2.2.1: download
old-locale-1.0.0.7: configure
old-locale-1.0.0.7: build
random-1.1: configure
split-0.2.3.1: configure
random-1.1: build
split-0.2.3.1: build
mtl-2.2.1: configure
old-locale-1.0.0.7: copy/register
mtl-2.2.1: build
HUnit-1.3.1.2: configure
HUnit-1.3.1.2: build
base-compat-0.9.1: configure
base-compat-0.9.1: build
split-0.2.3.1: copy/register
network-2.6.3.1: configure
old-time-1.1.0.3: download
base-compat-0.9.1: copy/register
mtl-2.2.1: copy/register
HUnit-1.3.1.2: copy/register
random-1.1: copy/register
regex-base-0.93.2: download
network-2.6.3.1: build
text-1.2.2.1: configure
text-1.2.2.1: build
old-time-1.1.0.3: configure
old-time-1.1.0.3: build
regex-base-0.93.2: configure
regex-base-0.93.2: build
regex-base-0.93.2: copy/register
network-2.6.3.1: copy/register
regex-posix-0.95.2: download
old-time-1.1.0.3: copy/register
regex-posix-0.95.2: configure
regex-posix-0.95.2: build
hslogger-1.2.10: download
hslogger-1.2.10: configure
hslogger-1.2.10: build
hslogger-1.2.10: copy/register
regex-posix-0.95.2: copy/register
regex-compat-0.95.1: download
regex-compat-0.95.1: configure
regex-compat-0.95.1: build
regex-compat-0.95.1: copy/register
text-1.2.2.1: copy/register
parsec-3.1.11: download
parsec-3.1.11: configure
parsec-3.1.11: build
parsec-3.1.11: copy/register
MissingH-1.4.0.1: download
MissingH-1.4.0.1: configure
MissingH-1.4.0.1: build
MissingH-1.4.0.1: copy/register
Completed 15 action(s).
make: Leaving directory "/home/peterc/src/work/camkes-vm/projects/capdl/capDL-tool"


--
Dr Peter Chubb Tel: +61 2 9490 5852 http://ts.data61.csiro.au/
Trustworthy Systems Group Data61 (formerly NICTA)