Bug 1776781
| Summary: | g++ -D_GLIBCXX_USE_CXX11_ABI=0 compiles but executable crashes | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Piyush Bhoot <pbhoot> |
| Component: | gcc | Assignee: | Marek Polacek <mpolacek> |
| gcc sub component: | system-version | QA Contact: | qe-baseos-tools-bugs |
| Status: | CLOSED NOTABUG | Docs Contact: | |
| Severity: | unspecified | ||
| Priority: | unspecified | CC: | ahajkova, fweimer, jakub, jwakely, ohudlick |
| Version: | 8.1 | ||
| Target Milestone: | rc | ||
| Target Release: | 8.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2019-11-26 13:01:33 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
-D_GLIBCXX_USE_CXX11_ABI=0 is an ABI changing option, so you can only use it in programs where all the C++ code has been compiled with that option, or with libraries like libstdc++.so.6 which do support both ABIs. That is not the case in your testcase, the libboost_system.so and libboost_filesystem.so libraries are most likely built with the default C++ ABI on RHEL8, so -D_GLIBCXX_USE_CXX11_ABI=1. This is not a bug, for the reasons Jakub said. The RHEL8 system libraries (including Boost) use the new ABI, so you cannot expect them to work correctly when you use a different ABI. Invalid code, closing. |
Description of problem: An C++ executable compiled with -D_GLIBCXX_USE_CXX11_ABI=0 crashes whereas with -D_GLIBCXX_USE_CXX11_ABI=1 (RHEL 8.1 default) does not: Version-Release number of selected component (if applicable): gcc version 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC) Steps to Reproduce: test.cpp: #include <boost/filesystem/path.hpp> #include <iostream> int main(int argc, char* argv[]) { std::cout << "_GLIBCXX_USE_CXX11_ABI=" << _GLIBCXX_USE_CXX11_ABI << std::endl; std::cout << "sizeof(boost::filesystem::path)=" << sizeof(boost::filesystem::path) << std::endl; std::cout << boost::filesystem::path(argv[0]).filename().string() << std::endl; return 0; } $ g++ -D_GLIBCXX_USE_CXX11_ABI=1 -lboost_system -lboost_filesystem test.cpp; ./a.out _GLIBCXX_USE_CXX11_ABI=1 sizeof(boost::filesystem::path)=32 a.out $ g++ -D_GLIBCXX_USE_CXX11_ABI=0 -lboost_system -lboost_filesystem test.cpp; ./a.out _GLIBCXX_USE_CXX11_ABI=0 sizeof(boost::filesystem::path)=8 Segmentation fault (core dumped) Actual results: Segmentation fault (core dumped) Expected results: No segfault