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.
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.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.