Repository: spack/spack

Issue:
Installation issue: gdb
### Steps to reproduce the issue

```console
$ TMPDIR=/home/yaghan2 spack install gdb@9.1
# ...removed output from installation of dependencies...
==> Installing gdb
==> Searching for binary cache of gdb
==> No binary for gdb found: installing from source
==> Using cached archive: /home/yaghan/local/spack/var/spack/cache/_source-cache/archive/fc/fcda54d4f35bc53fb24b50009a71ca98410d71ff2620942e3c829a7f5d614252.tar.gz
==> Staging archive: /home/yaghan2/mpokorny/spack-stage/spack-stage-gdb-9.1-5eax6odwwz5tq3pdo6a2vly4zkqrgrpm/gdb-9.1.tar.gz
==> Created stage in /home/yaghan2/mpokorny/spack-stage/spack-stage-gdb-9.1-5eax6odwwz5tq3pdo6a2vly4zkqrgrpm
==> No patches needed for gdb
==> Building gdb [AutotoolsPackage]
==> Executing phase: 'autoreconf'
==> Executing phase: 'configure'
==> Error: ProcessError: Command exited with status 1:
    '/home/yaghan2/mpokorny/spack-stage/spack-stage-gdb-9.1-5eax6odwwz5tq3pdo6a2vly4zkqrgrpm/spack-src/configure' '--prefix=/home/yaghan/local/spack/opt/spack/linux-rhel7-cascadelake/gcc-9.2.0/gdb-9.1-5eax6odwwz5tq3pdo6a2vly4zkqrgrpm' '--with-python' 'LDFLAGS=-L/home/yaghan/local/spack/opt/spack/linux-rhel7-cascadelake/gcc-9.2.0/python-3.7.6-cbizx2gsqdqzuacgxhjyufwn2tep4r6r/lib -lpython3.7m'

1 error found in build log:
     1    ==> Executing phase: 'autoreconf'
     2    ==> Executing phase: 'configure'
     3    ==> [2020-02-14-10:23:43.170403] '/home/yaghan/local/spack/opt/spack/linux-rhel7-cascadelake/gcc-9.2.0/python-3
          .7.6-cbizx2gsqdqzuacgxhjyufwn2tep4r6r/bin/python3.7' '-c' 'from distutils.sysconfig import get_config_var; prin
          t(get_config_var('"'"'LIBDIR'"'"'))'
     4    ==> [2020-02-14-10:23:43.190987] '/home/yaghan/local/spack/opt/spack/linux-rhel7-cascadelake/gcc-9.2.0/python-3
          .7.6-cbizx2gsqdqzuacgxhjyufwn2tep4r6r/bin/python3.7' '-c' 'from distutils.sysconfig import get_config_var; prin
          t(get_config_var('"'"'PYTHONFRAMEWORKPREFIX'"'"'))'
     5    ==> [2020-02-14-10:23:43.210509] '/home/yaghan/local/spack/opt/spack/linux-rhel7-cascadelake/gcc-9.2.0/python-3
          .7.6-cbizx2gsqdqzuacgxhjyufwn2tep4r6r/bin/python3.7' '-c' 'from distutils.sysconfig import get_config_var; prin
          t(get_config_var('"'"'LDLIBRARY'"'"'))'
     6    ==> [2020-02-14-10:23:43.229826] '/home/yaghan2/mpokorny/spack-stage/spack-stage-gdb-9.1-5eax6odwwz5tq3pdo6a2vl
          y4zkqrgrpm/spack-src/configure' '--prefix=/home/yaghan/local/spack/opt/spack/linux-rhel7-cascadelake/gcc-9.2.0/
          gdb-9.1-5eax6odwwz5tq3pdo6a2vly4zkqrgrpm' '--with-python' 'LDFLAGS=-L/home/yaghan/local/spack/opt/spack/linux-r
          hel7-cascadelake/gcc-9.2.0/python-3.7.6-cbizx2gsqdqzuacgxhjyufwn2tep4r6r/lib -lpython3.7m'
  >> 7    configure: error: GDB must be configured and built in a directory separate from its sources.
     8    
     9    To do so, create a dedicated directory for your GDB build and invoke
     10   the configure script from that directory:
     11   
     12         $ mkdir build
     13         $ cd build
```

### Platform and user environment

Please report your OS here:
```commandline
$ uname -a
Linux yaghan 3.10.0-957.21.3.el7.x86_64 #1 SMP Fri Jun 14 02:54:29 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -d
Description:	Red Hat Enterprise Linux Workstation release 7.6 (Maipo)
``` 
### Additional information



Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/gdb/package.py b/var/spack/repos/builtin/packages/gdb/package.py
--- a/var/spack/repos/builtin/packages/gdb/package.py
+++ b/var/spack/repos/builtin/packages/gdb/package.py
@@ -41,6 +41,8 @@ class Gdb(AutotoolsPackage, GNUMirrorPackage):
     depends_on('python', when='+python')
     depends_on('xz', when='+xz')
 
+    build_directory = 'spack-build'
+
     def configure_args(self):
         args = []
         if '+python' in self.spec:


Test patch: