Question: Hi everyone !!

I tried to install Zinba, a tool for peak calling used in the analysis of ATAC-seq datas.

- Operating system that I am using : Linux (computing cluster) and R (version 3.4.3)

- Error message : compilation aborted for bed2vector.cc (code 2)
make: *** [bed2vector.o] Error 2
ERROR: compilation failed for package ‘zinba’

- Command used : install.packages("zinba_2.02.03.tar.gz", repos=NULL)
But I've also tried to install zinba_2.03.1.tar.gz and zinba_2.02.04.tar.gz and I have the same error message.

- Copy of the output :
>install.packages("zinba_2.03.1.tar.gz")

Installing package into ‘/sulb2/amontois/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
inferring 'repos = NULL' from 'pkgs'
* installing *source* package ‘zinba’ ...
** libs

icc -I/apps/brussel/CO7/magnycours-ib/software/R/3.4.3-intel-2017b-X11-20171023/lib64/R/include -DNDEBUG -I/apps/brussel/CO7/magnycours-ib/software/imkl/2017.3.196-iimpi-2017b/mkl/include -I/apps/brussel/CO7/magnycours-ib/software/X11/20171023-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/Mesa/17.2.4-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/libGLU/9.0.0-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/cairo/1.14.10-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/libreadline/7.0-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/ncurses/6.0-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/bzip2/1.0.6-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/XZ/5.2.3-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/zlib/1.2.11-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/SQLite/3.20.1-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/PCRE/8.41-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/libpng/1.6.32-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/libjpeg-turbo/1.5.2-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/LibTIFF/4.0.8-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/Java/1.8.0_152/include -I/apps/brussel/CO7/magnycours-ib/software/Tcl/8.6.7-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/Tk/8.6.7-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/cURL/7.56.1-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/libxml2/2.9.4-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/GDAL/2.2.2-intel-2017b-Python-2.7.14/include -I/apps/brussel/CO7/magnycours-ib/software/PROJ/4.9.3-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/GMP/6.1.2-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/NLopt/2.4.2-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/FFTW/3.3.6-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/libsndfile/1.0.28-GCCcore-6.4.0/include -fpic -O2 -xHost -ftz -fp-speculation=safe -fp-model source -c aliType.c -o aliType.o
ire/SQLite/3.20.1-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/PCRE/8.41-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/libpng/1.6.32-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/libjpeg-turbo/1.5.2-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/LibTIFF/4.0.8-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/Java/1.8.0_152/include -I/apps/brussel/CO7/magnycours-ib/software/Tcl/8.6.7-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/Tk/8.6.7-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/cURL/7.56.1-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/libxml2/2.9.4-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/GDAL/2.2.2-intel-2017b-Python-2.7.14/include -I/apps/brussel/CO7/magnycours-ib/software/PROJ/4.9.3-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/GMP/6.1.2-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/NLopt/2.4.2-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/FFTW/3.3.6-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/libsndfile/1.0.28-GCCcore-6.4.0/include -fpic -O2 -xHost -ftz -fp-speculation=safe -fp-model source -c alignAdjust.cc -o alignAdjust.o

[...]

icpc -I/apps/brussel/CO7/magnycours-ib/software/R/3.4.3-intel-2017b-X11-20171023/lib64/R/include -DNDEBUG -I/apps/brussel/CO7/magnycours-ib/software/imkl/2017.3.196-iimpi-2017b/mkl/include -I/apps/brussel/CO7/magnycours-ib/software/X11/20171023-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/Mesa/17.2.4-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/libGLU/9.0.0-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/cairo/1.14.10-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/libreadline/7.0-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/ncurses/6.0-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/bzip2/1.0.6-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/XZ/5.2.3-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/zlib/1.2.11-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/SQLite/3.20.1-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/PCRE/8.41-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/libpng/1.6.32-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/libjpeg-turbo/1.5.2-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/LibTIFF/4.0.8-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/Java/1.8.0_152/include -I/apps/brussel/CO7/magnycours-ib/software/Tcl/8.6.7-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/Tk/8.6.7-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/cURL/7.56.1-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/libxml2/2.9.4-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/GDAL/2.2.2-intel-2017b-Python-2.7.14/include -I/apps/brussel/CO7/magnycours-ib/software/PROJ/4.9.3-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/GMP/6.1.2-GCCcore-6.4.0/include -I/apps/brussel/CO7/magnycours-ib/software/NLopt/2.4.2-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/FFTW/3.3.6-intel-2017b/include -I/apps/brussel/CO7/magnycours-ib/software/libsndfile/1.0.28-GCCcore-6.4.0/include -fpic -O2 -xHost -ftz -fp-speculation=safe -fp-model source -c bed2vector.cc -o bed2vector.o
In file included from /gpfs/software/CO7/magnycours-ib/software/GCCcore/6.4.0/bin/../include/c++/6.4.0/ext/hash_set(60),
from pc.h(5),
from bed2vector.cc(1):
/gpfs/software/CO7/magnycours-ib/software/GCCcore/6.4.0/bin/../include/c++/6.4.0/backward/backward_warning.h(32): warning #1224: #warning directive: This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated.
#warning \
^

bed2vector.cc(41): error: "hash" is ambiguous
hash_map,equal_to > cind_map;
^

bed2vector.cc(111): error: "hash" is ambiguous
hash_map,equal_to >::const_iterator li=cind_map.find(chr);
^

compilation aborted for bed2vector.cc (code 2)
make: *** [bed2vector.o] Error 2
ERROR: compilation failed for package ‘zinba’
* removing ‘/sulb2/amontois/R/x86_64-pc-linux-gnu-library/3.4/zinba’
Warning message:
In install.packages("zinba_2.03.1.tar.gz") :
installation of package ‘zinba_2.03.1.tar.gz’ had non-zero exit status

- It seems to have an error with the installation of bed2vector... But I don't really understand what's wrong...
Can you help me to solve this problem of installation please ??
Thank you in advance !

Anais

Answer: The ZINBA code was written before C++11, which is when `hash` was added to the standard library, and so the authors used the g++ extension instead. Based on your output, the compiler is using C++11 (or later), so it has two versions of the class `hash` available and can't figure out which to use.

Quick Fix
---
You can temporarily direct the compiler to use a specific C++ version for installation using `withr::makevars`. Try

library(withr)
with_makevars(c(CXXFLAGS = "-std=gnu++98"), install.packages("zinba_2.03.1.tar.gz", repos = NULL))

Long Game
---
I hit different errors than you on both OS X (clang) and Linux (g++), so expect to hack on the code to get it working ([I started to last year](https://github.com/mfansler/zinba), but had other priorities). A more permanent workaround for your issue is to untar/zip the archive and add a **Makevars** file to the `zinba/src` directory containing the line:

PKG_CXXFLAGS = -std=gnu++98

Leave the source unzipped and install with `install.packages("your/path/to/zinba", repos = NULL, type = "source")`.