Package: libthread-pool
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu lunar ubuntu-patch
X-Debbugs-Cc: vladimir.pe...@canonical.com

Dear Maintainer,

The library fails to compile on 32-bit platforms such as armhf, due to
hardcoded unsigned long constant in std::max() comparison.

In Ubuntu, the attached patch was applied to achieve the following:

  * debian/patches/fix-unsigned-cast.patch: fix FTBS for armhf (LP: #2009537).

Thanks for considering the patch.
diff -Nru libthread-pool-4.0.0/debian/patches/fix-unsigned-cast.patch libthread-pool-4.0.0/debian/patches/fix-unsigned-cast.patch
--- libthread-pool-4.0.0/debian/patches/fix-unsigned-cast.patch	1970-01-01 12:00:00.000000000 +1200
+++ libthread-pool-4.0.0/debian/patches/fix-unsigned-cast.patch	2023-03-07 15:53:47.000000000 +1300
@@ -0,0 +1,17 @@
+Description: Use size_t type for max() comparison
+ size_t is defined in an architecture-specific way. Construct size_t from int to avoid
+ the type mismatch error.
+Author: Vladimir Petko <vladimir.pe...@canonical.com>
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libthread-pool/+bug/2009537
+Last-Update: 2023-03-08
+--- a/include/thread_pool/thread_pool.hpp
++++ b/include/thread_pool/thread_pool.hpp
+@@ -24,7 +24,7 @@
+       std::size_t num_threads = std::thread::hardware_concurrency())
+       : threads_(),
+         thread_map_(),
+-        queues_(std::max(1UL, num_threads)),
++        queues_(std::max(size_t(1), num_threads)),
+         task_id_(0) {
+     for (std::size_t i = 0; i != queues_.size(); ++i) {
+       threads_.emplace_back([this, i] () -> void { Task(i); });
diff -Nru libthread-pool-4.0.0/debian/patches/series libthread-pool-4.0.0/debian/patches/series
--- libthread-pool-4.0.0/debian/patches/series	1970-01-01 12:00:00.000000000 +1200
+++ libthread-pool-4.0.0/debian/patches/series	2023-03-07 15:53:47.000000000 +1300
@@ -0,0 +1 @@
+fix-unsigned-cast.patch

Reply via email to