graaf icon indicating copy to clipboard operation
graaf copied to clipboard

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

Open bjornstromberg opened this issue 10 months ago • 4 comments

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 <[email protected]>
# Maintainer: None <[email protected]>
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.

bjornstromberg avatar Feb 27 '25 08:02 bjornstromberg

Hi there! Thank you for creating your first issue on the Graaf library, we will look into it shortly. In the mean time, please make sure the issue has the correct labels set.

github-actions[bot] avatar Feb 27 '25 09:02 github-actions[bot]

Marking this issue as stale. It will not be automatically closed.

Even though the maintainers of Graaf may not always have time to take a look in a timely fashion, your contributions are much appreciated. Please allow some time for @bobluppes to take a closer look.

github-actions[bot] avatar Mar 30 '25 09:03 github-actions[bot]

Hi @bjornstromberg, thanks for the heads up! (and sorry for the delay 😅)

This sounds like something we can address 👍🏻 I have created #282 as a follow up to also compile the project with multiple compiler versions in the CI.

bobluppes avatar Apr 30 '25 19:04 bobluppes

Marking this issue as stale. It will not be automatically closed.

Even though the maintainers of Graaf may not always have time to take a look in a timely fashion, your contributions are much appreciated. Please allow some time for @bobluppes to take a closer look.

github-actions[bot] avatar May 31 '25 09:05 github-actions[bot]