ODR violation - two copies of ui::GenerateDomKeyboardLayoutMap on Windows builds |
||
Issue descriptionWhile doing some test linking with use_lld=false I hit this warning: [352 processes, 11477/36375 @ 150.2/s : 76.409s ] LIB obj/ui/events/dom_keyboard_layout.lib dom_keyboard_layout_map_ozone.obj : warning LNK4006: "class base::flat_map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<void> > __cdecl ui::GenerateDomKeyboardLayoutMap(void)" (?GenerateDomKeyboardLayoutMap@ui@@YA?AV?$flat_map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@X@2@@base@@XZ) already defined in dom_keyboard_layout_map_win.obj; second definition ignored Investigation showed that, indeed, there are two functions called ui::GenerateDomKeyboardLayoutMap, one in ui\events\keycodes\dom\dom_keyboard_layout_map_win.cc and the other in ui\events\keycodes\dom\dom_keyboard_layout_map_ozone.cc This is a One Definition Rule violation and it is undefined which one of these functions will be pulled in. I'm not sure what the fix is - perhaps adding an ifdef so that the ozone version doesn't get compiled on Windows?
,
Jun 30 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/1f2706b35e5382d6d095673ec4755d279f110f02 commit 1f2706b35e5382d6d095673ec4755d279f110f02 Author: Bruce Dawson <brucedawson@chromium.org> Date: Sat Jun 30 00:34:23 2018 Don't compile ozone file for Windows or Mac While testing with link.exe on Windows I hit a warning about duplicate definitions of ui::GenerateDomKeyboardLayoutMap. This is because this function is defined in three source files - *_win.cc, *_mac.mm, and *_ozone.cc, and the *_ozone.cc file is always compiled. This means that it is undefined which version the linker will select when building for Windows and Mac. This ODR violation appeared in crrev.com/c/1093891 Bug: 857277 Change-Id: I05e9a3216a5e9c2c0925bd83267b03e6cb9aa2f6 Reviewed-on: https://chromium-review.googlesource.com/1117865 Reviewed-by: Sadrul Chowdhury <sadrul@chromium.org> Commit-Queue: Bruce Dawson <brucedawson@chromium.org> Cr-Commit-Position: refs/heads/master@{#571720} [modify] https://crrev.com/1f2706b35e5382d6d095673ec4755d279f110f02/ui/events/BUILD.gn
,
Jun 30 2018
,
Jun 30 2018
See also bug 726071 which covers ODR detection with lld. |
||
►
Sign in to add a comment |
||
Comment 1 by brucedaw...@chromium.org
, Jun 28 2018