From e3a87415637bb3148b62c87f756c932545777b25 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Wed, 23 Oct 2024 18:39:19 +0000 Subject: [PATCH] linux: Disable 'duplicate symbol' linker errors These linker errors impact CEF builds but not Chromium builds due to differences in application structure, and are becoming more common with ongoing Chromium code refactoring. When running via ASAN it may be necessary to set `ASAN_OPTIONS=detect_odr_violation=0` to work around https://github.com/google/sanitizers/issues/1017 --- BUILD.gn | 21 ++++++----- patch/patch.cfg | 18 ---------- patch/patches/chrome_browser_browser.patch | 39 ++------------------- patch/patches/linux_bluetooth_1319006.patch | 21 ----------- 4 files changed, 15 insertions(+), 84 deletions(-) delete mode 100644 patch/patches/linux_bluetooth_1319006.patch diff --git a/BUILD.gn b/BUILD.gn index 5e9592ec9..9a6f5094c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1608,14 +1608,19 @@ if (is_mac) { ] } - if (is_linux && !is_debug && !use_partition_alloc_as_malloc) { - # Only export necessary symbols from libcef.so. - # Don't do this in Debug builds because it causes the resulting - # application to crash. - # Also need to do this for ASAN builds to work around - # https://crbug.com/832808. - ldflags = [ "-Wl,--version-script=" + - rebase_path("//cef/libcef_dll/libcef.lst") ] + if (is_linux) { + # Disable 'duplicate symbol' linker errors. + ldflags = [ "-Wl,--allow-multiple-definition" ] + + if (!is_debug && !use_partition_alloc_as_malloc) { + # Only export necessary symbols from libcef.so. + # Don't do this in Debug builds because it causes the resulting + # application to crash. + # Also need to do this for ASAN builds to work around + # https://crbug.com/832808. + ldflags += [ "-Wl,--version-script=" + + rebase_path("//cef/libcef_dll/libcef.lst") ] + } } } } diff --git a/patch/patch.cfg b/patch/patch.cfg index fb953214c..ef00cbdbb 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -229,19 +229,6 @@ patches = [ # From chrome/browser/ui/browser_commands.cc via # chrome/browser/printing/print_view_manager_common.h # - # Linux: Fix duplicate symbol error for window_frame_util.cc - # https://issuetracker.google.com/issues/343037853#comment3 - # - # Linux: Fix duplicate symbol error for tab_network_state.cc - # https://issuetracker.google.com/issues/353628440#comment8 - # - # Linux: Fix duplicate symbol error for automation_manager_aura.cc - # https://chromium-review.googlesource.com/c/chromium/src/+/5893679 - # - # Linux: Fix duplicate symbol error for - # chrome_bluetooth_chooser_controller.cc - # https://chromium-review.googlesource.com/c/chromium/src/+/5894080 - # # Avoid duplicate window from DevTools when CEF handles the open via # OnOpenURLFromTab. # https://github.com/chromiumembedded/cef/issues/3735 @@ -586,11 +573,6 @@ patches = [ # https://github.com/chromiumembedded/cef/issues/3294 'name': 'win_shell_dialogs_3294', }, - { - # Linux: Fix duplicate symbol error due to bluez/metrics_recorder.cc. - # https://bugs.chromium.org/p/chromium/issues/detail?id=1319006 - 'name': 'linux_bluetooth_1319006', - }, { # Linux: Support chaining of PrintingContextLinux callbacks. # https://github.com/chromiumembedded/cef/issues/3314 diff --git a/patch/patches/chrome_browser_browser.patch b/patch/patches/chrome_browser_browser.patch index 8672e88c3..73ffb8cd8 100644 --- a/patch/patches/chrome_browser_browser.patch +++ b/patch/patches/chrome_browser_browser.patch @@ -88,7 +88,7 @@ index b4a11f0509df7..04f615abc4404 100644 } diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn -index bc6e4008f2c5a..1b6b33e96b46c 100644 +index bc6e4008f2c5a..b8db5a4b59095 100644 --- chrome/browser/ui/BUILD.gn +++ chrome/browser/ui/BUILD.gn @@ -8,6 +8,7 @@ import("//build/config/compiler/compiler.gni") @@ -129,42 +129,7 @@ index bc6e4008f2c5a..1b6b33e96b46c 100644 # TODO(crbug.com/41437292): Remove this circular dependency. # Any circular includes must depend on the target "//chrome/browser:browser_public_dependencies". # These are all-platform circular includes. -@@ -1009,8 +1019,6 @@ static_library("ui") { - sources += [ - "app_icon_loader.cc", - "app_icon_loader.h", -- "bluetooth/chrome_bluetooth_chooser_controller.cc", -- "bluetooth/chrome_bluetooth_chooser_controller.h", - "bookmarks/bookmark_bar.h", - "bookmarks/bookmark_context_menu_controller.cc", - "bookmarks/bookmark_context_menu_controller.h", -@@ -1466,7 +1474,6 @@ static_library("ui") { - "tabs/tab_menu_model_factory.h", - "tabs/tab_model.cc", - "tabs/tab_model.h", -- "tabs/tab_network_state.cc", - "tabs/tab_network_state.h", - "tabs/tab_renderer_data.cc", - "tabs/tab_renderer_data.h", -@@ -3208,8 +3215,6 @@ static_library("ui") { - - if (is_win || is_mac || is_linux || is_chromeos) { - sources += [ -- "frame/window_frame_util.cc", -- "frame/window_frame_util.h", - "incognito_clear_browsing_data_dialog_interface.h", - "passwords/password_cross_domain_confirmation_popup_controller_impl.cc", - "passwords/password_cross_domain_confirmation_popup_controller_impl.h", -@@ -5535,8 +5540,6 @@ static_library("ui") { - - if (use_aura) { - sources += [ -- "aura/accessibility/automation_manager_aura.cc", -- "aura/accessibility/automation_manager_aura.h", - "overscroll_pref_manager.cc", - "overscroll_pref_manager.h", - "views/accelerator_utils_aura.cc", -@@ -5788,6 +5791,7 @@ static_library("ui") { +@@ -5788,6 +5798,7 @@ static_library("ui") { if (enable_printing) { deps += [ "//components/printing/browser", diff --git a/patch/patches/linux_bluetooth_1319006.patch b/patch/patches/linux_bluetooth_1319006.patch deleted file mode 100644 index 9c251405a..000000000 --- a/patch/patches/linux_bluetooth_1319006.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git device/bluetooth/BUILD.gn device/bluetooth/BUILD.gn -index 82d4f2bf563f6..87652664f9e56 100644 ---- device/bluetooth/BUILD.gn -+++ device/bluetooth/BUILD.gn -@@ -57,10 +57,12 @@ source_set("deprecated_experimental_mojo") { - ] - - if (is_chromeos || is_linux) { -- sources += [ -- "bluez/metrics_recorder.cc", -- "bluez/metrics_recorder.h", -- ] -+ if (is_component_build) { -+ sources += [ -+ "bluez/metrics_recorder.cc", -+ "bluez/metrics_recorder.h", -+ ] -+ } - } - - deps = [