Error in installing R pakages

Hey guys , I'm new to R. I tried to install ggplot2 packages and I faced like those error.
I am using CentOS 8 , R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out" and gcc (Homebrew GCC 5.5.0_7) 5.5.0
The error is as follow.

> install.packages("ggplot2")
Installing package into ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
also installing the dependencies ‘backports’, ‘rprojroot’, ‘pkgbuild’, ‘diffobj’, ‘rematch2’, ‘brio’, ‘callr’, ‘desc’, ‘jsonlite’, ‘pkgload’, ‘processx’, ‘ps’, ‘waldo’, ‘colorspace’, ‘utf8’, ‘testthat’, ‘farver’, ‘lifecycle’, ‘munsell’, ‘cli’, ‘ellipsis’, ‘fansi’, ‘pillar’, ‘vctrs’, ‘digest’, ‘glue’, ‘isoband’, ‘rlang’, ‘scales’, ‘tibble’
trying URL 'https://cloud.r-project.org/src/contrib/backports_1.2.0.tar.gz'
Content type 'application/x-gzip' length 21014 bytes (20 KB)
==================================================
downloaded 20 KB


* installing *source* package ‘backports’ ...
** package ‘backports’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -m64 -I"/usr/include/R" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -c dotsElt.c -o dotsElt.o
cc1: error: unrecognized command line option '-fstack-clash-protection'
cc1: error: unrecognized command line option '-fcf-protection'
cc1: fatal error: inaccessible plugin file /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/annobin.so expanded from short plugin name annobin: No such file or directory
compilation terminated.
make: *** [/usr/lib64/R/etc/Makeconf:172: dotsElt.o] Error 1
ERROR: compilation failed for package ‘backports’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/backports’
* installing *source* package ‘diffobj’ ...
** package ‘diffobj’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -m64 -I"/usr/include/R" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -c diff.c -o diff.o
cc1: error: unrecognized command line option '-fstack-clash-protection'
cc1: error: unrecognized command line option '-fcf-protection'
cc1: fatal error: inaccessible plugin file /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/annobin.so expanded from short plugin name annobin: No such file or directory
compilation terminated.
make: *** [/usr/lib64/R/etc/Makeconf:172: diff.o] Error 1
ERROR: compilation failed for package ‘diffobj’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/diffobj’
* installing *source* package ‘brio’ ...
** package ‘brio’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -m64 -I"/usr/include/R" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -c brio.c -o brio.o
cc1: error: unrecognized command line option '-fstack-clash-protection'
cc1: error: unrecognized command line option '-fcf-protection'
cc1: fatal error: inaccessible plugin file /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/annobin.so expanded from short plugin name annobin: No such file or directory
compilation terminated.
make: *** [/usr/lib64/R/etc/Makeconf:172: brio.o] Error 1
ERROR: compilation failed for package ‘brio’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/brio’
* installing *source* package ‘jsonlite’ ...
** package ‘jsonlite’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -m64 -I"/usr/include/R" -DNDEBUG -Iyajl/api  -I/usr/local/include  -fvisibility=hidden  -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -c base64.c -o base64.o
cc1: error: unrecognized command line option '-fstack-clash-protection'
cc1: error: unrecognized command line option '-fcf-protection'
cc1: fatal error: inaccessible plugin file /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/annobin.so expanded from short plugin name annobin: No such file or directory
compilation terminated.
make: *** [/usr/lib64/R/etc/Makeconf:172: base64.o] Error 1
ERROR: compilation failed for package ‘jsonlite’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/jsonlite’
* installing *source* package ‘ps’ ...
** package ‘ps’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -m64 -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -Wall px.c -o px
cc1: error: unrecognized command line option '-fstack-clash-protection'
cc1: error: unrecognized command line option '-fcf-protection'
cc1: fatal error: inaccessible plugin file /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/annobin.so expanded from short plugin name annobin: No such file or directory
compilation terminated.
make: *** [Makevars:11: px] Error 1
ERROR: compilation failed for package ‘ps’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/ps’
* installing *source* package ‘colorspace’ ...
** package ‘colorspace’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -m64 -I"/usr/include/R" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -c colorspace.c -o colorspace.o
cc1: error: unrecognized command line option '-fstack-clash-protection'
cc1: error: unrecognized command line option '-fcf-protection'
cc1: fatal error: inaccessible plugin file /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/annobin.so expanded from short plugin name annobin: No such file or directory
compilation terminated.
make: *** [/usr/lib64/R/etc/Makeconf:172: colorspace.o] Error 1
ERROR: compilation failed for package ‘colorspace’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/colorspace’
* installing *source* package ‘utf8’ ...
** package ‘utf8’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -m64 -I"/usr/include/R" -DNDEBUG   -I/usr/local/include  -Iutf8lite/src -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -c as_utf8.c -o as_utf8.o
cc1: error: unrecognized command line option '-fstack-clash-protection'
cc1: error: unrecognized command line option '-fcf-protection'
cc1: fatal error: inaccessible plugin file /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/annobin.so expanded from short plugin name annobin: No such file or directory
compilation terminated.
make: *** [/usr/lib64/R/etc/Makeconf:172: as_utf8.o] Error 1
ERROR: compilation failed for package ‘utf8’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/utf8’
* installing *source* package ‘farver’ ...
** package ‘farver’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -c ColorSpace.cpp -o ColorSpace.o
cc1plus: error: unrecognized command line option '-fstack-clash-protection'
cc1plus: error: unrecognized command line option '-fcf-protection'
cc1plus: fatal error: inaccessible plugin file /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/annobin.so expanded from short plugin name annobin: No such file or directory
compilation terminated.
make: *** [/usr/lib64/R/etc/Makeconf:181: ColorSpace.o] Error 1
ERROR: compilation failed for package ‘farver’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/farver’
* installing *source* package ‘fansi’ ...
** package ‘fansi’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -m64 -I"/usr/include/R" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -c assumptions.c -o assumptions.o
cc1: error: unrecognized command line option '-fstack-clash-protection'
cc1: error: unrecognized command line option '-fcf-protection'
cc1: fatal error: inaccessible plugin file /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/annobin.so expanded from short plugin name annobin: No such file or directory
compilation terminated.
make: *** [/usr/lib64/R/etc/Makeconf:172: assumptions.o] Error 1
ERROR: compilation failed for package ‘fansi’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/fansi’
* installing *source* package ‘digest’ ...
** package ‘digest’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -c SpookyV2.cpp -o SpookyV2.o
cc1plus: error: unrecognized command line option '-fstack-clash-protection'
cc1plus: error: unrecognized command line option '-fcf-protection'
cc1plus: fatal error: inaccessible plugin file /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/annobin.so expanded from short plugin name annobin: No such file or directory
compilation terminated.
make: *** [/usr/lib64/R/etc/Makeconf:181: SpookyV2.o] Error 1
ERROR: compilation failed for package ‘digest’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/digest’
* installing *source* package ‘glue’ ...
** package ‘glue’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -m64 -I"/usr/include/R" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -c glue.c -o glue.o
cc1: error: unrecognized command line option '-fstack-clash-protection'
cc1: error: unrecognized command line option '-fcf-protection'
cc1: fatal error: inaccessible plugin file /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/annobin.so expanded from short plugin name annobin: No such file or directory
compilation terminated.
make: *** [/usr/lib64/R/etc/Makeconf:172: glue.o] Error 1
ERROR: compilation failed for package ‘glue’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/glue’
* installing *source* package ‘rlang’ ...
** package ‘rlang’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -m64 -I"/usr/include/R" -DNDEBUG -I./lib/  -I/usr/local/include  -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -c capture.c -o capture.o
cc1: error: unrecognized command line option '-fstack-clash-protection'
cc1: error: unrecognized command line option '-fcf-protection'
cc1: fatal error: inaccessible plugin file /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/annobin.so expanded from short plugin name annobin: No such file or directory
compilation terminated.
make: *** [/usr/lib64/R/etc/Makeconf:172: capture.o] Error 1
ERROR: compilation failed for package ‘rlang’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/rlang’
ERROR: dependency ‘backports’ is not available for package ‘rprojroot’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/rprojroot’
ERROR: dependency ‘ps’ is not available for package ‘processx’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/processx’
ERROR: dependencies ‘glue’, ‘rlang’ are not available for package ‘lifecycle’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/lifecycle’
ERROR: dependency ‘colorspace’ is not available for package ‘munsell’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/munsell’
ERROR: dependencies ‘glue’, ‘fansi’ are not available for package ‘cli’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/cli’
ERROR: dependency ‘rlang’ is not available for package ‘ellipsis’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/ellipsis’
ERROR: dependency ‘processx’ is not available for package ‘callr’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/callr’
ERROR: dependency ‘rprojroot’ is not available for package ‘desc’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/desc’
ERROR: dependencies ‘ellipsis’, ‘digest’, ‘glue’, ‘rlang’ are not available for package ‘vctrs’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/vctrs’
ERROR: dependencies ‘farver’, ‘lifecycle’, ‘munsell’ are not available for package ‘scales’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/scales’
ERROR: dependencies ‘callr’, ‘cli’, ‘desc’, ‘rprojroot’ are not available for package ‘pkgbuild’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/pkgbuild’
ERROR: dependencies ‘cli’, ‘ellipsis’, ‘fansi’, ‘lifecycle’, ‘rlang’, ‘utf8’, ‘vctrs’ are not available for package ‘pillar’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/pillar’
ERROR: dependencies ‘cli’, ‘desc’, ‘pkgbuild’, ‘rlang’, ‘rprojroot’ are not available for package ‘pkgload’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/pkgload’
ERROR: dependencies ‘cli’, ‘ellipsis’, ‘fansi’, ‘lifecycle’, ‘pillar’, ‘rlang’, ‘vctrs’ are not available for package ‘tibble’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/tibble’
ERROR: dependency ‘tibble’ is not available for package ‘rematch2’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/rematch2’
ERROR: dependencies ‘cli’, ‘diffobj’, ‘fansi’, ‘glue’, ‘rematch2’, ‘rlang’, ‘tibble’ are not available for package ‘waldo’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/waldo’
ERROR: dependencies ‘brio’, ‘callr’, ‘cli’, ‘desc’, ‘digest’, ‘ellipsis’, ‘jsonlite’, ‘lifecycle’, ‘pkgload’, ‘processx’, ‘ps’, ‘rlang’, ‘waldo’ are not available for package ‘testthat’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/testthat’
ERROR: dependency ‘testthat’ is not available for package ‘isoband’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/isoband’
ERROR: dependencies ‘digest’, ‘glue’, ‘isoband’, ‘rlang’, ‘scales’, ‘tibble’ are not available for package ‘ggplot2’
* removing ‘/home/aungthetkhaing/R/x86_64-redhat-linux-gnu-library/4.0/ggplot2’

