std::map::emplace()

114 views
Skip to first unread message

Ahmed Fakhry

unread,
Mar 28, 2017, 10:46:58 PM3/28/17
to chromi...@chromium.org
Why is std::map::emplace() is not available?

error: no member named 'emplace' in 'std::__debug::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >'

Is it because we're building with -std=gnu++11? If yes, why aren't we using -std=c++11?

Peter Kasting

unread,
Mar 28, 2017, 11:05:06 PM3/28/17
to afa...@chromium.org, Chromium-dev
On Tue, Mar 28, 2017 at 7:45 PM, Ahmed Fakhry <afa...@chromium.org> wrote:
Why is std::map::emplace() is not available?

From https://chromium-cpp.appspot.com/ : "std::map::emplace() is not yet available on all libstdc++ versions we support."

Basically, it's a fixed library bug, but the fixes came after some of the versions we still have to support on certain platforms.

PK 

Sunny Sachanandani

unread,
Mar 28, 2017, 11:16:39 PM3/28/17
to afa...@chromium.org, Chromium-dev
Are you building on Linux with the default sysroot? Maybe because of the old version of libstdc++ in the wheezy sysroot? You can try the use_sysroot = false gn flag and see if that changes anything. The default sysroot is being updated from wheezy to jessie but I don't know the current status of that.

On Tue, Mar 28, 2017 at 7:45 PM, Ahmed Fakhry <afa...@chromium.org> wrote:

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CANpxZAzC3Hra_sRAeH-Ei2r%2BAWsodfogYUjcR0RsvudO4x1qmw%40mail.gmail.com.

Daniel Cheng

unread,
Mar 29, 2017, 12:01:53 AM3/29/17
to sun...@chromium.org, afa...@chromium.org, Chromium-dev
There's a non-exhaustive list of broken stuff on https://crbug.com/593874

Daniel

Peter Kasting

unread,
Mar 29, 2017, 12:10:58 AM3/29/17
to Sunny Sachanandani, afa...@chromium.org, Chromium-dev
On Tue, Mar 28, 2017 at 8:15 PM, Sunny Sachanandani <sun...@chromium.org> wrote:
Are you building on Linux with the default sysroot? Maybe because of the old version of libstdc++ in the wheezy sysroot? You can try the use_sysroot = false gn flag and see if that changes anything. The default sysroot is being updated from wheezy to jessie but I don't know the current status of that.

Note: that's https://bugs.chromium.org/p/chromium/issues/detail?id=701894 for people who want to follow along.

PK

Ahmed Fakhry

unread,
Mar 29, 2017, 2:27:40 PM3/29/17
to Sunny Sachanandani, Chromium-dev
On Tue, Mar 28, 2017 at 8:15 PM Sunny Sachanandani <sun...@chromium.org> wrote:
Are you building on Linux with the default sysroot? Maybe because of the old version of libstdc++ in the wheezy sysroot? You can try the use_sysroot = false gn flag and see if that changes anything. The default sysroot is being updated from wheezy to jessie but I don't know the current status of that.


Yes, I'm building on Linux. I didn't change the gn arg "use_sysroot" so I assume it's using the default value of "true". 

When I tried to set use_sysroot=false, the generated the following error:

ERROR at //chrome/installer/linux/BUILD.gn:297:19: Empty directory path.
      rebase_path(sysroot),
                  ^------
You can't use empty strings as directories. That's just wrong.
See //chrome/installer/linux/BUILD.gn:356:1: whence it was called.
linux_package("stable") {
^------------------------
See //chrome/installer/BUILD.gn:15:7: which caused the file to be included.
      "//chrome/installer/linux",
      ^-------------------------

Also using std::map::emplace() works find when building Chrome OS using simple-chrome. Note that the our trybots don't seem to be using use_sysroot.

Jan Wilken

unread,
Apr 24, 2017, 5:16:22 AM4/24/17
to Chromium-dev, sun...@chromium.org, afa...@chromium.org
http://crbug.com/701894 got fixed in the meantime, meaning |std::map::emplace| is available now on all platforms. Here is a quick proof of concept: http://crrev.com/2838553002

I suppose we should update https://chromium-cpp.appspot.com/ and drop the corresponding sentence, what do you think?

Peter Kasting

unread,
Apr 24, 2017, 4:16:44 PM4/24/17
to jdoe...@chromium.org, Chromium-dev, Sunny Sachanandani, afa...@chromium.org
On Mon, Apr 24, 2017 at 2:16 AM, Jan Wilken <jdoe...@chromium.org> wrote:
http://crbug.com/701894 got fixed in the meantime, meaning |std::map::emplace| is available now on all platforms. Here is a quick proof of concept: http://crrev.com/2838553002

\o/

I suppose we should update https://chromium-cpp.appspot.com/ and drop the corresponding sentence, what do you think?

Yep.  The files are in your checkout in styleguide/c++/c++11.html ; feel free to send a CL to a relevant OWNER.

PK

Jeremy Roman

unread,
Apr 24, 2017, 5:50:50 PM4/24/17
to Peter Kasting, jdoe...@chromium.org, Chromium-dev, Sunny Sachanandani, afa...@chromium.org
Woohoo! Please include a code change to use std::map::emplace in the same CL that makes the styleguide change, but sounds like we might be good to go.
 
PK

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.

Jan Wilken

unread,
Apr 25, 2017, 7:36:16 AM4/25/17
to Chromium-dev, pkas...@chromium.org, jdoe...@chromium.org, sun...@chromium.org, afa...@chromium.org
Thanks all, corresponding CL is out: http://crrev.com/2844443002
Reply all
Reply to author
Forward
0 new messages