I installed gcc 11 using homebrew on my machine (linux 20.04). And It is not running on vscode as it shows
as: unrecognized option '--gdwarf-5'
I'm not sure if it's a path problem or not. Cause when I installed brew it told me
Warning: /home/linuxbrew/.linuxbrew/bin/ is not in your PATH.
to fix this it suggested these three commands
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /home/hasib/.profile
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/hasib/.profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
So, I did those. And I don't know if this screwed up the PATH. I'm kinda new to Linux so confused. Just wanna run gcc-11 on vs.
this is my tasks.json file :
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
},
{
"type": "cppbuild",
"label": "Build with GCC 11.3.0",
"command": "/home/linuxbrew/.linuxbrew/bin/g++-11",
"args": [
"-fdiagnostics-color=always",
"-g",
"-std=c++20",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "compiler: /home/linuxbrew/.linuxbrew/bin/g++-11"
},
{
"type": "cppbuild",
"label": "C/C++: g++-10 build active file",
"command": "/usr/bin/g++-10",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "compiler: /usr/bin/g++-10"
}
],
"version": "2.0.0"
}
launch.json :
{
"version": "0.2.0",
"configurations": []
}
Output of gcc-11 --version :
gcc-11 (Homebrew GCC 11.3.0) 11.3.0
Copyright (C) 2021 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.
Output of gdb --version :
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
as(the GNU assembler) is part of the binutils package. You need to install a recent version of binutils whereashas support for the--gdwarf-5flag and ensure that it is the one used bygcc-11.You can check whether the
asin your $PATH has support for that flag by runningIf it does, it return contain the line:
If that is not returned, try installing the latest version of binutils via linuxbrew (and, just in case you haven't, restart your desktop session to ensure that all your terminals and vscode get the updates to $PATH, etc.)