The downloaded source packages are in
	‘/tmp/RtmpMovS4X/downloaded_packages’
There were 31 warnings (use warnings() to see them)
>

I can't promise it will fix your problem, but i would try a higher gcc version

I tried to upgrade gcc version. but It doesn't upgrade to new. still gcc on 5.5.0.

What method did you try?

I tried as per this Install latest GCC from source on Centos Linux release | by Bipul Kuri | Medium
download a new gcc package and follow the instructions
and also tried with

brew install gcc@9
also.

Its unclear to me what you experienced. You jumped through every hoop listed, and when you got to the end nothing had changed ? but in my experience that would only tend to happen if you hadnt noticed some error / issue along the way.

yes. I got no error and issue. But nothing had changed at the end.

brew install gcc 

?

Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
showkey
==> Updated Formulae
Updated 15 formulae.

Warning: gcc 5.5.0_7 is already installed and up-to-date
To reinstall 5.5.0_7, run brew reinstall gcc

Hang on, are you on a linux distro, or a macos? You may need to have the latest xcode?

I'm on linux distro, CentOS 8...

Perhaps try brew update ?

I already tried brew update.
It's on ..
$brew --version
Homebrew 2.5.8
Homebrew/linuxbrew-core (git revision 88524c; last commit 2020-11-08)

Im sorry, I'm out of ideas . Perhaps there's a forum for brew where you can get help

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.