NetBSD Problem Report #45655
From www@NetBSD.org Sat Nov 26 14:30:31 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 3873A63D3E2
for <gnats-bugs@gnats.NetBSD.org>; Sat, 26 Nov 2011 14:30:31 +0000 (UTC)
Message-Id: <20111126143030.595E663CAFD@www.NetBSD.org>
Date: Sat, 26 Nov 2011 14:30:30 +0000 (UTC)
From: nathanialsloss@yahoo.com.au
Reply-To: nathanialsloss@yahoo.com.au
To: gnats-bugs@NetBSD.org
Subject: wine-devel from pkgsrc-current fails to build on NetBSD 5.0.1
X-Send-Pr-Version: www-1.0
>Number: 45655
>Category: pkg
>Synopsis: wine-devel from pkgsrc-current fails to build on NetBSD 5.0.1
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: adam
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Nov 26 14:35:00 +0000 2011
>Closed-Date: Tue Nov 01 19:31:56 +0000 2016
>Last-Modified: Tue Nov 01 19:31:56 +0000 2016
>Originator: Nat Sloss
>Release: NetBSD 5.0.1
>Organization:
>Environment:
NetBSD beast 5.0.1 NetBSD 5.0.1 (BEAST) #0: Tue Nov 22 21:39:49 EST 2011 build@beast:/home/build/NetBSD-5.0.1_source_tree/usr/src/sys/arch/i386/compile/BEAST i386
>Description:
Hi,
wine-devel (1.3.26) fails to compile on NetBSD 5.0.1.
The compilation fails with the following errors:
mesh.o: In function `load_skin_mesh_from_xof':
mesh.c:(.text+0x3b96): undefined reference to `fmaxf'
mesh.c:(.text+0x3ba4): undefined reference to `fminf'
mesh.c:(.text+0x3bb3): undefined reference to `fmaxf'
mesh.c:(.text+0x3bc1): undefined reference to `fminf'
mesh.c:(.text+0x3bd0): undefined reference to `fmaxf'
mesh.c:(.text+0x3bde): undefined reference to `fminf'
mesh.c:(.text+0x3bed): undefined reference to `fmaxf'
mesh.c:(.text+0x3bfb): undefined reference to `fminf'
winegcc: cc failed
gmake[1]: *** [d3dx9_36.dll.so] Error 2
gmake[1]: Leaving directory `/home/admin/pkgsrc-2011Q1/pkgsrc/local/wine-devel/work/wine-1.3.26/dlls/d3dx9_36'
gmake: *** [dlls/d3dx9_36] Error 2
This is because fmin and fmax functions do not exist prior to NetBSD 5.1.
>How-To-Repeat:
Build wine-devel from pkgsrc 2011Q2,Q3 or current on a NetBSD system prior to NETBSD 5.1.
>Fix:
I have solved the problem using MIN and MAX from <sys/param.h>.
Hopefully it is a close enough approximation. It seems to work well.
--- dlls/d3dx9_36/mesh.c.orig 2011-08-05 17:24:22.000000000 +0000
+++ dlls/d3dx9_36/mesh.c
@@ -41,6 +41,10 @@
#include "wine/list.h"
#include "d3dx9_36_private.h"
+#if defined(__NetBSD__)
+#include <sys/param.h>
+#endif
+
WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
typedef struct ID3DXMeshImpl
@@ -2548,10 +2552,17 @@ static HRESULT parse_vertex_colors(IDire
}
memcpy(&color, data, sizeof(color));
data += sizeof(color);
+#if (defined(__NetBSD__) && (__NetBSD_Version__ < 501000000))
+ color.r = MIN(1.0f, MAX(0.0f, color.r));
+ color.g = MIN(1.0f, MAX(0.0f, color.g));
+ color.b = MIN(1.0f, MAX(0.0f, color.b));
+ color.a = MIN(1.0f, MAX(0.0f, color.a));
+#else
color.r = fminf(1.0f, fmaxf(0.0f, color.r));
color.g = fminf(1.0f, fmaxf(0.0f, color.g));
color.b = fminf(1.0f, fmaxf(0.0f, color.b));
color.a = fminf(1.0f, fmaxf(0.0f, color.a));
+#endif
mesh->vertex_colors[index] = D3DCOLOR_ARGB((BYTE)(color.a * 255.0f + 0.5f),
(BYTE)(color.r * 255.0f + 0.5f),
(BYTE)(color.g * 255.0f + 0.5f),
I hope this fixes the problem for others, it has for me.
Regards,
Nat.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->adam
Responsible-Changed-By: obache@NetBSD.org
Responsible-Changed-When: Sun, 27 Nov 2011 01:37:15 +0000
Responsible-Changed-Why:
Over to maintainer.
State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Tue, 01 Nov 2016 19:31:56 +0000
State-Changed-Why:
fmax and fmin are now in all supported netbsd versions (since 5.1)
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.