gcc
)丢失了,我似乎无法安装它。
/mingw64/bin/
关注来自ThisGuide
的步骤,我可以尝试(并且失败)安装
gcc
::
gcc.exe
遵守解决方案:在这些解决方案中
gcc
的输出保持不变。
安装之前,请浏览Samuel@DESKTOP-SFKF6FE MINGW64 ~
# pacman -Syu
pacman -Su
:: Synchronizing package databases...
clangarm64 is up to date
mingw32 is up to date
mingw64 is up to date
ucrt64 is up to date
clang64 is up to date
msys is up to date
:: Starting core system upgrade...
there is nothing to do
:: Starting full system upgrade...
there is nothing to do
:: Starting core system upgrade...
there is nothing to do
:: Starting full system upgrade...
there is nothing to do
Samuel@DESKTOP-SFKF6FE MINGW64 ~
# pacman -S mingw-w64-x86_64-gcc
warning: mingw-w64-x86_64-gcc-14.2.0-3 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...
Packages (1) mingw-w64-x86_64-gcc-14.2.0-3
Total Installed Size: 224.99 MiB
Net Upgrade Size: 0.00 MiB
:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring [###############################] 100%
(1/1) checking package integrity [###############################] 100%
(1/1) loading package files [###############################] 100%
(1/1) checking for file conflicts [###############################] 100%
(1/1) checking available disk space [###############################] 100%
warning: could not get file information for mingw64/bin/c++.exe
warning: could not get file information for mingw64/bin/cc.exe
warning: could not get file information for mingw64/bin/cpp.exe
warning: could not get file information for mingw64/bin/g++.exe
warning: could not get file information for mingw64/bin/gcc.exe
warning: could not get file information for mingw64/bin/x86_64-w64-mingw32-c++.exe
warning: could not get file information for mingw64/bin/x86_64-w64-mingw32-cc.exe
warning: could not get file information for mingw64/bin/x86_64-w64-mingw32-g++.exe
warning: could not get file information for mingw64/bin/x86_64-w64-mingw32-gcc-14.2.0.exe
warning: could not get file information for mingw64/bin/x86_64-w64-mingw32-gcc.exe
:: Processing package changes...
(1/1) reinstalling mingw-w64-x86_64-gcc [###############################] 100%
warning: warning given when extracting /mingw64/bin/c++.exe (Can't create '/mingw64/bin/c++.exe')
warning: warning given when extracting /mingw64/bin/cc.exe (Can't create '/mingw64/bin/cc.exe')
warning: warning given when extracting /mingw64/bin/cpp.exe (Can't create '/mingw64/bin/cpp.exe')
warning: warning given when extracting /mingw64/bin/g++.exe (Hard-link target 'mingw64/bin/c++.exe' does not exist.)
warning: warning given when extracting /mingw64/bin/gcc.exe (Can't create '/mingw64/bin/gcc.exe')
warning: warning given when extracting /mingw64/bin/x86_64-w64-mingw32-c++.exe (Hard-link target 'mingw64/bin/c++.exe' does not exist.)
warning: warning given when extracting /mingw64/bin/x86_64-w64-mingw32-cc.exe (Can't create '/mingw64/bin/x86_64-w64-mingw32-cc.exe')
warning: warning given when extracting /mingw64/bin/x86_64-w64-mingw32-g++.exe (Hard-link target 'mingw64/bin/c++.exe' does not exist.)
warning: warning given when extracting /mingw64/bin/x86_64-w64-mingw32-gcc-14.2.0.exe (Hard-link target 'mingw64/bin/gcc.exe' does not exist.)
warning: warning given when extracting /mingw64/bin/x86_64-w64-mingw32-gcc.exe (Hard-link target 'mingw64/bin/gcc.exe' does not exist.)
Samuel@DESKTOP-SFKF6FE MINGW64 ~
# which gcc
which: no gcc in (/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
和相关文件 +清洁缓存: ls -l /mingw64/bin/gcc*
安装
which gcc
:gcc
检查权限,事实证明,某些相关文件标记为仅附加文件。虽然我不知道这是否相关,但我可以用
Samuel@DESKTOP-SFKF6FE MINGW64 ~
# pacman -Rnsu mingw-w64-x86_64-gcc
rm -rf /mingw64/bin/gcc* /mingw64/bin/g++* /mingw64/bin/cc* /mingw64/bin/c++*
rm -rf /mingw64/lib/gcc /mingw64/include/c++
checking dependencies...
warning: removing mingw-w64-x86_64-gcc from target list
warning: removing mingw-w64-x86_64-windows-default-manifest from target list
there is nothing to do
Samuel@DESKTOP-SFKF6FE MINGW64 ~
# pacman -Scc
Cache directory: /var/cache/pacman/pkg/
:: Do you want to remove ALL files from cache? [Y/n] y
removing all files from cache...
Database directory: /var/lib/pacman/
:: Do you want to remove unused repositories? [Y/n] y
removing unused sync repositories...
Samuel@DESKTOP-SFKF6FE MINGW64 ~
# pacman -S mingw-w64-x86_64-gcc
warning: mingw-w64-x86_64-gcc-14.2.0-3 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...
Packages (1) mingw-w64-x86_64-gcc-14.2.0-3
Total Download Size: 43.49 MiB
Total Installed Size: 224.99 MiB
Net Upgrade Size: 0.00 MiB
:: Proceed with installation? [Y/n] y
:: Retrieving packages...
mingw-w64-x86_64-gcc-14.2.... 43.5 MiB 4.81 MiB/s 00:09 [###############################] 100%
(1/1) checking keys in keyring [###############################] 100%
(1/1) checking package integrity [###############################] 100%
(1/1) loading package files [###############################] 100%
(1/1) checking for file conflicts [###############################] 100%
(1/1) checking available disk space [###############################] 100%
warning: could not get file information for mingw64/bin/c++.exe
warning: could not get file information for mingw64/bin/cc.exe
warning: could not get file information for mingw64/bin/cpp.exe
warning: could not get file information for mingw64/bin/g++.exe
warning: could not get file information for mingw64/bin/gcc-ar.exe
warning: could not get file information for mingw64/bin/gcc-nm.exe
warning: could not get file information for mingw64/bin/gcc-ranlib.exe
warning: could not get file information for mingw64/bin/gcc.exe
[...]
warning: could not get file information for mingw64/lib/gcc/x86_64-w64-mingw32/14.2.0/plugin/include/wide-int-bitmask.h
warning: could not get file information for mingw64/lib/gcc/x86_64-w64-mingw32/14.2.0/plugin/include/wide-int-print.h
warning: could not get file information for mingw64/lib/gcc/x86_64-w64-mingw32/14.2.0/plugin/include/wide-int.h
warning: could not get file information for mingw64/lib/gcc/x86_64-w64-mingw32/14.2.0/plugin/include/xcoff.h
:: Processing package changes...
(1/1) reinstalling mingw-w64-x86_64-gcc [###############################] 100%
warning: warning given when extracting /mingw64/bin/c++.exe (Can't create '/mingw64/bin/c++.exe')
warning: warning given when extracting /mingw64/bin/cc.exe (Can't create '/mingw64/bin/cc.exe')
warning: warning given when extracting /mingw64/bin/cpp.exe (Can't create '/mingw64/bin/cpp.exe')
warning: warning given when extracting /mingw64/bin/g++.exe (Hard-link target 'mingw64/bin/c++.exe' does not exist.)
warning: warning given when extracting /mingw64/bin/gcc.exe (Can't create '/mingw64/bin/gcc.exe')
warning: warning given when extracting /mingw64/bin/x86_64-w64-mingw32-c++.exe (Hard-link target 'mingw64/bin/c++.exe' does not exist.)
warning: warning given when extracting /mingw64/bin/x86_64-w64-mingw32-cc.exe (Can't create '/mingw64/bin/x86_64-w64-mingw32-cc.exe')
warning: warning given when extracting /mingw64/bin/x86_64-w64-mingw32-g++.exe (Hard-link target 'mingw64/bin/c++.exe' does not exist.)
warning: warning given when extracting /mingw64/bin/x86_64-w64-mingw32-gcc-14.2.0.exe (Hard-link target 'mingw64/bin/gcc.exe' does not exist.)
warning: warning given when extracting /mingw64/bin/x86_64-w64-mingw32-gcc.exe (Hard-link target 'mingw64/bin/gcc.exe' does not exist.)
删除此限制:
toolchain
,随后运行
Samuel@DESKTOP-SFKF6FE MINGW64 ~
# pacman -S --needed --overwrite '*' mingw-w64-x86_64-toolchain
warning: mingw-w64-x86_64-binutils-2.44-1 is up to date -- skipping
warning: mingw-w64-x86_64-crt-git-12.0.0.r566.gb02533108-1 is up to date -- skipping
warning: mingw-w64-x86_64-gcc-14.2.0-3 is up to date -- skipping
warning: mingw-w64-x86_64-gdb-16.2-1 is up to date -- skipping
warning: mingw-w64-x86_64-gdb-multiarch-16.2-1 is up to date -- skipping
warning: mingw-w64-x86_64-headers-git-12.0.0.r566.gb02533108-1 is up to date -- skipping
warning: mingw-w64-x86_64-libmangle-git-12.0.0.r566.gb02533108-1 is up to date -- skipping
warning: mingw-w64-x86_64-libwinpthread-git-12.0.0.r566.gb02533108-1 is up to date -- skipping
warning: mingw-w64-x86_64-make-4.4.1-3 is up to date -- skipping
warning: mingw-w64-x86_64-pkgconf-1~2.3.0-1 is up to date -- skipping
warning: mingw-w64-x86_64-tools-git-12.0.0.r566.gb02533108-1 is up to date -- skipping
warning: mingw-w64-x86_64-winpthreads-git-12.0.0.r566.gb02533108-1 is up to date -- skipping
warning: mingw-w64-x86_64-winstorecompat-git-12.0.0.r566.gb02533108-1 is up to date -- skipping
there is nothing to do
后来发出相同的警告(例如gcc
),并导致仅附加限制重新出现。
chattr
看起来安装失败了,因为 Samuel@DESKTOP-SFKF6FE MINGW64 ~
# lsattr /mingw64/bin/
------------ /mingw64/bin/2to3
------------ /mingw64/bin/2to3-3.12
[...]
------------ /mingw64/bin/envsubst.exe
---a-------- /mingw64/bin/gcc-ar.exe
---a-------- /mingw64/bin/gcc-nm.exe
---a-------- /mingw64/bin/gcc-ranlib.exe
---a-------- /mingw64/bin/gcov-tool.exe
---a-------- /mingw64/bin/gcov.exe
------------ /mingw64/bin/gdb-add-index
[...]
------------ /mingw64/bin/x86_64-w64-mingw32-clear.exe
---a-------- /mingw64/bin/x86_64-w64-mingw32-gcc-ar.exe
---a-------- /mingw64/bin/x86_64-w64-mingw32-gcc-nm.exe
---a-------- /mingw64/bin/x86_64-w64-mingw32-gcc-ranlib.exe
------------ /mingw64/bin/x86_64-w64-mingw32-infocmp.exe
[...]
------------ /mingw64/bin/zlib1.dll
------------ /mingw64/bin/zstd.exe
Samuel@DESKTOP-SFKF6FE MINGW64 ~
# chattr -a /mingw64/bin/*
Samuel@DESKTOP-SFKF6FE MINGW64 ~
# lsattr /mingw64/bin/
[...]
------------ /mingw64/bin/gcc-ar.exe
------------ /mingw64/bin/gcc-nm.exe
------------ /mingw64/bin/gcc-ranlib.exe
[...]
pacman -S mingw-w64-x86_64-gcc
中提取并创建必要的文件。以下是对问题进行故障排除和解决问题的一些步骤:
warning: could not get file information for mingw64/bin/c++.exe
如果任何与GCC相关的过程正在运行,请使用以下方式终止它:
Samuel@DESKTOP-SFKF6FE MINGW64 ~
# pacman -S --needed mingw-w64-ucrt-x86_64-toolchain # UCRT version
warning: mingw-w64-ucrt-x86_64-binutils-2.44-1 is up to date -- skipping
warning: mingw-w64-ucrt-x86_64-crt-git-12.0.0.r566.gb02533108-1 is up to date -- skipping
warning: mingw-w64-ucrt-x86_64-gcc-14.2.0-3 is up to date -- skipping
warning: mingw-w64-ucrt-x86_64-gdb-16.2-1 is up to date -- skipping
warning: mingw-w64-ucrt-x86_64-headers-git-12.0.0.r566.gb02533108-1 is up to date -- skipping
warning: mingw-w64-ucrt-x86_64-libwinpthread-git-12.0.0.r566.gb02533108-1 is up to date -- skipping
warning: mingw-w64-ucrt-x86_64-winpthreads-git-12.0.0.r566.gb02533108-1 is up to date -- skipping
:: There are 6 members in group mingw-w64-ucrt-x86_64-toolchain:
:: Repository ucrt64
1) mingw-w64-ucrt-x86_64-gdb-multiarch 2) mingw-w64-ucrt-x86_64-libmangle-git 3) mingw-w64-ucrt-x86_64-make 4) mingw-w64-ucrt-x86_64-pkgconf
5) mingw-w64-ucrt-x86_64-tools-git 6) mingw-w64-ucrt-x86_64-winstorecompat-git
Enter a selection (default=all):
resolving dependencies...
looking for conflicting packages...
Packages (6) mingw-w64-ucrt-x86_64-gdb-multiarch-16.2-1 mingw-w64-ucrt-x86_64-libmangle-git-12.0.0.r566.gb02533108-1 mingw-w64-ucrt-x86_64-make-4.4.1-3
mingw-w64-ucrt-x86_64-pkgconf-1~2.3.0-1 mingw-w64-ucrt-x86_64-tools-git-12.0.0.r566.gb02533108-1
mingw-w64-ucrt-x86_64-winstorecompat-git-12.0.0.r566.gb02533108-1
Total Download Size: 6.93 MiB
Total Installed Size: 31.64 MiB
:: Proceed with installation? [Y/n] y
:: Retrieving packages...
mingw-w64-ucrt-x86_64-winstorecompat-git-12.0.0.r566.gb02533108-1-any 24.9 KiB 31.2 KiB/s 00:01 [############################################################] 100%
mingw-w64-ucrt-x86_64-pkgconf-1~2.3.0-1-any 86.1 KiB 105 KiB/s 00:01 [############################################################] 100%
mingw-w64-ucrt-x86_64-libmangle-git-12.0.0.r566.gb02533108-1-any 22.1 KiB 37.1 KiB/s 00:01 [############################################################] 100%
mingw-w64-ucrt-x86_64-make-4.4.1-3-any 138.8 KiB 76.8 KiB/s 00:02 [############################################################] 100%
mingw-w64-ucrt-x86_64-tools-git-12.0.0.r566.gb02533108-1-any 316.1 KiB 147 KiB/s 00:02 [############################################################] 100%
mingw-w64-ucrt-x86_64-gdb-multiarch-16.2-1-any 6.4 MiB 551 KiB/s 00:12 [############################################################] 100%
Total (6/6) 6.9 MiB 591 KiB/s 00:12 [############################################################] 100%
(6/6) checking keys in keyring [############################################################] 100%
(6/6) checking package integrity [############################################################] 100%
(6/6) loading package files [############################################################] 100%
(6/6) checking for file conflicts [############################################################] 100%
(6/6) checking available disk space [############################################################] 100%
:: Processing package changes...
(1/6) installing mingw-w64-ucrt-x86_64-gdb-multiarch [############################################################] 100%
Optional dependencies for mingw-w64-ucrt-x86_64-gdb-multiarch
mingw-w64-ucrt-x86_64-python-pygments: for syntax highlighting
(2/6) installing mingw-w64-ucrt-x86_64-libmangle-git [############################################################] 100%
(3/6) installing mingw-w64-ucrt-x86_64-make [############################################################] 100%
(4/6) installing mingw-w64-ucrt-x86_64-pkgconf [############################################################] 100%
(5/6) installing mingw-w64-ucrt-x86_64-tools-git [############################################################] 100%
(6/6) installing mingw-w64-ucrt-x86_64-winstorecompat-git [############################################################] 100%
可以创建”,这可能是文件权限问题。运行:
pacman
如果您看到受限的权限,请重置它们:
/mingw64/bin/
或手动检查并在Windows Explorer中调整目录的安全设置
3。作为管理员运行mingw64
如果您还没有,请右键单击Mingw64,然后选择
run作为管理员,然后尝试:
gcc.exe
4。手动卸下并重新安装包装
如果上述步骤不起作用,则强行删除tasklist | findstr gcc
及其依赖性:
taskkill /F /IM <process_name>
,然后重新安装:
ls -ld /mingw64/bin
5。手动提取GCC
如果继续失败,手动下载并提取软件包
找到包装URL:
chmod -R 777 /mingw64/bin
下载和手动提取:
pacman -S mingw-w64-x86_64-gcc