![[语法问题] 模板不匹配-clang++ -std=c++20 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables,第1张 [语法问题] 模板不匹配-clang++ -std=c++20 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables,第1张](/aiimages/%5B%E8%AF%AD%E6%B3%95%E9%97%AE%E9%A2%98%5D+%E6%A8%A1%E6%9D%BF%E4%B8%8D%E5%8C%B9%E9%85%8D-clang%2B%2B+-std%3Dc%2B%2B20+-fno-exceptions+-fno-unwind-tables+-fno-asynchronous-unwind-tables.png)
背景:我在编译一个开源的链接器 mold, 想着用它加速一下本地的构建,但是构建的最后一步碰到了错误。
项目地址:
https://github.com/rui314/mold.git
编译步骤:
git clone https://github.com/rui314/mold.git
cd mold
git checkout v1.4.2
make -j`nproc` CXX=clang++ CXXFLAGS="-stdlib=libc++"
sudo make install
出错的文件:
clang++ -std=c++17 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DMOLD_VERSION=\"1.4.2\" -DLIBDIR="\"/usr/local
/lib\"" -Ithird-party/mimalloc/include -Ithird-party/tbb/include -MT out/macho/main.o -MMD -MP -MF out/macho/main.d -stdlib=libc++ -c -o out/macho/main.o macho/main.cc
报错信息:
macho/main.cc:453:11: error: no viable overloaded '+='
counter += std::erase_if(osec.members, [](Subsection *subsec) {
~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
macho/main.cc:464:7: note: in instantiation of function template specialization 'mold::macho::uniquify_cstrings' requested here
uniquify_cstrings(ctx, *(OutputSection *)chunk);
^
macho/main.cc:1052:3: note: in instantiation of function template specialization 'mold::macho::merge_cstring_sections' requested here
merge_cstring_sections(ctx);
^
macho/main.cc:998:14: note: in instantiation of function template specialization 'mold::macho::do_main' requested here
return do_main(argc, argv);
^
macho/main.cc:1121:10: note: in instantiation of function template specialization 'mold::macho::do_main' requested here
return do_main(argc, argv);
^
macho/../mold.h:643:12: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'int' for 1st argument
Counter &operator+=(int delta) {
^
macho/main.cc:453:11: error: no viable overloaded '+='
counter += std::erase_if(osec.members, [](Subsection *subsec) {
~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
macho/main.cc:464:7: note: in instantiation of function template specialization 'mold::macho::uniquify_cstrings' requested here
uniquify_cstrings(ctx, *(OutputSection *)chunk);
^
macho/main.cc:1052:3: note: in instantiation of function template specialization 'mold::macho::merge_cstring_sections' requested here
merge_cstring_sections(ctx);
^
macho/main.cc:1121:10: note: in instantiation of function template specialization 'mold::macho::do_main' requested here
return do_main(argc, argv);
^
macho/../mold.h:643:12: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'int' for 1st argument
Counter &operator+=(int delta) {
^
2 errors generated.
先留个坑,后面解决.
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)