New issue
Advanced search Search tips

Issue 756020 link

Starred by 5 users

Issue metadata

Status: Duplicate
Merged: issue 769439
Owner:
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

chromeos libstdc++ does not support heterogeneous associative lookup (C++14)

Project Member Reported by jbroman@chromium.org, Aug 16 2017

Issue description

This blocks uses of std::map etc. with C++14 heterogeneous lookup (e.g. using std::less<>) from landing.
https://chromium-review.googlesource.com/c/616262
https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Ftryserver.chromium.linux%2Fchromeos_amd64-generic_chromium_compile_only_ng%2F400298%2F%2B%2Frecipes%2Fsteps%2Fcompile__with_patch_%2F0%2Fstdout

Failure seems to be a result of the g++ 4.9 STL being used (error arises from x86_64-cros-linux-gnu/4.9.x/include/g++-v4/bits/stl_map.h); this feature was added in 5.0 according to cppreference.

Compiler error follows.

/b/c/goma_client/gomacc x86_64-cros-linux-gnu-clang++ -B/b/c/b/chromeos_amd64_generic_chromium_compile_only_ng/.cros_cache/chrome-sdk/tarballs/amd64-generic+9800.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.27-gold -Wno-unknown-warning-option -MMD -MF obj/base/base/command_line.o.d -DSYSTEM_NATIVE_UTF8 -DUSE_SYMBOLIZE -DV8_DEPRECATION_WARNINGS -DUSE_UDEV -DUSE_ASH=1 -DUSE_AURA=1 -DUSE_NSS_CERTS=1 -DUSE_OZONE=1 -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED -DCR_CLANG_REVISION=\"310694-1\" -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DOS_CHROMEOS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DBASE_IMPLEMENTATION -I../.. -Igen -fno-strict-aliasing -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -pipe -B../../third_party/binutils/Linux_x64/Release/bin -pthread -fcolor-diagnostics -m64 -march=x86-64 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-unneeded-internal-declaration -Wno-inconsistent-missing-override -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-address-of-packed-member -Wno-unused-lambda-capture -Wno-user-defined-warnings -Wno-enum-compare-switch -fno-omit-frame-pointer -g2 -gsplit-dwarf -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wno-char-subscripts -Wexit-time-destructors -Wexit-time-destructors -O2 -fno-ident -fdata-sections -ffunction-sections -std=gnu++14 -fno-rtti --sysroot=../../../.cros_cache/chrome-sdk/tarballs/amd64-generic+9800.0.0+sysroot_chromeos-base_chromeos-chrome.tar.xz -fno-exceptions -fvisibility-inlines-hidden -pipe -pipe -pipe -march=x86-64 -msse3 -fno-split-dwarf-inlining -D__google_stl_debug_vector=1 -Wno-unknown-warning-option -Wno-inline-asm -c ../../base/command_line.cc -o obj/base/base/command_line.o
../../base/command_line.cc:318:27: error: no matching member function for call to 'find'
  auto result = switches_.find(switch_string);
                ~~~~~~~~~~^~~~
/b/c/b/chromeos_amd64_generic_chromium_compile_only_ng/.cros_cache/chrome-sdk/tarballs/amd64-generic+9800.0.0+target_toolchain/usr/bin/../lib/gcc/x86_64-cros-linux-gnu/4.9.x/include/g++-v4/bits/stl_map.h:874:7: note: candidate function not viable: no known conversion from 'const base::StringPiece' (aka 'const BasicStringPiece<basic_string<char> >') to 'const std::map<std::basic_string<char>, std::basic_string<char>, std::less<void>, std::allocator<std::pair<const std::basic_string<char>, std::basic_string<char> > > >::key_type' (aka 'const std::basic_string<char>') for 1st argument
      find(const key_type& __x) const
      ^
/b/c/b/chromeos_amd64_generic_chromium_compile_only_ng/.cros_cache/chrome-sdk/tarballs/amd64-generic+9800.0.0+target_toolchain/usr/bin/../lib/gcc/x86_64-cros-linux-gnu/4.9.x/include/g++-v4/bits/stl_map.h:859:7: note: candidate function not viable: 'this' argument has type 'const base::CommandLine::SwitchMap' (aka 'const map<basic_string<char>, basic_string<char>, less<> >'), but method is not marked const
      find(const key_type& __x)
      ^
In file included from ../../base/command_line.cc:13:
../../base/stl_util.h:83:21: error: no matching member function for call to 'find'
  return collection.find(key) != collection.end();
         ~~~~~~~~~~~^~~~
../../base/command_line.cc:289:10: note: in instantiation of function template specialization 'base::ContainsKey<std::map<std::basic_string<char>, std::basic_string<char>, std::less<void>, std::allocator<std::pair<const std::basic_string<char>, std::basic_string<char> > > >, base::BasicStringPiece<std::string> >' requested here
  return ContainsKey(switches_, switch_string);
         ^
/b/c/b/chromeos_amd64_generic_chromium_compile_only_ng/.cros_cache/chrome-sdk/tarballs/amd64-generic+9800.0.0+target_toolchain/usr/bin/../lib/gcc/x86_64-cros-linux-gnu/4.9.x/include/g++-v4/bits/stl_map.h:874:7: note: candidate function not viable: no known conversion from 'const base::BasicStringPiece<std::string>' to 'const std::map<std::basic_string<char>, std::basic_string<char>, std::less<void>, std::allocator<std::pair<const std::basic_string<char>, std::basic_string<char> > > >::key_type' (aka 'const std::basic_string<char>') for 1st argument
      find(const key_type& __x) const
      ^
/b/c/b/chromeos_amd64_generic_chromium_compile_only_ng/.cros_cache/chrome-sdk/tarballs/amd64-generic+9800.0.0+target_toolchain/usr/bin/../lib/gcc/x86_64-cros-linux-gnu/4.9.x/include/g++-v4/bits/stl_map.h:859:7: note: candidate function not viable: 'this' argument has type 'const std::map<std::basic_string<char>, std::basic_string<char>, std::less<void>, std::allocator<std::pair<const std::basic_string<char>, std::basic_string<char> > > >', but method is not marked const
      find(const key_type& __x)
      ^
 

Comment 1 by thakis@chromium.org, Aug 16 2017

Cc: llozano@chromium.org
llozano, what's the best short-term mitigation here?

* update cros toolchain to have libstdc++ newer than 4.9
* expedite cros toolchain switch to libc++
* let chrome for chromeos also statically link chromium's libc++
Also affects std::cbegin (low-priority, but nice to have):
https://chromium-review.googlesource.com/c/616268/
Cc: manojgupta@chromium.org
Labels: Build-Toolchain
we are working on the migration to libc++ but I would suspect this would take a couple of months more.
when do you want this by?

Comment 4 by thakis@chromium.org, Aug 16 2017

Ideally, now.
Cc: cmt...@chromium.org
sorry, but I dont think we can do now.
Even if we go with statically linked option, we have not done correctness and performance testing. 
We need a few weeks more. 
Note: in this bug we should also update allowed features list entry for transparent function objects.
Owner: manojgupta@chromium.org
Status: Assigned (was: Untriaged)
Mergedinto: 769439
Status: Duplicate (was: Assigned)
Labels: libcxx

Sign in to add a comment