Repository: spack/spack

Issue:
Installation issue:Go-md2man failing

### Steps to reproduce the issue
This error is being thrown during the installation of charliecloud/0.10. It occurs in the Go-md2man package. I have found go forums online that hint at the possibility of a naming conflict as `GO` is installed first. Then `Go-md2man` is installed and is creating identical files, thus causing the error. I cannot confirm this is the actual issue at this time however. Steps to reproduce are as follows below: 
`spack install charliecloud@0.10+builder+docs`
The resulting error output is below.
```console
$ spack install charliecloud@0.10+builder+docs
==> diffutils is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/diffutils-3.7-ko7qdeieiylfx6v6v3u7jqptrv7lyvoj
==> bzip2 is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/bzip2-1.0.8-hhbrbrhbf5tkbqcg57apuqeg2b7nhich
==> libbsd is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/libbsd-0.9.1-z3iyo2ibak3luzwebdwmoganb4x4orje
==> expat is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/expat-2.2.5-cn2qjequsqaizlcxsvr74gq4rntgl5zn
==> pkgconf is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/pkgconf-1.6.1-zyia6fm5vvznsxxla43wto6vezv3jciz
==> ncurses is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/ncurses-6.1-rqw3cmcwvd76h4rjgtaxpvrqg47prwkg
==> readline is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/readline-7.0-b4z2xcjalfc4z7tgktx7txhe2my3wlfd
==> gdbm is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/gdbm-1.18.1-dv2qksj2dheh7hzmu7iftqhxlkqrinwt
==> libiconv is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/libiconv-1.15-bli6oh4rawy6bwdqa7ylbp7wt5tkynyv
==> xz is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/xz-5.2.4-agv5zlv7phi4ye3evlpv3t4ypgve4bpe
==> zlib is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/zlib-1.2.11-64vg6e4evdrlqgx7iicwhu2hs7lv6gpz
==> libxml2 is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/libxml2-2.9.9-7mziu5hpmcz6mzurl4tnfvr3edkcacjl
==> tar is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/tar-1.31-i3i4p3q35guhtu3qq5n2pr6f227xr7ha
==> gettext is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/gettext-0.19.8.1-osb2am7ooumpqy7dg3njcbzs6x4u4lfy
==> libffi is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/libffi-3.2.1-ksqyb2nne56f3f5z5cfsjwqyjfpnbejl
==> perl is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/perl-5.26.2-7tmxubxk4qnty7decxqsz5yu5v3p3lqq
==> openssl is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/openssl-1.1.1c-4j6vfpkc34grsa5inqmqpxspw77dt6pv
==> sqlite is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/sqlite-3.28.0-alqtjltqgnbq5zsolryhlwgiebj2p6p7
==> python is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/python-3.7.4-xltfhovadgfpcos7f7jfz2mbnz5omcvw
==> py-setuptools is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-setuptools-41.0.1-2xmtjktkllwimxwgnzmmwvs6xuqdnktb
==> py-lark-parser is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-lark-parser-0.7.1-gakevmdxh2ise3zaldnjrxzn37bdoajz
==> py-alabaster is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-alabaster-0.7.12-ihwgsqcini7ylnc2uwgdvyoyl2qmxh77
==> py-pytz is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-pytz-2018.4-425bvnskgf3akzj3tprd4yvf25jxvphk
==> py-babel is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-babel-2.6.0-xcfhvgorycdz7q2hu2jusxkdg7kw55g4
==> py-docutils is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-docutils-0.14-ohpxl7uzmsbr7fwxrlj4o6xur33mqciv
==> py-imagesize is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-imagesize-1.1.0-6j2rpvw5axnrt3ujozza5pypxf3qmq54
==> py-markupsafe is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-markupsafe-1.0-zl64pxx6rnq72ycujuaw2y2sta5axbtk
==> py-jinja2 is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-jinja2-2.10-6mf2rgq6j6vrcnlkjj42b4grssxm5qid
==> py-attrs is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-attrs-18.1.0-3upv5jafg6vz6srto2v5npxabrl757w5
==> py-pyparsing is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-pyparsing-2.3.1-kswak36dacwokfms3hsgwkkr52ap5tl6
==> py-six is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-six-1.12.0-tj357fdmk5gvze53gzpxdgynxmjwg2mt
==> py-packaging is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-packaging-19.1-evbre4ps6lmyvg4kg7j7zex3nu47eq35
==> py-pygments is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-pygments-2.3.1-5m7667m7bptvh4pe7dbs6l4ppvnrpvrn
==> py-certifi is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-certifi-2017.4.17-xrmigm3kzl6o4jf66vzbfjnenzdxoy33
==> py-setuptools-scm is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-setuptools-scm-3.1.0-skmytkhkqovs6shoqpuqma7dsi3opvv7
==> py-pytest-runner is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-pytest-runner-2.11.1-htectfahq6kzksjomn7fjhnd6hp2ud32
==> py-chardet is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-chardet-3.0.2-ygli72x4runufewa3xihhec4dk5ylswj
==> py-idna is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-idna-2.5-4dhb2kqlljo7uuq37ugegltwyob24n66
==> py-urllib3 is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-urllib3-1.21.1-hmfltcwriqug4cyambpmrzmlvv3hazk3
==> py-requests is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-requests-2.21.0-6pysz5rbibkzqm2yiypijk4ukihmdrfj
==> py-snowballstemmer is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-snowballstemmer-1.2.1-4wo6xo5e67svmv6mraoahv3g6ekn3syv
==> py-sphinx-rtd-theme is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-sphinx-rtd-theme-0.4.3-pq5cod6dtt7mqjxlv76cm554oi7vrtg2
==> py-sphinxcontrib-websupport is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-sphinxcontrib-websupport-1.1.0-5xc4ymeyobqxwmxkebfiabguvyhbaxbn
==> py-sphinx is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/py-sphinx-1.8.4-bg2hyjzyqv3tqu3y7kd47oc4gpafhqv5
==> rsync is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/rsync-3.1.3-wkycy7w5ki5ermvndu63ldivhmoxnmvy
==> libsigsegv is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/libsigsegv-2.11-qpmaxx6z62df4s4hwyehdwptv6kmrfhf
==> m4 is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/m4-1.4.18-cdmdgcjw5owv2olhgygcbhirab4ti4ae
==> autoconf is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/autoconf-2.69-dzuvqtysoqchxxlnfcfdvflwlvnwl542
==> automake is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/automake-1.16.1-33xp7xdltlskzu4kkd3mqv7gaiqt4hbj
==> curl is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/curl-7.63.0-yjhzaoybqifnwex4j5jmsrgkvr3uobwk
==> libtool is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/libtool-2.4.6-bcbiddkmbu4gy7wx6ftntmxqe3c5br3z
==> pcre is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/pcre-8.42-bgbdt4qk5f5p6aj5rv2htdj6s5guxzbx
==> git is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/git-2.21.0-idxumey2jzm2lc2t3ut5rm4ygyakrate
==> go-bootstrap is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/go-bootstrap-1.4-bootstrap-20171003-d7n6eilkp23obp2sagahkbfk2pzvrwbo
==> go is already installed in /home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/go-1.13-lpm5w6obgccvsexn5tiufrv3mvzbc7zh
==> Installing go-md2man
==> Searching for binary cache of go-md2man
==> Warning: No Spack mirrors are currently configured
==> No binary for go-md2man found: installing from source
==> Using cached archive: /home/calvin/git/spack/var/spack/cache/go-md2man/go-md2man-1.0.10.tar.gz
==> Using cached archive: /home/calvin/git/spack/var/spack/cache/go-md2man/blackfriday-1.0.10.tar.gz
==> Staging archive: /tmp/calvin/spack-stage/go-md2man-1.0.10-xmiz6b7ly4wmcplrbnqaivxgw5lyshda/v1.0.10.tar.gz
==> Created stage in /tmp/calvin/spack-stage/go-md2man-1.0.10-xmiz6b7ly4wmcplrbnqaivxgw5lyshda
==> Staging archive: /tmp/calvin/spack-stage/resource-blackfriday-xmiz6b7ly4wmcplrbnqaivxgw5lyshda/v1.5.2.tar.gz
==> Created stage in /tmp/calvin/spack-stage/resource-blackfriday-xmiz6b7ly4wmcplrbnqaivxgw5lyshda
==> Moving resource stage
	source : /tmp/calvin/spack-stage/resource-blackfriday-xmiz6b7ly4wmcplrbnqaivxgw5lyshda/spack-src/
	destination : /tmp/calvin/spack-stage/go-md2man-1.0.10-xmiz6b7ly4wmcplrbnqaivxgw5lyshda/spack-src/src/github.com/russross/blackfriday
==> Ran patch() for go-md2man
==> Building go-md2man [Package]
==> Executing phase: 'install'
==> Error: ProcessError: Command exited with status 1:
    '/home/calvin/git/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/go-1.13-lpm5w6obgccvsexn5tiufrv3mvzbc7zh/bin/go' 'build' '-v' 'github.com/cpuguy83/go-md2man'
See build log for details:
  /tmp/calvin/spack-stage/go-md2man-1.0.10-xmiz6b7ly4wmcplrbnqaivxgw5lyshda/spack-build-out.txt


```
Inside of the build log is the following 
```
 ==> Executing phase: 'install'
  ==> [2019-09-10-16:50:18.185420] '/home/calvin/git/spack/opt/spack/linux-centos7-x86_64    /gcc-4.8.5/go-1.13-lpm5w6obgccvsexn5tiufrv3mvzbc7zh/bin/go' 'build' '-v' 'github.com/cp    uguy83/go-md2man'
  $GOPATH/go.mod exists but should not
```
### Platform and user environment

