Skip to content

[Bug] The command: x86_64-unknown-linux-gnu-gcc -v failed with error: Error: spawn x86_64-unknown-linux-gnu-gcc ENOENT #4580

@haozia816

Description

@haozia816

Brief Issue Summary

在cmake-tools-kits.json中自行添加交叉编译工具,就会出现该错误,手动使用cmake命令一切正常无任何错误,仅在vscode-cmake-tools中报错,gcc使用crosstool-ng编译

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.104.1",
  "cmtVersion": "1.21.36",
  "configurations": [
    {
      "folder": "/root/untitled",
      "cmakeVersion": "3.25.3",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": false,
      "compilers": {
        "C": "/opt/gcc/linux-x86_64-kernel2.6.32-glibc2.12-gcc9/bin/x86_64-unknown-linux-gnu-gcc",
        "CXX": "/opt/gcc/linux-x86_64-kernel2.6.32-glibc2.12-gcc9/bin/x86_64-unknown-linux-gnu-g++"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": true,
    "activeBuildType": "Debug",
    "buildTypesSeen": [
      "Debug"
    ],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 1,
    "executablesCount": 1,
    "librariesCount": 0,
    "targets": [
      {
        "name": "untitled",
        "type": "EXECUTABLE"
      }
    ]
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}

Debug Log

[main] Configuring project: untitled 
[main] Saving open files before configure/build
[expand] expanded ${workspaceFolder}/build
[driver] Start configure 
[driver] Running pre-configure checks and steps
[driver] Using compilers in linux-x86_64-kernel2.6.32-glibc2.12-gcc9 for configure
[driver] Using CMake toolchain linux-x86_64-kernel2.6.32-glibc2.12-gcc9 for configuring
[expand] expanded ${workspaceFolder}/build
[cmakefileapi-driver] Configuring using kit
[cmakefileapi-driver] Invoking CMake /usr/local/bin/cmake with arguments ["-DCMAKE_BUILD_TYPE:STRING=Debug","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_C_COMPILER:FILEPATH=/opt/gcc/linux-x86_64-kernel2.6.32-glibc2.12-gcc9/bin/x86_64-unknown-linux-gnu-gcc","-DCMAKE_CXX_COMPILER:FILEPATH=/opt/gcc/linux-x86_64-kernel2.6.32-glibc2.12-gcc9/bin/x86_64-unknown-linux-gnu-g++","-DCMAKE_TOOLCHAIN_FILE:FILEPATH=/opt/cmake-gcc/linux-x86_64-kernel2.6.32-glibc2.12-gcc9.cmake","--no-warn-unused-cli","-S","/root/untitled","-B","/root/untitled/build","-G","Ninja"]
[proc] Executing command: /usr/local/bin/cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/opt/gcc/linux-x86_64-kernel2.6.32-glibc2.12-gcc9/bin/x86_64-unknown-linux-gnu-gcc -DCMAKE_CXX_COMPILER:FILEPATH=/opt/gcc/linux-x86_64-kernel2.6.32-glibc2.12-gcc9/bin/x86_64-unknown-linux-gnu-g++ -DCMAKE_TOOLCHAIN_FILE:FILEPATH=/opt/cmake-gcc/linux-x86_64-kernel2.6.32-glibc2.12-gcc9.cmake --no-warn-unused-cli -S /root/untitled -B /root/untitled/build -G Ninja
[proc]   with environment: {"CHROME_DESKTOP":"code.desktop","DBUS_SESSION_BUS_ADDRESS":"unix:path=/run/user/0/bus","DISPLAY":"localhost:10.0","ELECTRON_NO_ATTACH_CONSOLE":"1","GDK_BACKEND":"x11","HOME":"/root","LANG":"en_US.UTF-8","LESSCLOSE":"/usr/bin/lesspipe %s %s","LESSOPEN":"| /usr/bin/lesspipe %s","LOGNAME":"root","LS_COLORS":"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:","MOTD_SHOWN":"pam","NO_AT_BRIDGE":"1","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","PATH":"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin","PWD":"/root","SHELL":"/bin/bash","SHLVL":"1","SSH_CLIENT":"192.168.88.1 57225 22","SSH_CONNECTION":"192.168.88.1 57225 192.168.88.147 22","SSH_TTY":"/dev/pts/0","TERM":"xterm","USER":"root","VSCODE_CLI":"1","VSCODE_CODE_CACHE_PATH":"/root/.config/Code/CachedData/0f0d87fa9e96c856c5212fc86db137ac0d783365","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/root","VSCODE_ESM_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/run/user/0/vscode-e97a7041-1.10-main.sock","VSCODE_NLS_CONFIG":"{\"userLocale\":\"en-us\",\"osLocale\":\"en-us\",\"resolvedLanguage\":\"en\",\"defaultMessagesFile\":\"/usr/share/code/resources/app/out/nls.messages.json\",\"locale\":\"en-us\",\"availableLanguages\":{}}","VSCODE_PID":"2055","XDG_DATA_DIRS":"/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop","XDG_RUNTIME_DIR":"/run/user/0","XDG_SESSION_CLASS":"user","XDG_SESSION_ID":"2","XDG_SESSION_TYPE":"tty","_":"/usr/bin/code","ELECTRON_RUN_AS_NODE":"1","APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL":"1","APPLICATIONINSIGHTS_CONFIGURATION_CONTENT":"{}","VSCODE_L10N_BUNDLE_LOCATION":""}
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: /root/untitled/build
[cmakefileapi-parser] Read reply folder: /root/untitled/build/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: ["cache-v2-b21b558ef11870e650bb.json","cmakeFiles-v1-62df6d192bbbf27c20ad.json","codemodel-v2-fcd9d0c515f7c880baf9.json","directory-.-Debug-3e670dc88f9cd7e02236.json","index-2025-09-25T05-18-32-0902.json","target-untitled-Debug-1f51bf3b09f89de7a521.json","toolchains-v1-ac37ccb2e45c9d234084.json"]
[proc] The command: x86_64-unknown-linux-gnu-gcc -v failed with error: Error: spawn x86_64-unknown-linux-gnu-gcc ENOENT
[proc] The command: x86_64-unknown-linux-gnu-g++ -v failed with error: Error: spawn x86_64-unknown-linux-gnu-g++ ENOENT
[cache] Reading CMake cache file /root/untitled/build/CMakeCache.txt
[cache] Parsing CMake cache string
[extension] [2739] cmake.configure finished (returned 0)

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    buga bug in the product

    Type

    No type

    Projects

    Status

    Completed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions