Bug 238563 - www/chromium: fails to build on FreeBSD < 11.3
Summary: www/chromium: fails to build on FreeBSD < 11.3
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Carlos J. Puga Medina
URL:
Keywords:
: 238564 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-06-14 16:42 UTC by Konstantin Belousov
Modified: 2019-06-16 02:18 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (chromium)


Attachments
patch (1.36 KB, patch)
2019-06-14 17:22 UTC, Carlos J. Puga Medina
no flags Details | Diff
patch (1.35 KB, patch)
2019-06-14 21:36 UTC, Carlos J. Puga Medina
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Belousov freebsd_committer freebsd_triage 2019-06-14 16:42:44 UTC
Most likely due to missed #include <pthread_np.h>.

https://kib.kiev.ua/poudriere/data/tom_poudriere_11-head/2019-06-14_03h40m08s/logs/errors/chromium-75.0.3770.80.log
Comment 1 Carlos J. Puga Medina freebsd_committer freebsd_triage 2019-06-14 17:22:04 UTC
Created attachment 205061 [details]
patch

Hi Konstantine,

Please, apply the patch and try to build again.

Thanks for reporting!
Comment 2 Carlos J. Puga Medina freebsd_committer freebsd_triage 2019-06-14 17:23:00 UTC
*** Bug 238564 has been marked as a duplicate of this bug. ***
Comment 3 Konstantin Belousov freebsd_committer freebsd_triage 2019-06-14 18:40:49 UTC
(In reply to Carlos J. Puga Medina from comment #1)
No, the patch does not help, and the error is same.  As I said, you need pthread_np.h
https://kib.kiev.ua/poudriere/data/tom_poudriere_11-head/2019-06-14_21h11m56s/logs/chromium-75.0.3770.80.log
Comment 4 Carlos J. Puga Medina freebsd_committer freebsd_triage 2019-06-14 19:09:07 UTC
(In reply to Konstantin Belousov from comment #3)

pthread_get_name_np is supported on 11.2-STABLE.

It's added in base/sampling_heap_profiler/sampling_heap_profiler.cc

--- base/sampling_heap_profiler/sampling_heap_profiler.cc.orig	2019-06-04 18:55:15 UTC
+++ base/sampling_heap_profiler/sampling_heap_profiler.cc
@@ -30,6 +30,10 @@
 #include <sys/prctl.h>
 #endif
 
+#if defined(OS_BSD)
+#include <pthread_np.h>
+#endif
+
 #if defined(OS_ANDROID) && BUILDFLAG(CAN_UNWIND_WITH_CFI_TABLE) && \
     defined(OFFICIAL_BUILD)
 #include "base/trace_event/cfi_backtrace_android.h"
@@ -65,6 +69,10 @@ const char* GetAndLeakThreadName() {
 #elif defined(OS_MACOSX)
   int err = pthread_getname_np(pthread_self(), name, kBufferLen);
   if (err == 0 && *name != '\0')
+    return strdup(name);
+#elif defined(OS_BSD)
+  pthread_get_name_np(pthread_self(), name, kBufferLen);
+  if (*name != '\0')
     return strdup(name);
 #endif  // defined(OS_LINUX) || defined(OS_ANDROID)
 
We're working to unbreak chromium on 11.2-RELEASE.
Comment 5 Carlos J. Puga Medina freebsd_committer freebsd_triage 2019-06-14 21:36:03 UTC
Created attachment 205064 [details]
patch

Let's take advantage of pthread_get_name_np() only if it's available. Firefox applies the same solution.
Comment 6 Jan Beich freebsd_committer freebsd_triage 2019-06-14 21:53:02 UTC
Comment on attachment 205064 [details]
patch

- pthread_get_name_np isn't available on DragonFly yet while NetBSD uses glibc prototype
- Firefox defines HAVE_PTHREAD_GET_NAME_NP via AC_CHECK_FUNCS but Chromium does not
Comment 7 commit-hook freebsd_committer freebsd_triage 2019-06-16 02:17:44 UTC
A commit references this bug:

Author: cpm
Date: Sun Jun 16 02:17:03 UTC 2019
New revision: 504272
URL: https://svnweb.freebsd.org/changeset/ports/504272

Log:
  www/chromium: Unbreak build on < 11.3

  In file included from gen/base/base_jumbo_17.cc:8:
  ./../../base/sampling_heap_profiler/sampling_heap_profiler.cc:74:3: error: use of undeclared identifier 'pthread_get_name_np'
    pthread_get_name_np(pthread_self(), name, kBufferLen);
    ^

  PR:		238563
  Reported by:	kib@

Changes:
  head/www/chromium/files/patch-base_sampling__heap__profiler_sampling__heap__profiler.cc