Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit 90fdf82

Browse files
committed
Fix build on FreeBSD
The build was failing with the following message: ``` ../src/profiler/sampler.cc:216:10: error: static_cast from 'pthread_t' (aka 'pthread *') to 'uint32_t' (aka 'unsigned int') is not allowed return static_cast<uint32_t>(thread_id); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` It seems that using the reinterpret_cast function as in OSX fixes the issue.
1 parent 6c3969c commit 90fdf82

4 files changed

+31
-6
lines changed

patches/0001-Build-a-standalone-static-library.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 9aa7780d5c7434706ba12b81ab021e0db9850982 Mon Sep 17 00:00:00 2001
1+
From 84470a0b6c696f42aa7f86ba5ffd22b17e0047c4 Mon Sep 17 00:00:00 2001
22
From: Petko Bordjukov <[email protected]>
33
Date: Mon, 25 Jul 2016 00:00:19 +0300
4-
Subject: [PATCH 1/3] Build a standalone static library
4+
Subject: [PATCH 1/4] Build a standalone static library
55

66
---
77
gypfiles/standalone.gypi | 3 +++

patches/0002-Don-t-compile-unnecessary-stuff.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From bb7beaa8dddf7d406de80cc6511abe942dfeabd6 Mon Sep 17 00:00:00 2001
1+
From 930d596106fb3289f6aa37cdf8abaec3106c31b9 Mon Sep 17 00:00:00 2001
22
From: Petko Bordjukov <[email protected]>
33
Date: Mon, 25 Jul 2016 00:04:07 +0300
4-
Subject: [PATCH 2/3] Don't compile unnecessary stuff
4+
Subject: [PATCH 2/4] Don't compile unnecessary stuff
55

66
---
77
Makefile | 7 +------

patches/0003-Use-the-fPIC-flag-for-the-static-library.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 22cd3f03af2d94da1f7506a8daa7708e8c93b928 Mon Sep 17 00:00:00 2001
1+
From 8873d0ee6e1304e256bf3181b287e189bc68a9c8 Mon Sep 17 00:00:00 2001
22
From: Petko Bordjukov <[email protected]>
33
Date: Mon, 25 Jul 2016 00:05:47 +0300
4-
Subject: [PATCH 3/3] Use the -fPIC flag for the static library
4+
Subject: [PATCH 3/4] Use the -fPIC flag for the static library
55

66
---
77
gypfiles/standalone.gypi | 2 +-
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 0f376ac8f77980b86bfbfb55e3a1714201a0f78f Mon Sep 17 00:00:00 2001
2+
From: Petko Bordjukov <[email protected]>
3+
Date: Wed, 27 Jul 2016 06:20:13 +0300
4+
Subject: [PATCH 4/4] Reinterpret thread hash for FreeBSD, too
5+
6+
---
7+
src/profiler/sampler.cc | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/src/profiler/sampler.cc b/src/profiler/sampler.cc
11+
index ae47dca..4eb8780 100644
12+
--- a/src/profiler/sampler.cc
13+
+++ b/src/profiler/sampler.cc
14+
@@ -210,7 +210,7 @@ void* ThreadKey(pthread_t thread_id) {
15+
16+
// Returns hash value for hash map.
17+
uint32_t ThreadHash(pthread_t thread_id) {
18+
-#if V8_OS_MACOSX
19+
+#if (V8_OS_MACOSX || V8_OS_FREEBSD)
20+
return static_cast<uint32_t>(reinterpret_cast<intptr_t>(thread_id));
21+
#else
22+
return static_cast<uint32_t>(thread_id);
23+
--
24+
2.9.0
25+

0 commit comments

Comments
 (0)