clang 14.00:_glibcxx11_deprecated_suggest(“ std :: bind&quot”);
使用GNU/GUIX的Clang-Toolchain软件包安装了Clang 14.0。 当我会折旧的功能使用错误 试图编译一个简单的代码:
//build with: clang++ main.cpp
//main.cpp
#include <iostream>
int main() {
std::cout << "hello world!" << std::endl;
}
错误消息是:
[Guix profile dir]/include/c++/backward/binders.h:130:6: error: expected ';' after class
} _GLIBCXX11_DEPRECATED_SUGGEST("std::bind");
错误发生,无论哪个stl标头 代码包括。例如,它在&lt; string&gt;
时失败 包含在相同的错误消息中。
知道如何解决错误吗?
更新1: 这似乎是一个配置错误。如果汇编是在GUIX容器环境中完成的:
guix environment --container clang-toolchain -- clang++ main.cpp -o main
更新2:
[事实证明这是错误的。这与GCC-ToolChain中缺乏Multilib支持有关]
在使用- PURE
选项中运行相同代码时,错误仍然存在。这意味着 错误不是由于环境设置而引起的。
还有一个较旧的错误报告解决了相同的问题: https://bugzilla.redhat。 com/show_bug.cgi?id = 1896076 。
运行时可以复制错误中的错误消息 使用Emscripten的测试代码:
emcc -o main.html main.cpp
问题是该错误已经在Fedora 33中解决了吗?
我目前在: linux/fedora 5.17.4-200.fc35.x86_64 with with with GUIX环境:GUIX描述-Format = Channels
:
(list (channel
(name 'guix)
(url "https://git.savannah.gnu.org/git/guix.git")
(branch "master")
(commit
"59b91fdbcd7e1a88d1d54d392ce5d5fddd9d96d1")
(introduction
(make-channel-introduction
"9edb3f66fd807b096b48283debdcddccfea34bad"
(openpgp-fingerprint
"BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA"))))
(channel
(name 'flat)
(url "https://github.com/flatwhatson/guix-channel.git")
(branch "master")
(commit
"f43c67e47f1ca83d045f35c31772c5e4eb64b2a2")
(introduction
(make-channel-introduction
"33f86a4b48205c0dc19d7c036c85393f0766f806"
(openpgp-fingerprint
"736A C00E 1254 378B A982 7AF6 9DBE 8265 81B6 4490")))))
更新3:似乎最新的 [email&nbsp; procectived] “ class =” __ cf_email__“ data-cfemail =” 6B0C0808461F04040408030A020A02052B5A5A4559455B“> [email&nbsp; procepted] 。也就是说,在相同的GUIX配置文件中。降级 gcc-toolchain 降至版本 10.3.0 解决了错误。
该问题可以通过以下方式复制:
guix shell [email protected] [email protected] --container -- clang++ main.cpp
输出:
In file included from main.cpp:1:
In file included from /gnu/store/../profile/include/c++/iostream:39:
In file included from /gnu/store/../profile/include/c++/ostream:38:
In file included from /gnu/store/../profile/include/c++/ios:42:
In file included from /gnu/store/../profile/include/c++/bits/ios_base.h:41:
In file included from /gnu/store/../profile/include/c++/bits/locale_classes.h:40:
In file included from /gnu/store/../profile/include/c++/string:48:
In file included from /gnu/store/../profile/include/c++/bits/stl_function.h:1407:
/gnu/store/../profile/include/c++/backward/binders.h:130:6: error: expected ';' after class
} _GLIBCXX11_DEPRECATED_SUGGEST("std::bind");
^
/gnu/store/../profile/include/c++/backward/binders.h:130:7: error: C++ requires a type specifier for all declarations
} _GLIBCXX11_DEPRECATED_SUGGEST("std::bind");
^
/gnu/store/../profile/include/c++/backward/binders.h:165:6: error: expected ';' after class
} _GLIBCXX11_DEPRECATED_SUGGEST("std::bind");
^
/gnu/store/../profile/include/c++/backward/binders.h:165:7: error: C++ requires a type specifier for all declarations
} _GLIBCXX11_DEPRECATED_SUGGEST("std::bind");
将GCC降级到 :
guix shell [email protected] [email protected] --container -- clang++ main.cpp
输出: 产生了预期文件(A.Out)
Installed clang 14.0 using GNU/Guix's clang-toolchain package.
I am getting depreciated feature usage error when
trying to compile a simple code:
//build with: clang++ main.cpp
//main.cpp
#include <iostream>
int main() {
std::cout << "hello world!" << std::endl;
}
The error message is:
[Guix profile dir]/include/c++/backward/binders.h:130:6: error: expected ';' after class
} _GLIBCXX11_DEPRECATED_SUGGEST("std::bind");
The error happens regardless of which STL header
the code includes. For example, it fails when <string>
is included with the same error message.
Any idea how to resolve the error?
Update 1:
This seems to be a configuration error. It goes away if the compilation is done inside a Guix container environment:
guix environment --container clang-toolchain -- clang++ main.cpp -o main
Update 2:
[This turned out to be WRONG. It is related to lack of multilib support in gcc-toolchain]
The error still persists when running the same code in a Guix environment with the --pure
option. This means the
error isn't due to environment setting.
There is also an older bug report addressing the same issue: https://bugzilla.redhat.com/show_bug.cgi?id=1896076. The
error message in the bug can be reproduced when running
the test code using emscripten:
emcc -o main.html main.cpp
The problem is the bug was already addressed in Fedora 33?
I am currently on: Linux/fedora 5.17.4-200.fc35.x86_64 with
a Guix environment: guix describe --format=channels
:
(list (channel
(name 'guix)
(url "https://git.savannah.gnu.org/git/guix.git")
(branch "master")
(commit
"59b91fdbcd7e1a88d1d54d392ce5d5fddd9d96d1")
(introduction
(make-channel-introduction
"9edb3f66fd807b096b48283debdcddccfea34bad"
(openpgp-fingerprint
"BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA"))))
(channel
(name 'flat)
(url "https://github.com/flatwhatson/guix-channel.git")
(branch "master")
(commit
"f43c67e47f1ca83d045f35c31772c5e4eb64b2a2")
(introduction
(make-channel-introduction
"33f86a4b48205c0dc19d7c036c85393f0766f806"
(openpgp-fingerprint
"736A C00E 1254 378B A982 7AF6 9DBE 8265 81B6 4490")))))
Update 3: It seems the latest [email protected] breaks when installed alongside [email protected]. That is, in the same Guix profile. Downgrading gcc-toolchain to version 10.3.0 resolved the error.
The issue can be reproduced with:
guix shell [email protected] [email protected] --container -- clang++ main.cpp
Output:
In file included from main.cpp:1:
In file included from /gnu/store/../profile/include/c++/iostream:39:
In file included from /gnu/store/../profile/include/c++/ostream:38:
In file included from /gnu/store/../profile/include/c++/ios:42:
In file included from /gnu/store/../profile/include/c++/bits/ios_base.h:41:
In file included from /gnu/store/../profile/include/c++/bits/locale_classes.h:40:
In file included from /gnu/store/../profile/include/c++/string:48:
In file included from /gnu/store/../profile/include/c++/bits/stl_function.h:1407:
/gnu/store/../profile/include/c++/backward/binders.h:130:6: error: expected ';' after class
} _GLIBCXX11_DEPRECATED_SUGGEST("std::bind");
^
/gnu/store/../profile/include/c++/backward/binders.h:130:7: error: C++ requires a type specifier for all declarations
} _GLIBCXX11_DEPRECATED_SUGGEST("std::bind");
^
/gnu/store/../profile/include/c++/backward/binders.h:165:6: error: expected ';' after class
} _GLIBCXX11_DEPRECATED_SUGGEST("std::bind");
^
/gnu/store/../profile/include/c++/backward/binders.h:165:7: error: C++ requires a type specifier for all declarations
} _GLIBCXX11_DEPRECATED_SUGGEST("std::bind");
Downgrading gcc to [email protected]:
guix shell [email protected] [email protected] --container -- clang++ main.cpp
Output:
Expected file(a.out) is produced
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论