Skip to content

testcase fails to build with gcc-14 [release v1.1.1] #267

@bjornstromberg

Description

@bjornstromberg

due to changes in gcc-14 std::sort found in <algorithm> needs to be explicitly included.

see link porting-to-gcc-14

[45/70] Building CXX object test/CMakeFiles/Graaf_test.dir/graaflib/algorithm/strongly_connected_components/kosaraju_test.cpp.o
ninja: job failed: /usr/bin/g++  -I/path/graaf/src/graaf-1.1.1/test/../include -I/path/graaf/src/graaf-1.1.1/test -I/path/graaf/src/graaf-1.1.1/build/_deps/fmt-src/include -isystem /path/graaf/src/graaf-1.1.1/build/_deps/googletest-src/googletest/include -isystem /path/graaf/src/graaf-1.1.1/build/_deps/googletest-src/googletest -Os -fstack-clash-protection -Wformat -Werror=format-security -D_GLIBCXX_ASSERTIONS=1 -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_ENABLE_HARDENED_MODE=1 -fno-plt -std=gnu++20 -MD -MT test/CMakeFiles/Graaf_test.dir/graaflib/algorithm/strongly_connected_components/tarjan_test.cpp.o -MF test/CMakeFiles/Graaf_test.dir/graaflib/algorithm/strongly_connected_components/tarjan_test.cpp.o.d -o test/CMakeFiles/Graaf_test.dir/graaflib/algorithm/strongly_connected_components/tarjan_test.cpp.o -c /path/graaf/src/graaf-1.1.1/test/graaflib/algorithm/strongly_connected_components/tarjan_test.cpp
/path/graaf/src/graaf-1.1.1/test/graaflib/algorithm/strongly_connected_components/tarjan_test.cpp: In function 'bool graaf::algorithm::are_set_vectors_equal(const sccs_t&, const sccs_t&)':
/path/graaf/src/graaf-1.1.1/test/graaflib/algorithm/strongly_connected_components/tarjan_test.cpp:34:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   34 |     std::sort(inner_vec.begin(), inner_vec.end());
      |          ^~~~
      |          qsort
/path/graaf/src/graaf-1.1.1/test/graaflib/algorithm/strongly_connected_components/tarjan_test.cpp:37:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   37 |     std::sort(inner_vec.begin(), inner_vec.end());
      |          ^~~~
      |          qsort
/path/graaf/src/graaf-1.1.1/test/graaflib/algorithm/strongly_connected_components/tarjan_test.cpp:41:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   41 |   std::sort(sorted_vec1.begin(), sorted_vec1.end());
      |        ^~~~
      |        qsort
/path/graaf/src/graaf-1.1.1/test/graaflib/algorithm/strongly_connected_components/tarjan_test.cpp:42:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   42 |   std::sort(sorted_vec2.begin(), sorted_vec2.end());
      |        ^~~~
      |        qsort
ninja: subcommand failed

just a heads up on gcc-14 making issues and gcc-13 works fine. i will be deploying on system with gcc-13 so its a non-issue for me, but with time it will will become an issue for more users or downstream packagers.

the package 'APKBUILD' used on alpine-3.19 (uses gcc-13) & alpine-3.21 (uses gcc-14)

# Contributor: None <none@home.lan>
# Maintainer: None <none@home.lan>
pkgname=graaf
pkgver=1.1.1
pkgrel=0
pkgdesc="A general-purpose lightweight C++ graph library"
url="https://github.com/bobluppes/graaf"
arch="all"
license="MIT"
depends=""
depends_dev=""
makedepends="cmake samurai"
checkdepends=""
install=""
subpackages="$pkgname-dev $pkgname-doc"
source="https://github.com/bobluppes/graaf/archive/v$pkgver/graaf-$pkgver.tar.gz"
builddir="$srcdir/graaf-$pkgver"

# builds Tests, Examples & Benchmarks
build() {
        if [ "$CBUILD" != "$CHOST" ]; then
                local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
        fi
        cmake -B build -G Ninja \
                -DCMAKE_INSTALL_PREFIX=/usr \
                -DCMAKE_INSTALL_LIBDIR=lib \
                -DCMAKE_BUILD_TYPE=None \
                $crossopts
        cmake --build build
}

check() {
        ctest --test-dir build
}

# install
package() {
        DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
e97eeadaab079cf6ff429d2580ea7be454a6583b8cc5cd231065c7c51a87d52d60457370dc9688a7e426ffc7ef79ad9670e44966dd367224a4124bcd5755f080  graaf-1.1.1.tar.gz
"

it should be simple enough to find with a docker container to build that with, to get a gcc-13/14 install to verify this defect against.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions