Question: Problem installing flipflop 1.18.0 due to error compiling align.cpp
gravatar for hjshayya254
7 months ago by
hjshayya25410 wrote:

I'm encountering an issue trying to install flipflop on our Linux server. I've tried to do this the typical way, simply typing the following into RStudio:


The package seems to download properly and begin compiling. However, there seems to be an error compiling align.cpp, as I receive the following output:

Using Bioconductor 3.7 (BiocInstaller 1.30.0), R 3.5.1 (2018-07-02).
Installing package(s) ‘flipflop’
trying URL ''
Content type 'application/x-gzip' length 453566 bytes (442 KB)
downloaded 442 KB

* installing *source* package ‘flipflop’ ...
** libs
g++  -I"/usr/share/R/include" -DNDEBUG     -I. -Ispams/linalg -Ispams/prox -Ispams/decomp -Ispams/dags -fopenmp   -DUSE_BLAS_LIB -DNDEBUG -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-oNcpyf/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c FileSplitter.cpp -o FileSplitter.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-oNcpyf/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c R_init_flipflop.c -o R_init_flipflop.o
g++  -I"/usr/share/R/include" -DNDEBUG     -I. -Ispams/linalg -Ispams/prox -Ispams/decomp -Ispams/dags -fopenmp   -DUSE_BLAS_LIB -DNDEBUG -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-oNcpyf/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c align.cpp -o align.o
In file included from align.h:5:0,
                 from align.cpp:5:
commontype.h: In function ‘range_t make_range_t(long int, long int)’:
commontype.h:18:75: error: no matching function for call to ‘make_pair<long int, long int>(long int&, long int&)’
 inline range_t make_range_t(long a,long b){return make_pair<long,long>(a,b);}
In file included from /usr/include/c++/7/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from align.cpp:1:
/usr/include/c++/7/bits/stl_pair.h:519:5: note: candidate: template<class _T1, class _T2> constexpr std::pair<typename std::__decay_and_strip<_Tp>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&)
     make_pair(_T1&& __x, _T2&& __y)
/usr/include/c++/7/bits/stl_pair.h:519:5: note:   template argument deduction/substitution failed:
In file included from align.h:5:0,
                 from align.cpp:5:
commontype.h:18:75: note:   cannot convert ‘a’ (type ‘long int’) to type ‘long int&&’
 inline range_t make_range_t(long a,long b){return make_pair<long,long>(a,b);}
/usr/lib/R/etc/Makeconf:168: recipe for target 'align.o' failed
make: *** [align.o] Error 1
ERROR: compilation failed for package ‘flipflop’
* removing ‘/home/hani/R/x86_64-pc-linux-gnu-library/3.5/flipflop’


As far as I can tell this doesn't seem to be a general problem with our server: I am able to successfully install other R/bioconductor packages and I encountered the same issue when trying to install flipflop on a different server we have in lab. 

I'm wondering if there is something I should be doing differently for the installation or perhaps some dependencies I missed installing? I've provided my sessionInfo below and am extremely grateful for any help you may be able to provide!


> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.1 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/
LAPACK: /usr/lib/x86_64-linux-gnu/

 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] BiocInstaller_1.30.0

loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1    yaml_2.2.0  
flipflop • 167 views
ADD COMMENTlink written 7 months ago by hjshayya25410

I think I've fixed the problem and am providing an update here in case it helps others. 

As far as I can tell it was a problem with the C++ standard that GCC was using to compile the source. I don't know anything about C++, but as far as I can tell from googling there have been some changes to the make_pair function, which may explain the error that was being thrown above. Anyways, I find that passing the flag -std=c++98 to GCC seems to allow proper compilation of align.cpp and everything else. 

To get flipflop installed what I ended up doing was downloaded the .tar.gz archive from bioconductor, unzipping and manually adding the line CXX_STD = CXX98 to the Makevars file in the src subdirectory.

I then re-zipped and installed the package directly in R:

install.packages(pkgs = '/media/storageA/hani/software/flipflop_1.18.0.tar.gz',repos=NULL)

I am sure this is a horrifically inefficient way of doing things and would welcome input from others with more knowledge of this particular issue. Perhaps there is an elegant solution (install.packages has a 'configure.vars' option that perhaps could be used to set the CXXFLAGS environment variable? I have not tested)? Anyways, it seemed to work for me...

ADD REPLYlink written 7 months ago by hjshayya25410

Thanks for working this out! I was having the same problem. I know Elsa so I'll ping her about this. Edit: maybe you could set your ~/.R/Makevars to use C++98? I don't know if bioconductor respects that or not though.

ADD REPLYlink modified 3 months ago • written 3 months ago by knowles840
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 292 users visited in the last hour