Skip to content

Commit

Permalink
fix: patch kcov for gcc 13
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed May 25, 2023
1 parent d60cc6a commit fbb91d5
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/node12/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/node12/setup-cpp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/node16/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/node16/setup-cpp.js.map

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions src/kcov/gcc13.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
From b63754b53b3a7cf43e13ec56bd0be76cb6175437 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <[email protected]>
Date: Thu, 15 Sep 2022 19:55:21 +0100
Subject: [PATCH] Fix build on gcc-13: add missing <stdint.h> include

[ 15%] Building CXX object src/CMakeFiles/kcov.dir/writers/cobertura-writer.cc.o
In file included from kcov/src/writers/cobertura-writer.cc:6:
kcov/src/include/reporter.hh:24:90: error: 'uint64_t' has not been declared
24 | LineExecutionCount(unsigned int hits, unsigned int possibleHits, uint64_t order) :
| ^~~~~~~~
---
src/include/collector.hh | 2 ++
src/include/reporter.hh | 1 +
src/include/source-file-cache.hh | 2 ++
3 files changed, 5 insertions(+)

diff --git a/src/include/collector.hh b/src/include/collector.hh
index 79e5d5f2..1369a416 100644
--- a/src/include/collector.hh
+++ b/src/include/collector.hh
@@ -2,6 +2,8 @@

#include <string>

+#include <stdint.h>
+
namespace kcov
{
class IFileParser;
diff --git a/src/include/reporter.hh b/src/include/reporter.hh
index bc058e69..98d8e56b 100644
--- a/src/include/reporter.hh
+++ b/src/include/reporter.hh
@@ -3,6 +3,7 @@
#include <string>

#include <stddef.h>
+#include <stdint.h>

namespace kcov
{
diff --git a/src/include/source-file-cache.hh b/src/include/source-file-cache.hh
index c0cb00ee..cfc73b81 100644
--- a/src/include/source-file-cache.hh
+++ b/src/include/source-file-cache.hh
@@ -3,6 +3,8 @@
#include <vector>
#include <string>

+#include <stdint.h>
+
namespace kcov
{
/**
13 changes: 13 additions & 0 deletions src/kcov/kcov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ async function buildKcov(file: string, dest: string) {
await setupAptPack([{ name: "libdw-dev" }, { name: "libcurl4-openssl-dev" }])
}
}

// apply gcc13.patch
try {
if (which.sync("patch", { nothrow: true }) !== null) {
const patch = join(__dirname, "gcc13.patch")
await execa("patch", ["-N", "-p1", "-i", patch], { cwd: out, stdio: "inherit" })
} else {
info("`patch` not found, skipping gcc13.patch, kcov may not build on gcc 13")
}
} catch {
// ignore
}

const buildDir = join(out, "build")
await execa(cmake, ["-S", out, "-B", buildDir, "-DCMAKE_BUILD_TYPE=Release", "-G", "Ninja"], {
cwd: out,
Expand Down

0 comments on commit fbb91d5

Please sign in to comment.