# Spackdev on protoDUNE DAQ node
## Prerequisites
```shell
[pding@np04-srv-023 spack-dev]$ ./checkPrerequisites
checkPrerequisites 1.02.09
INFO: Checking prerequisites for art and dependent packages.
ERROR: Missing rpms -- do:
yum install asciidoc glew-devel libgcc.i686 glibc-devel.i686 libstdc++.i686
and re-run.
ERROR: Some prerequisites missing: see above for details.
```
One has to install `libgcc, glibc-devel, libstdc++ x86_64` first before installing the `i686` version, otherwise yum will complain.
## install spack-dev
```shell
[pding@np04-srv-023 spack-dev]#
[pding@np04-srv-023 spack-dev]# ./bootstrap-mvp -j 16 -v scratch/MVP
PROGRESS: Checking platform eligibility ...
PROGRESS: Checking for prerequisite system packages ...
PROGRESS: Checking paths ...
PROGRESS: Installing spack_glue ...
PROGRESS: Bootstrapping tools ...
PROGRESS: Configuring SciSoft BuildCache mirror ...
ERROR: Unable to configure SciSoft BuildCache mirror
```
Retried using root:
```
ERROR: Unable to install compiler suite for MVP
```
Retried after cleaning `~root/.spack*`
```shell
[root@np04-srv-023 spack-dev]# mkdir scratch
[root@np04-srv-023 spack-dev]# date>> time.log ; ./bootstrap-mvp -j 16 -v scratch/MVP 2>&1| tee bootstrap.log
PROGRESS: Checking platform eligibility ...
PROGRESS: Checking for prerequisite system packages ...
PROGRESS: Checking paths ...
PROGRESS: Installing spack_glue ...
PROGRESS: Bootstrapping tools ...
PROGRESS: Configuring SciSoft BuildCache mirror ...
PROGRESS: Installing compiler GCC 7.3 ...
PROGRESS: Installing Lmod for environment management ...
PROGRESS: Bootstrapping Spack ...
PROGRESS: Setting up to use Spack ...
PROGRESS: Configuring compiler use ...
PROGRESS: Finding external tools ...
PROGRESS: Retrieve and register the fnal_art package repository ...
==> Added repo with namespace 'fnal_art'.
PROGRESS: Bootstrapping SpackDev ...
PROGRESS: Generating setup script ...
INFO: Done.
# Cost 15 minutes wall time.
```
Doing spack-dev install
```shell
[root@np04-srv-023 spack-dev]#
spack dev init -b spackdev-larsoft --default-branch=MVP1a --dag-file ../spack_glue/MVP/templates/larsoft-dag.txt -v larsim
==> Fetching http://xmlsoft.org/sources/libxml2-2.9.9.tar.gz
######################################################################## 100.0%
==> Fetching http://www.w3.org/XML/Test/xmlts20080827.tar.gz
curl: (22) The requested URL returned error: 503 Service Unavailable
==> Fetching from http://www.w3.org/XML/Test/xmlts20080827.tar.gz failed.
==> Error: FetchError: All fetchers failed for resource-xmlts-r3ibf3mhnvtvyialy3fivhlw6rnywnpb
/scratch/dingpf/spack-dev/scratch/MVP/spack/lib/spack/spack/package.py:965, in do_fetch:
962 raise FetchError("Will not fetch %s" %
963 self.spec.format('{name}{@version}'), ck_msg)
964
>> 965 self.stage.create()
966 self.stage.fetch(mirror_only)
967 self._fetch_time = time.time() - start_time
968
```
The public webserver side had a problem, simply do `wget URL` to verify the server recovered before retrying the command.
When retrying the command, it complaines non-empty `spackdev-larsoft` area, deleted the directory and retried for a second time.
## package with changed repo URL (`dk2nudata` and ` dk2nugenie`)
Got the following error:
```shell=
[+] /scratch/dingpf/spack-dev/scratch/MVP/spack-data/install/linux-rhel7-x86_64/gcc-7.3.0/log4cpp/1.1.3-dkek7nm74drraoyy6f3qqxwoac4h5jwn
==> Installing dk2nudata
==> Searching for binary cache of dk2nudata
==> Warning: No Spack mirrors are currently configured
==> No binary for dk2nudata found: installing from source
==> Checking out subversion repository: http://cdcvs.fnal.gov/subversion/dk2nu/tags/v01_07_02
svn: E175002: Unable to connect to a repository at URL 'http://cdcvs.fnal.gov/subversion/dk2nu/tags/v01_07_02'
svn: E175002: OPTIONS of 'http://cdcvs.fnal.gov/subversion/dk2nu/tags/v01_07_02': could not connect to server (http://cdcvs.fnal.gov)
==> Fetching from [svn] http://cdcvs.fnal.gov/subversion/dk2nu/tags/v01_07_02 failed.
==> Error: FetchError: All fetchers failed for dk2nudata-01_07_02-ill2k6ls4k3g5hlmijibvx4xmmplumts
/scratch/dingpf/spack-dev/scratch/MVP/spack/lib/spack/spack/package.py:965, in do_fetch:
962 raise FetchError("Will not fetch %s" %
963 self.spec.format('{name}{@version}'), ck_msg)
964
>> 965 self.stage.create()
966 self.stage.fetch(mirror_only)
967 self._fetch_time = time.time() - start_time
968
[root@np04-srv-023 MVP]#
svn: E175011: Unable to connect to a repository at URL 'http://cdcvs.fnal.gov/subversion/dk2nu/tags/v01_07_02'
svn: E175011: Repository moved temporarily to 'https://cdcvs.fnal.gov/subversion/dk2nu/tags/v01_07_02'; please relocate
```
* Used `spack edit dk2nudata` to modify the package recipie file, and changed the repository URL to the one recommended in the above message;
* still got the same error;
* Used `spack info dk2nudata` to verify the URLs are all started with `https`;
* ~~however, the terminal message still showed it was using `http` as before:~~
* deleted `MVP/spackdev-larsoft` but kept other directories under `MVP`;
* retrying `spack dev init -b spackdev-larsoft --default-branch=MVP1a --dag-file ../spack_glue/MVP/templates/larsoft-dag.txt -v larsim`
* `svn` does not honor `http_proxy` env; needs to add the following to `~/.subversion/server`:
```[global]
http-proxy-host = np04-webgw1.cern.ch
http-proxy-port = 3128
```
## spackdev init's "resume" feature
* use ` spack dev init -b spackdev-larsoft --force --default-branch=MVP1a --dag-file $PWD/spack_glue/MVP/templates/larsoft-dag.txt -v larsim`;
* if the command got interupted by error, the `init` can be resumed with:
```
spack clean --all
spack dev init --resume -v # running from MVP/spackdev-larsoft subdirectory.
```