NetBSD Problem Report #51011

From www@NetBSD.org  Sat Mar 26 10:49:34 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 390437ABC6
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 26 Mar 2016 10:49:34 +0000 (UTC)
Message-Id: <20160326104752.E876E7AC9C@mollari.NetBSD.org>
Date: Sat, 26 Mar 2016 10:47:52 +0000 (UTC)
From: frank@phoenix.owl.de
Reply-To: frank@phoenix.owl.de
To: gnats-bugs@NetBSD.org
Subject: qt5-qtwebkit build error on NetBSD/i386 due to different ucontext_t
X-Send-Pr-Version: www-1.0

>Number:         51011
>Category:       pkg
>Synopsis:       qt5-qtwebkit build error on NetBSD/i386 due to different ucontext_t
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 26 10:50:00 +0000 2016
>Closed-Date:    Sun Aug 18 05:35:54 +0000 2019
>Last-Modified:  Sun Aug 18 05:35:54 +0000 2019
>Originator:     Frank Wille
>Release:        pkgsrc 2015Q3 and pkgsrc 2015Q4
>Organization:
>Environment:
NetBSD orion.owl.de 7.0 NetBSD 7.0 (GENERIC.201509250726Z) i386
>Description:
While building the JavaScriptCore in qt5-qtwebkit:

tools/CodeProfiling.cpp: In function 'void JSC::profilingTimer(int, siginfo_t*, void*)':
tools/CodeProfiling.cpp:80:59: error: 'struct mcontext_t' has no member named 'gregs'
     CodeProfiling::sample(reinterpret_cast<void*>(context.gregs[REG_EIP]),
                                                           ^
tools/CodeProfiling.cpp:80:65: error: 'REG_EIP' was not declared in this scope
     CodeProfiling::sample(reinterpret_cast<void*>(context.gregs[REG_EIP]),
                                                                 ^
tools/CodeProfiling.cpp:81:60: error: 'struct mcontext_t' has no member named 'gregs'
                           reinterpret_cast<void**>(context.gregs[REG_EBP]));
                                                            ^
tools/CodeProfiling.cpp:81:66: error: 'REG_EBP' was not declared in this scope
                           reinterpret_cast<void**>(context.gregs[REG_EBP]));
                                                                  ^
Makefile.JavaScriptCore.Target:77124: recipe for target '.obj/tools/CodeProfiling.lo' failed
gmake[2]: *** [.obj/tools/CodeProfiling.lo] Error 1
gmake[2]: Leaving directory '/usr/pkgsrc/x11/qt5-qtwebkit/work/qtwebkit-opensource-src-5.4.0/Source/JavaScriptCore'

>How-To-Repeat:
Build x11/qt5-qtwebkit on NetBSD/i386. I reproduced the problem with pkgsrc 2015Q3 and the latest 2015Q4.

>Fix:
Update patches/patch-Source_JavaScriptCore_tools_CodeProfiling.cpp to use the correct ucontext_t structure member names for NetBSD:

--- CodeProfiling.cpp.orig	2014-12-05 17:24:55.000000000 +0100
+++ CodeProfiling.cpp	2016-03-26 11:28:15.000000000 +0100
@@ -33,7 +33,7 @@
 #include <signal.h>
 #endif

-#if OS(LINUX)
+#if OS(LINUX) || OS(NETBSD)
 #include <sys/time.h>
 #endif

@@ -48,7 +48,7 @@
 #pragma clang diagnostic ignored "-Wmissing-noreturn"
 #endif

-#if (PLATFORM(MAC) && CPU(X86_64)) || (OS(LINUX) && CPU(X86) && !OS(ANDROID))
+#if (PLATFORM(MAC) && CPU(X86_64)) || ((OS(LINUX) || OS(NETBSD)) && CPU(X86) && !OS(ANDROID))
 // Helper function to start & stop the timer.
 // Presently we're using the wall-clock timer, since this seems to give the best results.
 static void setProfileTimer(unsigned usec)
@@ -80,6 +80,13 @@
     CodeProfiling::sample(reinterpret_cast<void*>(context.gregs[REG_EIP]),
                           reinterpret_cast<void**>(context.gregs[REG_EBP]));
 }
+#elif OS(NETBSD) && CPU(X86)
+static void profilingTimer(int, siginfo_t*, void* uap)
+{
+    mcontext_t context = static_cast<ucontext_t*>(uap)->uc_mcontext;
+    CodeProfiling::sample(reinterpret_cast<void*>(context.__gregs[_REG_EIP]),
+                          reinterpret_cast<void**>(context.__gregs[_REG_EBP]));
+}
 #endif

 // Callback triggered when the timer is fired.
@@ -143,7 +150,7 @@
     if (alreadyProfiling)
         return;

-#if (PLATFORM(MAC) && CPU(X86_64)) || (OS(LINUX) && CPU(X86) && !OS(ANDROID))
+#if (PLATFORM(MAC) && CPU(X86_64)) || ((OS(LINUX) || OS(NETBSD)) && CPU(X86) && !OS(ANDROID))
     // Regsiter a signal handler & itimer.
     struct sigaction action;
     action.sa_sigaction = reinterpret_cast<void (*)(int, siginfo_t *, void *)>(profilingTimer);

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sun, 18 Aug 2019 05:35:54 +0000
State-Changed-Why:
Similar patch was committed. Thanks for the report, and sorry you didn't receive a response at the time.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.