From: Willem Jan Withagen Date: Wed, 28 Nov 2018 12:27:13 +0000 (+0100) Subject: rbd: workaround for llvm linker proplem, avoid std:pair dtor X-Git-Tag: v14.1.0~708^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F25301%2Fhead;p=ceph.git 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 --- diff --git a/src/librbd/api/Image.cc b/src/librbd/api/Image.cc index 26bf02ac775a..199e0d964ff3 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;