[Buildroot] [PATCH v2 1/1] package/libgeos: bump version to 3.14.0
Julien Olivain
ju.o at free.fr
Mon Sep 15 21:00:08 UTC 2025
Hi Maxim,
On 15/09/2025 22:07, Maxim Kochetkov via buildroot wrote:
> Changelog: https://github.com/libgeos/geos/releases/tag/3.14.0
>
> Bump minimal GCC version to 7. (Switched to C++17 as minimum
> requirement)
> https://github.com/libgeos/geos/commit/e142764b77f4b8d0c36ec88406300c5f876743fb
>
> Since commit
> https://github.com/libgeos/geos/commit/26292ce88077321ced5db5869ea0b11cabaa2d12
> libgeos uses fenv.h to catch FPU exceptions. Some libc implementation
> may
> have no fenv support. So add a patch to detect fenv.h availability.
>
> Signed-off-by: Maxim Kochetkov <fido_max at inbox.ru>
Thanks for the updated patch. It now passes "test-pkg -a".
So I applied it on master, with few minor fixups. See:
https://gitlab.com/buildroot.org/buildroot/-/commit/c7be3e603830f505c0c7df7e1b967122aa06fed0
I also have a small comment on your upstream patch proposal. See below.
[...]
> diff --git
> a/package/libgeos/0001-geosop-make-floating-point-exceptions-optional.patch
> b/package/libgeos/0001-geosop-make-floating-point-exceptions-optional.patch
> new file mode 100644
> index 0000000000..7b0760fba7
> --- /dev/null
> +++
> b/package/libgeos/0001-geosop-make-floating-point-exceptions-optional.patch
> @@ -0,0 +1,70 @@
> +From a6bac7bd506988085fa692ff2e12727ae0e9db84 Mon Sep 17 00:00:00 2001
> +From: Maxim Kochetkov <fido_max at inbox.ru>
> +Date: Mon, 15 Sep 2025 17:16:08 +0300
> +Subject: [PATCH 1/1] geosop: make floating-point exceptions optional
> +
> +commit 26292ce ("geosop: show most floating-point exceptions in
> verbose mode")
> +add fenv.h dependency. Some libc implementations (uclibc-ng )may have
> no fenv
> +support. So make floating-point exceptions optional and detetct fenv.h
> at
> +configure stage.
> +
> +Signed-off-by: Maxim Kochetkov <fido_max at inbox.ru>
> +---
> + CMakeLists.txt | 7 +++++++
> + util/geosop/GeosOp.cpp | 6 ++++++
> + 2 files changed, 13 insertions(+)
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index 12411e586..a1e2f0c6e 100644
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -558,3 +558,10 @@ if(PROJECT_IS_TOP_LEVEL)
> +
> + unset(_is_multi_config_generator)
> + endif() # PROJECT_IS_TOP_LEVEL
> ++
> ++include(CheckIncludeFile)
> ++check_include_file(fenv.h HAVE_FENV_H)
> ++
> ++if(HAVE_FENV_H)
> ++ target_compile_definitions(geos_cxx_flags INTERFACE HAVE_FENV)
> ++endif()
> +diff --git a/util/geosop/GeosOp.cpp b/util/geosop/GeosOp.cpp
> +index 2cb17f000..05307cf30 100644
> +--- a/util/geosop/GeosOp.cpp
> ++++ b/util/geosop/GeosOp.cpp
> +@@ -26,7 +26,9 @@
> + #include <geos/io/WKBStreamReader.h>
> + #include <geos/io/WKBWriter.h>
> +
> ++#if defined(HAVE_FENV)
> + #include <cfenv>
> ++#endif
> + #include <fstream>
> + #include <iostream>
> + #include <sstream>
> +@@ -394,10 +396,13 @@ void GeosOp::run(OpArguments& opArgs) {
> + //------------------------
> +
> + try {
> ++#if defined(HAVE_FENV)
> + std::feclearexcept(FE_ALL_EXCEPT); // clear floating-point
> status flags
> ++#endif
> +
> + execute(op, opArgs);
> +
> ++#if defined(HAVE_FENV)
> + // Catch everything except for FE_INEXACT, which is usually
> harmless
> + const int fpexp = std::fetestexcept(FE_ALL_EXCEPT ^
> FE_INEXACT);
> + if (args.isVerbose && (fpexp != 0)) {
> +@@ -414,6 +419,7 @@ void GeosOp::run(OpArguments& opArgs) {
> + std::cerr << " FE_UNDERFLOW";
A side note for the upsteam: testing fenv.h alone might not be
sufficient for a complete package portability. Quoting the
fetestexcept() manual page:
https://linux.die.net/man/3/fetestexcept
"""
Each of the macros FE_DIVBYZERO, FE_INEXACT, FE_INVALID, FE_OVERFLOW,
FE_UNDERFLOW is defined when the implementation supports handling of
the corresponding exception...
"""
So it seems theoretically possible that an implementation has the
fenv.h header, but not all FE_ macros.
So each macro usage should probably be protected too. For example:
#if defined(FE_DIVBYZERO)
if (fpexp & FE_DIVBYZERO)
std::cerr << " FE_DIVBYZERO";
#endif
In practice, in Buildroot, all toolchains having fenv.h are also
defining all the FE_ macros.
> + std::cerr << std::endl;
> + }
> ++#endif
> + }
> + catch (std::exception &e) {
> + std::cerr << "Run-time exception: " << e.what() << std::endl;
> +--
> +2.51.0
> +
Best regards,
Julien.
More information about the buildroot
mailing list