Skip to content

Commit fbb91d5

Browse files
committed
fix: patch kcov for gcc 13
1 parent d60cc6a commit fbb91d5

File tree

6 files changed

+71
-4
lines changed

6 files changed

+71
-4
lines changed

dist/node12/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node12/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node16/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node16/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/kcov/gcc13.patch

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
From b63754b53b3a7cf43e13ec56bd0be76cb6175437 Mon Sep 17 00:00:00 2001
2+
From: Sergei Trofimovich <slyich@gmail.com>
3+
Date: Thu, 15 Sep 2022 19:55:21 +0100
4+
Subject: [PATCH] Fix build on gcc-13: add missing <stdint.h> include
5+
6+
[ 15%] Building CXX object src/CMakeFiles/kcov.dir/writers/cobertura-writer.cc.o
7+
In file included from kcov/src/writers/cobertura-writer.cc:6:
8+
kcov/src/include/reporter.hh:24:90: error: 'uint64_t' has not been declared
9+
24 | LineExecutionCount(unsigned int hits, unsigned int possibleHits, uint64_t order) :
10+
| ^~~~~~~~
11+
---
12+
src/include/collector.hh | 2 ++
13+
src/include/reporter.hh | 1 +
14+
src/include/source-file-cache.hh | 2 ++
15+
3 files changed, 5 insertions(+)
16+
17+
diff --git a/src/include/collector.hh b/src/include/collector.hh
18+
index 79e5d5f2..1369a416 100644
19+
--- a/src/include/collector.hh
20+
+++ b/src/include/collector.hh
21+
@@ -2,6 +2,8 @@
22+
23+
#include <string>
24+
25+
+#include <stdint.h>
26+
+
27+
namespace kcov
28+
{
29+
class IFileParser;
30+
diff --git a/src/include/reporter.hh b/src/include/reporter.hh
31+
index bc058e69..98d8e56b 100644
32+
--- a/src/include/reporter.hh
33+
+++ b/src/include/reporter.hh
34+
@@ -3,6 +3,7 @@
35+
#include <string>
36+
37+
#include <stddef.h>
38+
+#include <stdint.h>
39+
40+
namespace kcov
41+
{
42+
diff --git a/src/include/source-file-cache.hh b/src/include/source-file-cache.hh
43+
index c0cb00ee..cfc73b81 100644
44+
--- a/src/include/source-file-cache.hh
45+
+++ b/src/include/source-file-cache.hh
46+
@@ -3,6 +3,8 @@
47+
#include <vector>
48+
#include <string>
49+
50+
+#include <stdint.h>
51+
+
52+
namespace kcov
53+
{
54+
/**

src/kcov/kcov.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ async function buildKcov(file: string, dest: string) {
5252
await setupAptPack([{ name: "libdw-dev" }, { name: "libcurl4-openssl-dev" }])
5353
}
5454
}
55+
56+
// apply gcc13.patch
57+
try {
58+
if (which.sync("patch", { nothrow: true }) !== null) {
59+
const patch = join(__dirname, "gcc13.patch")
60+
await execa("patch", ["-N", "-p1", "-i", patch], { cwd: out, stdio: "inherit" })
61+
} else {
62+
info("`patch` not found, skipping gcc13.patch, kcov may not build on gcc 13")
63+
}
64+
} catch {
65+
// ignore
66+
}
67+
5568
const buildDir = join(out, "build")
5669
await execa(cmake, ["-S", out, "-B", buildDir, "-DCMAKE_BUILD_TYPE=Release", "-G", "Ninja"], {
5770
cwd: out,

0 commit comments

Comments
 (0)