Проверка ошибок сопрограмм в CLang с использованием msys2 / mingw64 - PullRequest
1 голос
/ 18 июня 2020

Я пробовал запустить этот пример на Windows 10 с msys2 / mingw64 clang ++ 10:

https://www.dwcomputersolutions.net/posts/coroutines3/

Во время работы я получаю эту ошибку:

clang++.exe -m64 -pedantic -Wall -std=c++20 -v -fcoroutines-ts -stdlib=libc++  -c D:\Program-Workspaces\CODEBLOCKS\Test_Coroutine_02\main.cpp -o obj\Debug\main.o
    clang++.exe  -o bin\Debug\Test_Coroutine_02.exe obj\Debug\main.o  -m64  
    clang version 10.0.0 (https://github.com/msys2/MINGW-packages.git 3f880aaba91a3d9cdfb222dc270274731a2119a9)
    Target: x86_64-w64-windows-gnu
    Thread model: posix
    InstalledDir: D:\Programs\msys64\mingw64\bin
     (in-process)
     "D:\\Programs\\msys64\\mingw64\\bin\\clang++.exe" -cc1 -triple x86_64-w64-windows-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=none -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -resource-dir "D:\\Programs\\msys64\\mingw64\\lib\\clang\\10.0.0" -internal-isystem "D:\\Programs\\msys64\\mingw64\\x86_64-w64-mingw32\\include\\c++\\v1" -internal-isystem "D:\\Programs\\msys64\\mingw64\\include\\c++\\v1" -internal-isystem "D:\\Programs\\msys64\\mingw64\\lib\\clang\\10.0.0\\include" -internal-isystem "D:\\Programs\\msys64\\mingw64\\x86_64-w64-mingw32/sys-root/mingw/include" -internal-isystem "D:\\Programs\\msys64\\mingw64\\x86_64-w64-mingw32\\include" -internal-isystem "D:\\Programs\\msys64\\mingw64\\include" -Wall -pedantic -std=c++20 -fdeprecated-macro -fdebug-compilation-dir "D:\\Program-Workspaces\\CODEBLOCKS\\Test_Coroutine_02" -ferror-limit 19 -fmessage-length 0 -fcoroutines-ts -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fseh-exceptions -fdiagnostics-show-option -faddrsig -o "obj\\Debug\\main.o" -x c++ "D:\\Program-Workspaces\\CODEBLOCKS\\Test_Coroutine_02\\main.cpp"
    clang -cc1 version 10.0.0 based upon LLVM 10.0.0 default target x86_64-w64-windows-gnu
    ignoring nonexistent directory "D:\Programs\msys64\mingw64\x86_64-w64-mingw32\include\c++\v1"
    ignoring nonexistent directory "D:\Programs\msys64\mingw64\x86_64-w64-mingw32/sys-root/mingw/include"
    #include "..." search starts here:
    #include <...> search starts here:
     D:\Programs\msys64\mingw64\include\c++\v1
     D:\Programs\msys64\mingw64\lib\clang\10.0.0\include
     D:\Programs\msys64\mingw64\x86_64-w64-mingw32\include
     D:\Programs\msys64\mingw64\include
    End of search list.
    D:\Programs\msys64\mingw64\bin\ld: obj\Debug\main.o:main.cpp:(.text+0x4d4): undefined reference to `std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(int)'
    D:\Programs\msys64\mingw64\bin\ld: obj\Debug\main.o:main.cpp:(.text$_ZNSt3__14endlIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_[_ZNSt3__14endlIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_]+0x37): undefined reference to `std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)'
    D:\Programs\msys64\mingw64\bin\ld: obj\Debug\main.o:main.cpp:(.text$_ZNSt3__14endlIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_[_ZNSt3__14endlIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_]+0x46): undefined reference to `std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()'
    D:\Programs\msys64\mingw64\bin\ld: obj\Debug\main.o:main.cpp:(.text$_ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_y[_ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_y]+0x212): undefined reference to `std::__1::ios_base::__set_badbit_and_consider_rethrow()'
    D:\Programs\msys64\mingw64\bin\ld: obj\Debug\main.o:main.cpp:(.text$_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryC2ERS3_[_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryC2ERS3_]+0x81): undefined reference to `std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()'
    D:\Programs\msys64\mingw64\bin\ld: obj\Debug\main.o:main.cpp:(.text$_ZNSt3__116__pad_and_outputIcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8ios_baseES4_[_ZNSt3__116__pad_and_outputIcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8ios_baseES4_]+0x1cc): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()'
    D:\Programs\msys64\mingw64\bin\ld: obj\Debug\main.o:main.cpp:(.text$_ZNSt3__116__pad_and_outputIcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8ios_baseES4_[_ZNSt3__116__pad_and_outputIcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8ios_baseES4_]+0x1e3): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()'
    D:\Programs\msys64\mingw64\bin\ld: obj\Debug\main.o:main.cpp:(.text$_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2Eyc[_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2Eyc]+0x3f): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long long, char)'
    D:\Programs\msys64\mingw64\bin\ld: obj\Debug\main.o:main.cpp:(.text$_ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE5widenEc[_ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE5widenEc]+0x20): undefined reference to `std::__1::ios_base::getloc() const'
    D:\Programs\msys64\mingw64\bin\ld: obj\Debug\main.o:main.cpp:(.text$_ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE5widenEc[_ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE5widenEc]+0x55): undefined reference to `std::__1::locale::~locale()'
    D:\Programs\msys64\mingw64\bin\ld: obj\Debug\main.o:main.cpp:(.text$_ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE5widenEc[_ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE5widenEc]+0x71): undefined reference to `std::__1::locale::~locale()'
    D:\Programs\msys64\mingw64\bin\ld: obj\Debug\main.o:main.cpp:(.text$_ZNSt3__19use_facetINS_5ctypeIcEEEERKT_RKNS_6localeE[_ZNSt3__19use_facetINS_5ctypeIcEEEERKT_RKNS_6localeE]+0x16): undefined reference to `std::__1::locale::use_facet(std::__1::locale::id&) const'
    D:\Programs\msys64\mingw64\bin\ld: obj\Debug\main.o:main.cpp:(.text$_ZNSt3__18ios_base8setstateEj[_ZNSt3__18ios_base8setstateEj]+0x1d): undefined reference to `std::__1::ios_base::clear(unsigned int)'
    D:\Programs\msys64\mingw64\bin\ld: obj\Debug\main.o:main.cpp:(.rdata$.refptr._ZNSt3__14coutE[.refptr._ZNSt3__14coutE]+0x0): undefined reference to `std::__1::cout'
    D:\Programs\msys64\mingw64\bin\ld: obj\Debug\main.o:main.cpp:(.rdata$.refptr._ZNSt3__15ctypeIcE2idE[.refptr._ZNSt3__15ctypeIcE2idE]+0x0): undefined reference to `std::__1::ctype<char>::id'
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)
    Process terminated with status 1 (0 minute(s), 1 second(s))
    16 error(s), 0 warning(s) (0 minute(s), 1 second(s))

Запуск его в Wandbox отлично выглядит с этой командной строкой:

$ clang ++ prog. cc -Wall -Wextra -std = c ++ 2a -pedanti c

Даже нет -fcoroutines-ts -stdlib = libc ++ et c. требуются варианты !!

https://wandbox.org/

Может кто-нибудь, пожалуйста, помогите мне разобраться в проблеме?

Спасибо

...