Многие внутренние ошибки компиляции библиотеки std при попытке компиляции на MSYS2 / MinGW-w64 - PullRequest
0 голосов
/ 06 августа 2020
• 1000 КБ. Как я могу это исправить?

Вот первый блок ошибки:

/mingw64/bin/g++.exe   -I/home/dan9e/cartogrtist/build -I/home/dan9e/cartogrtist/src/block -I/home/dan9e/cartogrtist/src/cliParser -I/home/dan9e/cartogrtist/src/mapArt/mapArtFlat -I/home/dan9e/cartogrtist/src/mapArt/mapArtStaircase -I/home/dan9e/cartogrtist/src/palette -I/home/dan9e/cartogrtist/src/schematic -I/home/dan9e/cartogrtist/src/staircaseColumn -I/mingw64/include/GraphicsMagick -I/home/dan9e/libnbtplusplus/include -I/home/dan9e/libnbtplusplus/include/libnbtplusplus -I/home/dan9e/libnbtplusplus/include/libnbtplusplus/io -I/home/dan9e/libnbtplusplus/include/libnbtplusplus/text -I/mingw64/include/tclap -I/mingw64/include/spdlog -I/mingw64/include/fmt  -g -O2 -O3 -DNDEBUG   -o CMakeFiles/cartogrtist.dir/src/block/block.cpp.obj -c /home/dan9e/cartogrtist/src/block/block.cpp
In file included from C:/msys64/mingw64/include/c++/10.2.0/string:56,
                 from C:/msys64/mingw64/include/c++/10.2.0/bits/locale_classes.h:40,
                 from C:/msys64/mingw64/include/c++/10.2.0/locale:39,
                 from C:/msys64/mingw64/include/fmt/locale.h:11,
                 from C:/msys64/mingw64/include/c++/10.2.0/clocale:42,
                 from C:/msys64/mingw64/include/c++/10.2.0/x86_64-w64-mingw32/bits/c++locale.h:41,
                 from C:/msys64/mingw64/include/c++/10.2.0/bits/localefwd.h:40,
                 from C:/msys64/mingw64/include/c++/10.2.0/ios:41,
                 from C:/msys64/mingw64/include/c++/10.2.0/ostream:38,
                 from C:/msys64/mingw64/include/c++/10.2.0/iostream:39,
                 from C:/msys64/home/dan9e/cartogrtist/src/block/block.h:19,
                 from C:/msys64/home/dan9e/cartogrtist/src/block/block.cpp:17:
C:/msys64/mingw64/include/c++/10.2.0/bits/basic_string.tcc: In function 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)':
C:/msys64/mingw64/include/c++/10.2.0/bits/basic_string.tcc:1484:15: error: 'ctype' does not name a type; did you mean '_wctype'?
 1484 |       typedef ctype<_CharT>    __ctype_type;
      |               ^~~~~
      |               _wctype
C:/msys64/mingw64/include/c++/10.2.0/bits/basic_string.tcc:1485:24: error: '__ctype_type' has not been declared
 1485 |       typedef typename __ctype_type::ctype_base         __ctype_base;
      |                        ^~~~~~~~~~~~
C:/msys64/mingw64/include/c++/10.2.0/bits/basic_string.tcc:1501:14: error: '__ctype_type' does not name a type; did you mean '__ctype_base'?
 1501 |        const __ctype_type& __ct = use_facet<__ctype_type>(___in.getloc());
      |              ^~~~~~~~~~~~
      |              __ctype_base
C:/msys64/mingw64/include/c++/10.2.0/bits/basic_string.tcc:1507:12: error: '__ct' was not declared in this scope; did you mean '__c'?
 1507 |        && !__ct.is(__ctype_base::space,
      |            ^~~~
      |            __c
C:/msys64/mingw64/include/c++/10.2.0/bits/basic_string.tcc:1507:20: error: '__ctype_base' is not a class, namespace, or enumeration
 1507 |        && !__ct.is(__ctype_base::space,
      |                    ^~~~~~~~~~~~

Остальные можно найти по адресу: https://pastebin.com/RaiS6K75

Команда make:

dan9e@RED MINGW64 ~/cartogrtist/build
$ make -j1 1> error.log 2> error.log

CMAKE_VERBOSE_MAKEFILE было установлено в ON в CMake для отображения выполняемых команд.

Информация о версии:

dan9e@RED MINGW64 ~/cartogrtist/build
$ g++ --version
g++.exe (Rev1, Built by MSYS2 project) 10.2.0
Copyright (C) 2020 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.


dan9e@RED MINGW64 ~/cartogrtist/build
$ cmake --version
cmake version 3.17.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

dan9e@RED MINGW64 ~/cartogrtist/build
$ make --version
GNU Make 4.3
Built for x86_64-pc-msys
Copyright (C) 1988-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.

1 Ответ

1 голос
/ 07 августа 2020

Если вы посмотрите на цепочку включенных файлов:

In file included from C:/msys64/mingw64/include/c++/10.2.0/string:56,
             from C:/msys64/mingw64/include/c++/10.2.0/bits/locale_classes.h:40,
             from C:/msys64/mingw64/include/c++/10.2.0/locale:39,
             from C:/msys64/mingw64/include/fmt/locale.h:11,
             from C:/msys64/mingw64/include/c++/10.2.0/clocale:42,

, увидите, что там есть /fmt/locale.h. Это явно неверно, поскольку заголовок стандартной библиотеки <clocale> не должен включать что-либо извне каталога заголовков стандартной библиотеки.

Эта проблема возникает из-за того, что вы неправильно указали /mingw64/include/fmt в качестве пути включения, поэтому файл fmt/locale.h теперь обнаруживается #include "locale.h", хотя этого не должно быть.

В вашей команде сборки не должно быть переключателей -I с аргументом, начинающимся с /mingw64. Каталог /mingw64/include включен в пути поиска по умолчанию.

Чтобы использовать заголовок с расположением /mingw64/include/fmt/format.h, вы пишете #include <fmt/format.h> в своей программе, и он будет найден, потому что выполняется поиск /mingw64/include для этого имени.

...