From eabeaf5fbc29cf5102ce4868787cbf6f9abbe371 Mon Sep 17 00:00:00 2001 From: Willem Jan Withagen Date: Wed, 28 Nov 2018 13:27:13 +0100 Subject: [PATCH] rbd: workaround for llvm linker proplem, avoid std:pair dtor When linking with llvm linker on FreeBSD: ``` /usr/bin/ld.lld: error: undefined symbol: std::__1::pair, std::__1::allocator >, bool>::~pair() >>> referenced by Image.cc:349 (/home/jenkins/workspace/ceph-master/src/librbd/api/Image.cc:349) >>> Image.cc.o:(librbd::api::Image::list_children(librbd::ImageCtx*, cls::rbd::ParentImageSpec const&, std::__1::vector >*)) in archive ../../../lib/librbd_internal.a ``` Which is probably because the compiler calls a dtor on the just created pair. But the FreeBSD linker does not find a dtor in the any of the libraries. This rewrite build and links without the linker error. Signed-off-by: Willem Jan Withagen --- src/librbd/api/Image.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librbd/api/Image.cc b/src/librbd/api/Image.cc index 26bf02ac775..199e0d964ff 100644 --- a/src/librbd/api/Image.cc +++ b/src/librbd/api/Image.cc @@ -345,8 +345,8 @@ int Image::list_children(I *ictx, return r; } - for (auto& it : image_names_to_ids) { - child_image_id_to_info[it.second] = {it.first, false}; + for (auto& [name, id] : image_names_to_ids) { + child_image_id_to_info.insert({id, {name, false}}); } std::vector trash_images; -- 2.39.5