]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
build: Link TBB into io_exerciser if present 62663/head
authorAdam Emerson <aemerson@redhat.com>
Thu, 23 Jan 2025 21:15:52 +0000 (16:15 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Fri, 4 Apr 2025 22:42:44 +0000 (18:42 -0400)
libstdc++ uses TBB to implement the execution library if it is
available. If it's not present, we get a serial backend.

Currently, we aren't getting link errors in most cases because the
reference is optimized out, but when compiling with `-O0`, we hit a
missing symbol.

If we use more of the execution library, we'll reference TBB in ways
that don't optimize out.

As such, test if TBB is available. If so, link against it.

See https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2017
for more information.

Signed-off-by: Adam Emerson <aemerson@redhat.com>
src/common/io_exerciser/CMakeLists.txt

index ab2e64fc22230930be9e2ec819ae373819069706..6f27607f31ae27a80018a71cd34df5ae0d41aec1 100644 (file)
@@ -12,4 +12,17 @@ target_link_libraries(object_io_exerciser
   librados
   global
   json_structures
-)
\ No newline at end of file
+)
+
+# libstdc++ uses TBB to implement <execution> if it is available,
+# which means that if we're going to use <execution>, we need to link
+# against TBB if it's available.
+#
+# It happens to work by accident at present because the optimizer
+# optimizes out our one reference, for now, but this breaks compiling
+# with `-O0` and will break anyway once we try to do more.
+find_package(TBB QUIET)
+if(TBB_FOUND)
+  message(STATUS "Linking to TBB for implementations of <execution>.")
+  target_link_libraries(object_io_exerciser TBB::tbb)
+endif(TBB_FOUND)