Bug 239159

Summary: emulators/wine-devel: build fails with STAGING option
Product: Ports & Packages Reporter: John Hein <jcfyecrayz>
Component: Individual Port(s)Assignee: Gerald Pfeifer <gerald>
Status: Closed FIXED    
Severity: Affects Some People Flags: gerald: maintainer-feedback+
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Description Flags
[patch] workaround for snwprintf undefined reference if STAGING=on none

Description John Hein 2019-07-12 12:30:25 UTC
Created attachment 205714 [details]
[patch] workaround for snwprintf undefined reference if STAGING=on

'make -C /usr/ports/emulators/wine-devel WITH=STAGING' fails after the update to 4.12:

gcc8 -m64 -c -o classes.o classes.c -I. -I../../include -I../.. -D__WINESRC__ -D_SHELL32_ -D_REENTRANT -fPIC \
  -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers \
  -Wno-packed-not-aligned -Wshift-overflow=2 -Wstrict-prototypes -Wtype-limits \
  -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith -Wlogical-op -isystem \
  /usr/local/include -O2 -pipe  -fstack-protector-strong -Wl,-rpath=/usr/local/lib/gcc8 -isystem /usr/local/include -fno-strict-aliasing
/usr/local/bin/ld: dialog.o: in function `SetupPromptForDiskW':
dialog.c:(.text+0x10c0): undefined reference to `snwprintf'
collect2: error: ld returned 1 exit status
winegcc: gcc8 failed
gmake[3]: *** [Makefile:506: setupapi.dll.so] Error 2
gmake[3]: Leaving directory '/d/local/users/jhein/.nobak/wd/usr/ports/emulators/wine-devel/work/wine-4.12/dlls/setupapi'

If you replace snwprintf with _snwprintf in the patched dialog.c (from the staging patchset), the build succeeds:

--- dlls/setupapi/dialog.c.orig 2019-07-12 09:18:10.588254000 +0000
+++ dlls/setupapi/dialog.c      2019-07-12 11:32:31.303208000 +0000
@@ -249,7 +249,7 @@ UINT WINAPI SetupPromptForDiskW(HWND hwn

         if (lstrlenW(PathToSource) + 1 + lstrlenW(FileSought) < sizeof(filepath))
-            snwprintf(filepath, MAX_PATH, format, PathToSource, FileSought);
+            _snwprintf(filepath, MAX_PATH, format, PathToSource, FileSought);

             if (GetFileAttributesW(filepath) != INVALID_FILE_ATTRIBUTES)
Comment 1 Gerald Pfeifer freebsd_committer 2019-07-12 17:37:47 UTC
Yes, and apologies.  I noticed this and realized that updating to 
Wine 4.12.1 (the very, maybe even first, case of a minor revision
after a snapshot) addresses it, but then got stuck committing that

I'll do some final tests and hope to commit that fix (= .1 release)

Thank you for reporting this and even developing a fix!
Comment 2 commit-hook freebsd_committer 2019-07-13 04:40:57 UTC
A commit references this bug:

Author: gerald
Date: Sat Jul 13 04:40:44 UTC 2019
New revision: 506504
URL: https://svnweb.freebsd.org/changeset/ports/506504

  Update to Wine 4.12.1 which is a quick bug fix release on top of the
  regular 4.12 release that includes fixes for broken 64-bit prefix

  It also addresses a build failure for Wine Staging (the STAGING
  option set in this port). [1]

  PR:		239159 [1]
  Reported by:	John Hein <jcfyecrayz@liamekaens.com> [1]