Please report your OS here:
```commandline
$ uname -a 
Linux $machine 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core) 
``` 
### Additional information
Expected output is simply charlecloud/0.10 building without issue. 



Discussion:
I would also like to add that on all three systems I am trying to build on, spack fails at a unique package of go. toss3 fails with what is above.  
cle6.0 system fails on package `go` with. 
```console
==> Executing phase: 'install'
==> [2019-09-17-16:51:51.016863] '/bin/bash' 'make.bash'
Building Go cmd/dist using PATH/spack/opt/spack/cray-cnl6-haswell/gcc-8.3.0/go-bootstrap-1.4-bootstrap-20171003-fg5jnizu6gjkro7e7kne5rhhqcn7vvd6.
Building Go toolchain1 using PATH/spack/opt/spack/cray-cnl6-haswell/gcc-8.3.0/go-bootstrap-1.4-bootstrap-20171003-fg5jnizu6gjkro7e7kne5rhhqcn7vvd6.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.
/tmp/calvindseamons/spack-stage/go-1.13-wgsprkaowyzlvqempvqlnun72czcnjf3/spack-src/bin/go: symbol lookup error: /opt/cray/pe/lib64/libAtpSigHandler.so.0: undefined symbol: _ATP_Data_Globals

go tool dist: FAILED: /tmp/calvindseamons/spack-stage/go-1.13-wgsprkaowyzlvqempvqlnun72czcnjf3/spack-src/bin/go list -gcflags=all= -ldflags=all= -f={{if .Stale}}       STALE {{.ImportPath}}: {{.StaleReason}}{{end}} std cmd: exit status 127
~                     
```
On cle7.0 systems the error occurs in `go-bootstrap` with: 
```console
==> Building go-bootstrap [Package]
==> Executing phase: 'install'
==> Error: ProcessError: Command exited with status 1:
    '/bin/bash' 'make.bash'

2 errors found in build log:
     2    ==> [2019-09-17-16:11:05.295533] '/bin/bash' 'make.bash'
     3    # Building C bootstrap tool.
     4    cmd/dist
     5    Warning:
     6     Headers and libraries from cray-libsci/19.06.1 will be ignored because depends on P
          E_MPICH which is unavailable..
     7    
  >> 8    Child failed to exec: No such file or directory
  >> 9    make.bash: line 136: ./cmd/dist/dist: No such file or directory

```

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/go-md2man/package.py b/var/spack/repos/builtin/packages/go-md2man/package.py
--- a/var/spack/repos/builtin/packages/go-md2man/package.py
+++ b/var/spack/repos/builtin/packages/go-md2man/package.py
@@ -37,6 +37,7 @@ def install(self, spec, prefix):
 
         with working_dir('src'):
             env['GOPATH'] = self.stage.source_path
+            env['GO111MODULE'] = 'off'
             go = which('go')
             go('build', '-v', join_path(
                'github.com', 'cpuguy83', 'go-md2man'))


Test patch: