edgeR compilation error: with g++ 4.9.2 and R-5.0 on linux platform
1
0
Entering edit mode
@pengcheng-yang-6055
Last seen 2.9 years ago
China

I have searched this forum, and found some threads (edgeR installation issue, Can't install edgeR because of compilation error: make: *** [R_add_prior_count.o] Error 1 ) on this topic but don't resolved my problem. According to the discussion, this problem is caused by the old version of g++ library. However, in my case, the error remain with g++ version 4.9.2, which is said to support c++11. I am testing g++ version 5.5. 

Thank you!

> install.packages(repos=NULL,"~/soft/R/R_package_archive/edgeR_3.22.5.tar.gz")
* installing *source* package 'edgeR' ...
** libs
g++ -std=gnu++0x -I"/histor/kang/yangpc/soft/R/R_soft/lib64/R/include" -DNDEBUG  -I"/histor/kang/yangpc/soft/R/R_soft/lib64/R/library/Rcpp/include" -I/histor/kang/yangpc/soft/lib/packages/bzip2-1.0.6/include/ -I/histor/kang/yangpc/soft/lib/zlib-1.2.8/include/ -I/histor/kang/yangpc/soft/lib/packages/xz-5.2.2/include/ -I/histor/kang/yangpc/soft/lib/packages/pcre-8.39/include/ -I/histor/kang/yangpc/soft/lib/packages/curl-7.52.1/include/   -fpic  -g -O2 -c R_add_prior_count.cpp -o R_add_prior_count.o
In file included from /histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/bits/localefwd.h:40:0,
                 from /histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/string:43,
                 from /histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/stdexcept:39,
                 from /histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/array:38,
                 from /histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/tuple:39,
                 from /histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/unordered_map:41,
                 from /histor/kang/yangpc/soft/R/R_soft/lib64/R/library/Rcpp/include/Rcpp/platform/compiler.h:153,
                 from /histor/kang/yangpc/soft/R/R_soft/lib64/R/library/Rcpp/include/Rcpp/r/headers.h:59,
                 from /histor/kang/yangpc/soft/R/R_soft/lib64/R/library/Rcpp/include/RcppCommon.h:29,
                 from /histor/kang/yangpc/soft/R/R_soft/lib64/R/library/Rcpp/include/Rcpp.h:27,
                 from utils.h:9,
                 from R_add_prior_count.cpp:1:
/histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/x86_64-unknown-linux-gnu/bits/c++locale.h:52:23: error: 'uselocale' was not declared in this scope
   extern "C" __typeof(uselocale) __uselocale;
                       ^
/histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/x86_64-unknown-linux-gnu/bits/c++locale.h:52:45: error: invalid type in declaration before ';' token
   extern "C" __typeof(uselocale) __uselocale;
                                             ^
/histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/x86_64-unknown-linux-gnu/bits/c++locale.h: In function 'int std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)':
/histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/x86_64-unknown-linux-gnu/bits/c++locale.h:75:53: error: '__gnu_cxx::__uselocale' cannot be used as a function
     __c_locale __old = __gnu_cxx::__uselocale(__cloc);
                                                     ^
/histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/x86_64-unknown-linux-gnu/bits/c++locale.h:100:33: error: '__gnu_cxx::__uselocale' cannot be used as a function
     __gnu_cxx::__uselocale(__old);
                                 ^
In file included from /usr/include/stdio.h:929:0,
                 from /histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/cstdio:42,
                 from /histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/ext/string_conversions.h:43,
                 from /histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/bits/basic_string.h:2850,
                 from /histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/string:52,
                 from /histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/stdexcept:39,
                 from /histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/array:38,
                 from /histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/tuple:39,
                 from /histor/kang/yangpc/soft/lib/gcc-4.9.2/include/c++/4.9.2/unordered_map:41,
                 from /histor/kang/yangpc/soft/R/R_soft/lib64/R/library/Rcpp/include/Rcpp/platform/compiler.h:153,
                 from /histor/kang/yangpc/soft/R/R_soft/lib64/R/library/Rcpp/include/Rcpp/r/headers.h:59,
                 from /histor/kang/yangpc/soft/R/R_soft/lib64/R/library/Rcpp/include/RcppCommon.h:29,
                 from /histor/kang/yangpc/soft/R/R_soft/lib64/R/library/Rcpp/include/Rcpp.h:27,
                 from utils.h:9,
                 from R_add_prior_count.cpp:1:
/usr/include/bits/stdio.h: In function '__ssize_t getline(char**, size_t*, FILE*)':
/usr/include/bits/stdio.h:118:52: error: '__getdelim' was not declared in this scope
   return __getdelim (__lineptr, __n, '\n', __stream);
                                                    ^
make: *** [R_add_prior_count.o] Error 1
ERROR: compilation failed for package 'edgeR'
* removing '/histor/kang/yangpc/soft/R/R_soft/lib64/R/library/edgeR'
* restoring previous '/histor/kang/yangpc/soft/R/R_soft/lib64/R/library/edgeR'
Warning message:
In install.packages(repos = NULL, "~/soft/R/R_package_archive/edgeR_3.22.5.tar.gz") :
  installation of package '/histor/kang/yangpc//soft/R/R_package_archive/edgeR_3.22.5.tar.gz' had non-zero exit status
> system("g++ --version")
g++ (GCC) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Update: Now, an alternative solution is to use old version of edgeR (3.16.5) and gcc (4.4.7). I have tested edgeR > 3.16.5 can not be compiled through gcc version 4.9.2. 

edger compilation error • 2.8k views
ADD COMMENT
2
Entering edit mode

I believe the problem is -std=g++-0x which tells your new compiler to use an old standard. Likely this was set when your R was installed, maybe with an old gcc.

ADD REPLY
0
Entering edit mode

Hi Martin Morgan, thank you very much. During the installation R from the source, by default, the compilers using gnu++98. I will provide my testing process by adding a new answer.

R is now configured for x86_64-pc-linux-gnu

  Source directory:          .
  Installation directory:    /histor/kang/yangpc/soft/R/R_soft

  C compiler:                gcc -std=gnu99  -g -O2
  Fortran 77 compiler:       gfortran  -g -O2

  Default C++ compiler:      g++ -std=gnu++98   -g -O2
  C++98 compiler:            g++ -std=gnu++98 -std=gnu++98 -g -O2
  C++11 compiler:            g++ -std=gnu++98 -std=gnu++0x -g -O2
  C++14 compiler:              
  C++17 compiler:              
  Fortran 90/95 compiler:    gfortran -g -O2
  Obj-C compiler:            gcc -g -O2 -fobjc-exceptions

  Interfaces supported:      X11, tcltk
  External libraries:        readline, curl
  Additional capabilities:   PNG, JPEG, NLS, cairo
  Options enabled:           shared R library, shared BLAS, R profiling

  Capabilities skipped:      TIFF, ICU
  Options not enabled:       memory profiling

  Recommended packages:      yes

 

ADD REPLY
2
Entering edit mode
@gordon-smyth
Last seen 5 hours ago
WEHI, Melbourne, Australia

You need to use a more up-to-date version of gcc. I am using gcc 7.3.0. edgeR compiles fine for me with any gcc 6.3.0 or later.

The current version of edgeR is faster and more memory efficient than older versions. Since edgeR and gcc are both free, why use old software? The latest gcc is 8.2.

Update

After more experimentation, I find that I can compile the latest release version of edgeR even with the oldest gcc I have, which is 4.9.3. Aaron and Martin have instead identified problems with your gcc setup and R compilation.

ADD COMMENT
2
Entering edit mode

Actually, edgeR compiles fine for me with gcc 4.8.5:

> BiocManager::install('edgeR')
Bioconductor version 3.8 (BiocManager 1.30.2), R 3.5.1 Patched (2018-09-06
  r75247)
Installing package(s) 'edgeR'
trying URL 'https://bioconductor.org/packages/3.8/bioc/src/contrib/edgeR_3.23.5.tar.gz'
Content type 'application/x-gzip' length 1571848 bytes (1.5 MB)
==================================================
downloaded 1.5 MB

* installing *source* package ‘edgeR’ ...
** libs
g++ -std=gnu++11 -I"/home/jmlab/software/R/devel/include" -DNDEBUG  -I"/home/jmlab/software/R/R-3-5-branch_devel/library/Rcpp/include" -I/usr/local/include   -fpic  -g -O2 -c R_add_prior_count.cpp -o R_add_prior_count.o
g++ -std=gnu++11 -I"/home/jmlab/software/R/devel/include" -DNDEBUG  -I"/home/jmlab/software/R/R-3-5-branch_devel/library/Rcpp/include" -I/usr/local/include   -fpic  -g -O2 -c R_ave_log_cpm.cpp -o R_ave_log_cpm.o
g++ -std=gnu++11 -I"/home/jmlab/software/R/devel/include" -DNDEBUG  -I"/home/jmlab/software/R/R-3-5-branch_devel/library/Rcpp/include" -I/usr/local/include   -fpic  -g -O2 -c R_calculate_cpm.cpp -o R_calculate_cpm.o
g++ -std=gnu++11 -I"/home/jmlab/software/R/devel/include" -DNDEBUG  -I"/home/jmlab/software/R/R-3-5-branch_devel/library/Rcpp/include" -I/usr/local/include   -fpic  -g -O2 -c R_check_poisson_bound.cpp -o R_check_poisson_bound.o
g++ -std=gnu++11 -I"/home/jmlab/software/R/devel/include" -DNDEBUG  -I"/home/jmlab/software/R/R-3-5-branch_devel/library/Rcpp/include" -I/usr/local/include   -fpic  -g -O2 -c R_compute_apl.cpp -o R_compute_apl.o
# etc. etc. Cut out due to post character limits.
g++ -std=gnu++11 -I"/home/jmlab/software/R/devel/include" -DNDEBUG  -I"/home/jmlab/software/R/R-3-5-branch_devel/library/Rcpp/include" -I/usr/local/include   -fpic  -g -O2 -c nbdev.cpp -o nbdev.o
g++ -std=gnu++11 -I"/home/jmlab/software/R/devel/include" -DNDEBUG  -I"/home/jmlab/software/R/R-3-5-branch_devel/library/Rcpp/include" -I/usr/local/include   -fpic  -g -O2 -c objects.cpp -o objects.o
g++ -std=gnu++11 -shared -L/usr/local/lib64 -o edgeR.so R_add_prior_count.o R_ave_log_cpm.o R_calculate_cpm.o R_check_poisson_bound.o R_compute_apl.o R_compute_nbdev.o R_exact_test_by_deviance.o R_fit_levenberg.o R_fit_one_group.o R_get_one_way_fitted.o R_initialize_levenberg.o R_loess_by_col.o R_maximize_interpolant.o R_process_hairpin_reads.o R_simple_good_turing.o add_prior.o adj_coxreid.o fmm_spline.o glm_levenberg.o glm_one_group.o init.o interpolator.o nbdev.o objects.o -L/home/jmlab/software/R/devel/lib -lRlapack -L/home/jmlab/software/R/devel/lib -lRblas -lgfortran -lm -lquadmath
installing to /home/jmlab/software/R/R-3-5-branch_devel/library/edgeR/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (edgeR)

The downloaded source packages are in
    ‘/tmp/RtmpGcoiM9/downloaded_packages’
Update old packages: 'BiocNeighbors', 'BiocParallel', 'biocViews', 'biomaRt',
  'DelayedMatrixStats', 'evaluate', 'fansi', 'GenomeInfoDbData',
  'GenomicFeatures', 'hdf5r', 'mime', 'scran'
Update all/some/none? [a/s/n]: n
> sessionInfo()
R version 3.5.1 Patched (2018-09-06 r75247)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS: /home/jmlab/software/R/R-3-5-branch_devel/lib/libRblas.so
LAPACK: /home/jmlab/software/R/R-3-5-branch_devel/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C             
[3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8   
[5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8  
[7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                
[9] LC_ADDRESS=C               LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

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

loaded via a namespace (and not attached):
[1] BiocManager_1.30.2 compiler_3.5.1     tools_3.5.1      
> system("g++ --version")
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

... so I would say that this is more of an issue with the OP's non-system GCC set-up, see https://stackoverflow.com/questions/26900783/unable-to-compile-any-c-code for example.

ADD REPLY
0
Entering edit mode

Hi Aaron, I agree with you. I have installed R and all the libraries based on gcc version 4.4.7, if not specifically required higher version of gcc. Now, I will install the latest edgeR using gcc 4.9.2, or 7.3.0 (downloading now). There maybe conflicts between the compiled R and the to be installed edgeR. Maybe the thorough solution is to install all the conflict software based on the latest gcc.

Thank you for the information.

ADD REPLY

Login before adding your answer.

Traffic: 894 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6