Bug 1551147 - cmake -E cmake_autogen crashing (probably due to build with GCC 8)
Summary: cmake -E cmake_autogen crashing (probably due to build with GCC 8)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: cmake
Version: 28
Hardware: All
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Orion Poplawski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1551148
TreeView+ depends on / blocked
 
Reported: 2018-03-02 21:42 UTC by Rex Dieter
Modified: 2018-04-02 12:33 UTC (History)
9 users (show)

Fixed In Version: cmake-3.10.2-4.fc29 cmake-3.10.2-4.fc28 cmake-3.11.0-1.fc27 cmake-3.11.0-1.fc28 cmake-3.11.0-1.fc26
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-03-30 12:48:25 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
backtrace (121.07 KB, text/plain)
2018-03-05 23:04 UTC, Adam Williamson
no flags Details

Description Rex Dieter 2018-03-02 21:42:51 UTC
Since cmake-3.10.2/gcc8 was introduced, digikam FTBFS due to a crash running:
cmake -E cmake_autogen ...

build.log snippet:
[  1%] Automatic MOC for target mediaserver_src
cd /builddir/build/BUILD/digikam-5.8.0/x86_64-redhat-linux-gnu/core/utilities/mediaserver && /usr/bin/cmake -E cmake_autogen /builddir/build/BUILD/digikam-5.8.0/x86_64-redhat-linux-gnu/core/utilities/mediaserver/CMakeFiles/mediaserver_src_autogen.dir release
AutoMoc: Checking: /builddir/build/BUILD/digikam-5.8.0/core/utilities/mediaserver/dlnaserver.cpp
AutoMoc: Checking: /builddir/build/BUILD/digikam-5.8.0/core/utilities/mediaserver/dlnaserverdelegate.cpp
AutoMoc: Checking: /builddir/build/BUILD/digikam-5.8.0/core/utilities/mediaserver/dmediaserver.cpp
AutoMoc: Checking: /builddir/build/BUILD/digikam-5.8.0/core/utilities/mediaserver/dmediaserverdlg.cpp
AutoMoc: Checking: /builddir/build/BUILD/digikam-5.8.0/core/utilities/mediaserver/dmediaservermngr.cpp
make[2]: Leaving directory '/builddir/build/BUILD/digikam-5.8.0/x86_64-redhat-linux-gnu'
make[2]: *** [core/utilities/mediaserver/CMakeFiles/mediaserver_src_autogen.dir/build.make:61: core/utilities/mediaserver/CMakeFiles/mediaserver_src_autogen] Aborted (core dumped)

Full log,
https://koji.fedoraproject.org/koji/buildinfo?buildID=1052751


Tested building with various cmake versions:
cmake-3.10.2-2.fc28 fails
cmake-3.10.2-1.fc28 fails
cmake-3.10.1-11.fc28 succeeds (last version built with gcc7)

Comment 1 Adam Williamson 2018-03-02 22:06:37 UTC
It'd be good to do the build in a mock chroot, get the actual core dump out, and gdb it. I'll try and do that later today.

Comment 2 Adam Williamson 2018-03-05 23:04:46 UTC
Created attachment 1404572 [details]
backtrace

Here's a backtrace I got by running the crashing cmake command through gdb.

