Skip to content

Commit 0e3cc16

Browse files
emilylangeK900
andcommitted
electron_31: fix build after llvm bump
This fixes the following build errors: ~~~ [2607/50420] CXX obj/third_party/perfetto/src/tracing/client_api_without_backends/track_event_legacy.o FAILED: obj/third_party/perfetto/src/tracing/client_api_without_backends/track_event_legacy.o clang++ -MD -MF [...] In file included from ../../third_party/perfetto/src/tracing/track_event_legacy.cc:17: In file included from ../../third_party/perfetto/include/perfetto/tracing/track_event_legacy.h:26: In file included from ../../third_party/perfetto/include/perfetto/tracing/track_event.h:20: ../../third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:331:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw] 331 | Base::template Trace([](typename Base::TraceContext ctx) { ctx.Flush(); }); | ^ [...] 6 errors generated. ~~~ and ~~~ FAILED: obj/electron/electron_lib/keyboard_util.o clang++ -MD -MF [...] ../../electron/shell/common/keyboard_util.cc:19:30: error: constexpr function never produces a constant expression [-Winvalid-constexpr] 19 | constexpr CodeAndShiftedChar KeyboardCodeFromKeyIdentifier( | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../electron/shell/common/keyboard_util.cc:111:33: note: non-constexpr function 'find' cannot be used in a constant expression 111 | if (auto* const iter = Lookup.find(str); iter != Lookup.end()) | ^ ../../base/containers/flat_tree.h:310:18: note: declared here 310 | const_iterator find(const Key& key) const; | ^ 1 error generated. ~~~ This is happening since staging has been merged into master, which included both a rustc and llvm bump. Note that we inherit the llvm that rustc exposes. Co-Authored-By: K900 <me@0upti.me>
1 parent fd31328 commit 0e3cc16

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

pkgs/development/tools/electron/common.nix

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
chromium,
55
nodejs,
66
python3,
7+
fetchpatch,
78
fetchYarnDeps,
89
fetchNpmDeps,
910
fixup-yarn-lock,
@@ -59,7 +60,40 @@ in
5960

6061
src = null;
6162

62-
patches = base.patches;
63+
patches =
64+
base.patches
65+
++ lib.optionals (lib.versionOlder info.version "32") [
66+
# Backport a few fixes for -Wmissing-template-arg-list-after-template-kw
67+
# which only effects the soon-to-be-EOLed electron 31 (chromium M126).
68+
# https://issues.chromium.org/issues/344680447
69+
70+
# https://chromium-review.googlesource.com/c/chromium/src/+/5604664
71+
(fetchpatch {
72+
url = "https://github.com/chromium/chromium/commit/b0088fa60970412160535c367e2ff53b25b8538e.patch";
73+
hash = "sha256-eEYO+IN1062iCqVr6eO3UZlGLN376lMXc6UQunJGpdQ=";
74+
})
75+
76+
# https://android-review.googlesource.com/c/platform/external/perfetto/+/3114454
77+
(fetchpatch {
78+
name = "perfetto-e2f661907a717551235563389977b7468da6d45e.patch";
79+
url = "https://android.googlesource.com/platform/external/perfetto/+/e2f661907a717551235563389977b7468da6d45e^!?format=TEXT";
80+
decode = "base64 -d";
81+
stripLen = 1;
82+
extraPrefix = "third_party/perfetto/";
83+
hash = "sha256-5zSAZZI1tR7O4Aui22T/6uyk0RpuIy7XqDD0nwlDySQ=";
84+
})
85+
86+
./electron-31-perfetto-missing-template-arg-list.patch
87+
88+
# And a finally fix for -Winvalid-constexpr that is happening within the electron patchset.
89+
# https://github.com/electron/electron/pull/42413/commits/394a26f94a3fbce91e15e80e8e73b9a3ec1f04d1
90+
(fetchpatch {
91+
url = "https://github.com/electron/electron/commit/394a26f94a3fbce91e15e80e8e73b9a3ec1f04d1.patch";
92+
stripLen = 1;
93+
extraPrefix = "electron/";
94+
hash = "sha256-lllUUDm1thnC+rH8hBtPBVLRx6Pis5TPEUeQli9z1Mk=";
95+
})
96+
];
6397

6498
unpackPhase =
6599
''
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/include/perfetto/tracing/internal/track_event_data_source.h b/include/perfetto/tracing/internal/track_event_data_source.h
2+
index 1d924b271..dba896262 100644
3+
--- a/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h
4+
+++ b/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h
5+
@@ -1061,7 +1061,7 @@ class TrackEventDataSource
6+
const TrackType& track,
7+
std::function<void(protos::pbzero::TrackDescriptor*)> callback) {
8+
TrackRegistry::Get()->UpdateTrack(track, std::move(callback));
9+
- Base::template Trace([&](typename Base::TraceContext ctx) {
10+
+ Base::Trace([&](typename Base::TraceContext ctx) {
11+
TrackEventInternal::WriteTrackDescriptor(
12+
track, ctx.tls_inst_->trace_writer.get(), ctx.GetIncrementalState(),
13+
*ctx.GetCustomTlsState(), TrackEventInternal::GetTraceTime());

0 commit comments

Comments
 (0)