FTBFS: ‘starts_with’ has not been declared in ‘std::string’

Bug #2070284 reported by Andreas Hasenack
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dia (Ubuntu)
Fix Released
Undecided
Andreas Hasenack

Bug Description

FTBFS in Oracular: https://launchpadlibrarian.net/736230415/buildlog_ubuntu-oracular-amd64.dia_0.98+git20240130-1build5_BUILDING.txt.gz

c++ -Iplug-ins/libpdf_filter.so.p -Iplug-ins -I../plug-ins -Ilib -I../lib -I. -I.. -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/webp -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/libxml2 -I/usr/include/graphene-1.0 -I/usr/lib/x86_64-linux-gnu/graphene-1.0/include -I/usr/include/poppler -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu++17 -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_8 -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_70 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_70 -DGSEAL_ENABLE -g -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fdebug-prefix-map=/<<PKGBUILDDIR>>=/usr/src/dia-0.98+git20240130-1build5 -Wdate-time -D_FORTIFY_SOURCE=3 -fPIC -mfpmath=sse -msse -msse2 -pthread -MD -MQ plug-ins/libpdf_filter.so.p/pdf_pdf-import.cpp.o -MF plug-ins/libpdf_filter.so.p/pdf_pdf-import.cpp.o.d -o plug-ins/libpdf_filter.so.p/pdf_pdf-import.cpp.o -c ../plug-ins/pdf/pdf-import.cpp
In file included from /usr/include/poppler/Object.h:44,
                 from /usr/include/poppler/OutputDev.h:42,
                 from ../plug-ins/pdf/pdf-import.cpp:36:
/usr/include/poppler/goo/GooString.h:241:24: error: ‘starts_with’ has not been declared in ‘std::string’
  241 | using std::string::starts_with;
      | ^~~~~~~~~~~
/usr/include/poppler/goo/GooString.h:244:24: error: ‘ends_with’ has not been declared in ‘std::string’
  244 | using std::string::ends_with;
      | ^~~~~~~~~
In file included from /usr/include/poppler/Object.h:690:
/usr/include/poppler/Stream.h:300:26: error: ‘std::span’ has not been declared
  300 | virtual size_t write(std::span<unsigned char> data) = 0;
      | ^~~
/usr/include/poppler/Stream.h:300:35: error: expected ‘,’ or ‘...’ before ‘<’ token
  300 | virtual size_t write(std::span<unsigned char> data) = 0;
      | ^
/usr/include/poppler/Stream.h:321:18: error: ‘std::span’ has not been declared
  321 | size_t write(std::span<unsigned char> data) override;
      | ^~~
/usr/include/poppler/Stream.h:321:27: error: expected ‘,’ or ‘...’ before ‘<’ token
  321 | size_t write(std::span<unsigned char> data) override;
      | ^

Tags: ftbfs
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

The error is in an include file shipped with poppler, but poppler itself doesn't FTBFS...

Looking more closely, I see poppler is built with -std=c++20, and according to [1] the ends_with/starts_with are defined in c++20. But dia is built with -std=gnu17 (defined in [2]).

That change in [2] was done via commit [3]:
From 7093a1ad332c8efd91c81d6030ced5a86ab69309 Mon Sep 17 00:00:00 2001
From: Zander Brown <email address hidden>
Date: Tue, 8 Aug 2023 05:29:53 +0100
Subject: [PATCH] build: set c++ standard

Close: https://gitlab.gnome.org/GNOME/dia/-/merge_requests/96
---
 meson.build | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index cd988500c..0d3e4d282 100644
--- a/meson.build
+++ b/meson.build
@@ -2,7 +2,12 @@ project('dia',
         ['c', 'cpp'],
         version: '0.97.3', # This is the base version, git suffix gets added using vcs_tag().
         meson_version: '>= 0.58',
- default_options: ['warning_level=1']
+ default_options: [
+ 'warning_level=1',
+ 'buildtype=debugoptimized',
+ 'c_std=gnu17',
+ 'cpp_std=gnu++17',
+ ],
 )

 cc = meson.get_compiler('c')
--
GitLab

The last successful build of dia was at [4], on 2024-04-08, and it was already using -std=gnu17[5], and I don't even see warnings in the logs. In fact, the c++ invocation is identical.

1. https://en.cppreference.com/w/cpp/string/basic_string/starts_with
2. https://gitlab.gnome.org/GNOME/dia/-/blob/master/meson.build#L8
3. https://gitlab.gnome.org/GNOME/dia/-/commit/7093a1ad332c8efd91c81d6030ced5a86ab69309
4. https://launchpad.net/ubuntu/+source/dia/0.98+git20240130-1build4
5. https://launchpadlibrarian.net/723728520/buildlog_ubuntu-noble-amd64.dia_0.98+git20240130-1build4_BUILDING.txt.gz

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

To illustrate my point from the previous comment, this patch fixes the build in oracular, but I'm unsure if it's the correct fix, given that it build fine about 2 months ago and gnu17 was still the standard used back then:
--- a/meson.build
+++ b/meson.build
@@ -5,8 +5,8 @@ project('dia',
         default_options: [
                              'warning_level=1',
                              'buildtype=debugoptimized',
- 'c_std=gnu17',
- 'cpp_std=gnu++17',
+ 'c_std=gnu2x',
+ 'cpp_std=gnu++20',
                          ],
 )

Revision history for this message
Jeremy Bícha (jbicha) wrote :

Yes, poppler's C++ code is now built with the C++20 standard so a fix like that sounds right.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Uploaded

Changed in dia (Ubuntu):
assignee: nobody → Andreas Hasenack (ahasenack)
status: New → In Progress
Jeremy Bícha (jbicha)
Changed in dia (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package dia - 0.98+git20240130-1ubuntu1

---------------
dia (0.98+git20240130-1ubuntu1) oracular; urgency=medium

  * d/p/c++-standard-20.patch: bump C standards to 20, following poppler
    change (LP: #2070284)

 -- Andreas Hasenack <email address hidden> Mon, 24 Jun 2024 15:55:45 -0300

Changed in dia (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.