Comment 3 Dave Malcolm 2018-03-06 00:15:50 UTC
(In reply to Adam Williamson from comment #2)
> Created attachment 1404572 [details]
> backtrace
> 
> Here's a backtrace I got by running the crashing cmake command through gdb.

Frames 2 and 3 looks like an assertion failure inside std::string::front:

      /**
       *  Returns a read/write reference to the data at the first
       *  element of the %string.
       */
      reference
      front()
      {
	__glibcxx_assert(!empty());
	return operator[](0);
      }

Looks like frame 4 (ReadFile in cmake-3.10.2-2.fc29.x86_64/Source/cmQtAutoGenerators.cxx) is trying to get at the first char of a string, but the string is empty, hence the assertion failure.

Comment 4 Sebastian Holtermann 2018-03-06 11:33:09 UTC
Hi. I'm the current maintainer of AUTOMOC.

Thanks for the backtrace.

There's a CMake issue now: 
https://gitlab.kitware.com/cmake/cmake/issues/17793

Comment 5 Dave Malcolm 2018-03-06 14:00:11 UTC
jwakely: I believe this assert dates back to 2015-09-09 and is controlled by 
  #if defined(_GLIBCXX_ASSERTIONS)
Is _GLIBCXX_ASSERTIONS normally defined, or is that something that we only turn on during bring-up of a new version of gcc?  Thanks.

Comment 6 Jonathan Wakely 2018-03-06 14:17:34 UTC
Florian enabled it in rawhide recently, as it's like the libstdc++ equivalent of _FORTIFY_SOURCE.

Comment 7 Jonathan Wakely 2018-03-06 14:36:34 UTC
(and it's useful, because it finds undefined behaviour like this package bug).

Comment 8 Dave Malcolm 2018-03-06 14:45:43 UTC
Thanks

Comment 9 Jonathan Wakely 2018-03-06 14:50:50 UTC
(In reply to Sebastian Holtermann from comment #4)
> Hi. I'm the current maintainer of AUTOMOC.
> 
> Thanks for the backtrace.
> 
> There's a CMake issue now: 
> https://gitlab.kitware.com/cmake/cmake/issues/17793

You could also avoid calling front() entirely:

    content.reserve(length);
    content.assign(std::istreambuf_iterator<char>{ifs}, {});

Comment 10 Orion Poplawski 2018-03-09 05:14:46 UTC
I've gone with Jonathan's change (I think):

diff -up cmake-3.10.2/Source/cmQtAutoGenerators.cxx.automoc cmake-3.10.2/Source/cmQtAutoGenerators.cxx
--- cmake-3.10.2/Source/cmQtAutoGenerators.cxx.automoc  2018-01-18 07:48:42.000000000 -0700
+++ cmake-3.10.2/Source/cmQtAutoGenerators.cxx  2018-03-08 21:09:50.451726324 -0700
@@ -80,8 +80,8 @@ static bool ReadFile(std::string& conten
     std::size_t const length = cmSystemTools::FileLength(filename);
     cmsys::ifstream ifs(filename.c_str(), (std::ios::in | std::ios::binary));
     if (ifs) {
-      content.resize(length);
-      ifs.read(&content.front(), content.size());
+      content.reserve(length);
+      content.assign(std::istreambuf_iterator<char>{ifs}, {});
       if (ifs) {
         success = true;
       } else {


for 3.10.2 for now as upstream's fix is for 3.11 and the relevant code appears to have been refactored significantly.  It's building now in rawhide.  Let me know if it fixes the digikam build and I'll make an update for f28.

Comment 11 Adam Williamson 2018-03-09 17:25:23 UTC
After I actually pushed and built Orion's change, fix confirmed: digikam built successfully for F29. Please send to F28.

Comment 12 Fedora Update System 2018-03-09 21:15:59 UTC
cmake-3.10.2-4.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-2d5a4c2dab

Comment 13 Fedora Update System 2018-03-11 03:04:09 UTC
cmake-3.10.2-4.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-2d5a4c2dab

Comment 14 Fedora Update System 2018-03-29 09:53:48 UTC
cmake-3.11.0-1.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-e899ee34bf

Comment 15 Fedora Update System 2018-03-29 09:54:07 UTC
cmake-3.11.0-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2018-926e88d126

Comment 16 Fedora Update System 2018-03-29 09:54:19 UTC
cmake-3.11.0-1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-d9a3a285b1

Comment 17 Fedora Update System 2018-03-29 13:58:51 UTC
cmake-3.11.0-1.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-e899ee34bf

Comment 18 Fedora Update System 2018-03-29 16:48:43 UTC
cmake-3.11.0-1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-926e88d126

Comment 19 Fedora Update System 2018-03-29 17:58:41 UTC
cmake-3.11.0-1.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-d9a3a285b1

Comment 20 Fedora Update System 2018-03-30 12:48:25 UTC
cmake-3.10.2-4.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 21 Fedora Update System 2018-04-01 03:29:30 UTC
cmake-3.11.0-1.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

Comment 22 Fedora Update System 2018-04-02 11:48:24 UTC
cmake-3.11.0-1.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 23 Fedora Update System 2018-04-02 12:33:56 UTC
cmake-3.11.0-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.