Bug 1087136

Summary: GCC 8: llvm5 build fails
Product: [openSUSE] openSUSE Tumbleweed Reporter: Martin Liška <martin.liska>
Component: BasesystemAssignee: Michal Srb <msrb>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: msrb
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Bug Depends on:    
Bug Blocks: 1084649    

Description Martin Liška 2018-03-27 16:06:47 UTC
Build the package with GCC 8, there's error:


Please build the project as follows to reproduce the issue:
osc build --alternative-project=openSUSE:Factory:Staging:Gcc7
Comment 1 Michal Srb 2018-03-29 09:22:34 UTC
Few tests inside single test binary are crashing. I am debugging the crash now. It is not clear to me how could gcc8 cause this - we build llvm in two stages, first we build clang with gcc and then build everything with that, including the tests.

The test also crashes when run with distribution's libLLVM5, which was built using gcc7. So it must be something in the test binary itself.

LLVM6 has the same issue.
Comment 2 Michal Srb 2018-04-11 09:14:12 UTC
The problem is that libLLVM is built with rtti, but the tests are built without rtti. It did not matter in the past, but it matters now with new version of libstdc++ that came with gcc8.

The OrcJITTests calls `std::make_shared`, which eventually calls `__shared_ptr` and that calls `std::_Sp_counted_ptr_inplace<...>::_M_get_deleter`. This `_M_get_deleter` takes a `std::type_info` parameter. If rtti is disabled, then some kind of fake type_info is passed instead.

When the test is run, the `__shared_ptr` constructor from the OrcJITTests binary calls `std::_Sp_counted_ptr_inplace<...>::_M_get_deleter` from the libLLVM library. Each is compiled with different rtti, so they disagree on what the parameter means, because of this the `std::shared_ptr` is eventually created with nullptr inside. Later the test crashes when trying to use it.

AFAIK mixing rtti and non-rtti code is not good idea. LibLLVM is built without rtti by default, but they recommend to turn it on for packaging, which we do. The tests are always built without rtti - I think this is a bug in LLVM build system.
Comment 3 Michal Srb 2018-04-17 10:09:18 UTC
A patch that removes the -no-rtti from tests is now in Factory (llvm5 and llvm6). It fixes the build with gcc8 if I try it locally, hopefully it will work remotely too. In case it is still not fixed, please reopen.
Comment 4 Martin Liška 2018-04-17 10:15:50 UTC
Thanks for the fix!
Comment 6 Swamp Workflow Management 2018-06-18 12:10:06 UTC
This is an autogenerated message for OBS integration:
This bug (1087136) was mentioned in
https://build.opensuse.org/request/show/617496 Factory / llvm4
Comment 8 OBSbugzilla Bot 2020-07-24 06:51:07 UTC
This is an autogenerated message for OBS integration:
This bug (1087136) was mentioned in
https://build.opensuse.org/request/show/822551 Factory / llvm10
Comment 9 OBSbugzilla Bot 2021-11-19 01:41:04 UTC
This is an autogenerated message for OBS integration:
This bug (1087136) was mentioned in
https://build.opensuse.org/request/show/932377 Backports:SLE-15-SP3 / llvm12