Bug 238563

Summary: www/chromium: fails to build on FreeBSD < 11.3
Product: Ports & Packages Reporter: Konstantin Belousov <kib>
Component: Individual Port(s)Assignee: Carlos J. Puga Medina <cpm>
Status: Closed FIXED    
Severity: Affects Only Me CC: cpm, leres, ml
Priority: --- Flags: bugzilla: maintainer-feedback? (chromium)
Version: Latest   
Hardware: Any   
OS: Any   
Description Flags
patch none

Description Konstantin Belousov freebsd_committer 2019-06-14 16:42:44 UTC
Most likely due to missed #include <pthread_np.h>.

Comment 1 Carlos J. Puga Medina freebsd_committer 2019-06-14 17:22:04 UTC
Created attachment 205061 [details]

Hi Konstantine,

Please, apply the patch and try to build again.

Thanks for reporting!
Comment 2 Carlos J. Puga Medina freebsd_committer 2019-06-14 17:23:00 UTC
*** Bug 238564 has been marked as a duplicate of this bug. ***
Comment 3 Konstantin Belousov freebsd_committer 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
Comment 4 Carlos J. Puga Medina freebsd_committer 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>
+#if defined(OS_BSD)
+#include <pthread_np.h>
 #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 2019-06-14 21:36:03 UTC
Created attachment 205064 [details]

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 2019-06-14 21:53:02 UTC
Comment on attachment 205064 [details]

- 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 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

  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@