]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: workaround for llvm linker proplem, avoid std:pair dtor 25301/head
authorWillem Jan Withagen <wjw@digiware.nl>
Wed, 28 Nov 2018 12:27:13 +0000 (13:27 +0100)
committerWillem Jan Withagen <wjw@digiware.nl>
Wed, 5 Dec 2018 14:35:37 +0000 (15:35 +0100)
When linking with llvm linker on FreeBSD:
```
/usr/bin/ld.lld: error: undefined symbol: std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool>::~pair()
>>> referenced by Image.cc:349 (/home/jenkins/workspace/ceph-master/src/librbd/api/Image.cc:349)
>>>               Image.cc.o:(librbd::api::Image<librbd::ImageCtx>::list_children(librbd::ImageCtx*, cls::rbd::ParentImageSpec const&, std::__1::vector<librbd::linked_image_spec_t, std::__1::allocator<librbd::linked_image_spec_t> >*)) 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 <wjw@digiware.nl>
src/librbd/api/Image.cc

index 26bf02ac775a2fab9841ed90d3fd8e87ae03ba07..199e0d964ff392fbfe0f773cdbe6ff2e882211f4 100644 (file)
@@ -345,8 +345,8 @@ int Image<I>::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<librbd::trash_image_info_t> trash_images;