Bug 257398 - emulators/wine-devel: Fail link if devel/libsysinfo installed: unix/virtual.o: in function `virtual_get_system_info': virtual.c:(.text+0x5bff): undefined reference to `sysinfo'
Summary: emulators/wine-devel: Fail link if devel/libsysinfo installed: unix/virtual.o...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Gerald Pfeifer
URL:
Keywords:
: 258446 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-07-24 22:35 UTC by VVD
Modified: 2021-09-16 06:17 UTC (History)
6 users (show)

See Also:
iwtcex: maintainer-feedback+
koobs: merge-quarterly?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description VVD 2021-07-24 22:35:22 UTC
12.2 amd64.

Both emulators/wine-devel and emulators/wine-proton fails to build if devel/libsysinfo installed with same error:
======================================
emulators/wine-devel:
--------------------------------------
  dlls/bluetoothapis/bluetoothapis.spec -Wb,--prefer-native -mno-cygwin dlls/ucrtbase/libucrtbase.a \
  -fstack-protector-strong -Wl,-rpath=/usr/local/lib/gcc10 -L/usr/local/lib/gcc10
/usr/local/bin/ld: dlls/ntdll/unix/virtual.o: in function `virtual_get_system_info':
virtual.c:(.text+0x5bff): undefined reference to `sysinfo'
collect2: error: ld returned 1 exit status
winegcc: /usr/local/bin/gcc10 failed
gmake[2]: *** [Makefile:98093: dlls/ntdll/ntdll.so] Error 2
======================================
emulators/wine-proton
--------------------------------------
  dlls/ntdll/unix/version.o dlls/winecrt0/libwinecrt0.a libs/port/libwine_port.a -lpthread \
  -lprocstat -L/usr/local/lib -fstack-protector-strong -Wl,-rpath=/usr/local/lib/gcc10 -L/usr/local/lib/gcc10 
/usr/local/bin/ld: dlls/ntdll/unix/virtual.o: in function `virtual_get_system_info':
virtual.c:(.text+0x4f17): undefined reference to `sysinfo'
collect2: error: ld returned 1 exit status
winegcc: /usr/local/bin/gcc10 failed
gmake[1]: *** [Makefile:96193: dlls/ntdll/ntdll.so] Error 2
======================================

Last versions compiled without errors was: wine-devel-6.10,1 and wine-proton-6.3.2.
Comment 1 Gerald Pfeifer freebsd_committer 2021-07-27 07:57:35 UTC
(In reply to VVD from comment #0)
> Last versions compiled without errors was: wine-devel-6.10,1
> and wine-proton-6.3.2.

Hmm, isn't wine-proton-6.3.2 the current version? Are you saying that
one used to work, and now it does not?

Is it possible you installed devel/libsysinfo in between?

(Maybe we just should add a conflict? To make this work we'd probably
need to explicitly link that library.)
Comment 2 VVD 2021-07-27 08:57:57 UTC
(In reply to Gerald Pfeifer from comment #1)
Just checked: it was installed as depends for audio/libopenshot-audio month ago.
Probably wine never build fine with devel/libsysinfo installed.

BTW:
$ winecfg 
wine: could not load ntdll.so: Cannot open "/usr/local/bin/../lib/wine/x86_64-unix/ntdll.so"
$ ls /usr/local/bin/../lib/wine/
amd64-unix      amd64-windows
Comment 3 Sascha Folie 2021-08-05 14:12:57 UTC
Had the same happen but in my case it was because I enabled JACK in devel/sdl20. devel/libsysinfo was then pulled in by audio/jack.
Comment 4 Alex S 2021-08-05 23:33:41 UTC
(In reply to VVD from comment #0)

> emulators/wine-devel and emulators/wine-proton fails to build if devel/libsysinfo installed

Afaik, that was always the case. The easiest way to disable this code would be something like:

post-configure:
	${ECHO_CMD} "#undef HAVE_SYS_SYSINFO_H"           >> ${WRKSRC}/include/config.h
	${ECHO_CMD} "#undef HAVE_STRUCT_SYSINFO_MEM_UNIT" >> ${WRKSRC}/include/config.h
	${ECHO_CMD} "#undef HAVE_STRUCT_SYSINFO_TOTALRAM" >> ${WRKSRC}/include/config.h
	
and, conversely, if we want to compile it, we'll need to pass -lsysinfo somewhere.

(In reply to Gerald Pfeifer from comment #1)

> Maybe we just should add a conflict?

Conflict doesn't seem appropriate.

> To make this work we'd probably need to explicitly link that library.

Yep, although it's a tiny library: https://github.com/bsdimp/libsysinfo/blob/master/sysinfo.c.
Comment 5 Gerald Pfeifer freebsd_committer 2021-08-10 12:51:13 UTC
That may work, but it's a (bit of a crude) hack.

Let's keep more of an eye on maintainability and upstream collaboration.
I'll see whether I can come up with something.
Comment 6 Warner Losh freebsd_committer 2021-08-10 22:00:52 UTC
I'm happy to update libsysinfo in any useful way too... It's better that it's more complete to allow things to drop into FreeBSD than less complete and require lots of crazy ifdefs.
Comment 7 Gerald Pfeifer freebsd_committer 2021-08-11 14:19:12 UTC
Here is my upstream submission for Wine, which passed my local testing:

  https://www.winehq.org/pipermail/wine-devel/2021-August/192401.html


Thank you very much for the offer, Warner!  I did not consider this a
libsysinfo issue, which is why I did not reach out to you.

In my mind, Wine should be better at detecting whether sysinfo() is 
really present and usable, which is what my patch should accomplish.

(And enhanced version of my patch might try using -lsysinfo and see
whether that makes a difference.)


One fundamental change we/you could make is pushing sysinfo into src,
i.e., make it an integral part of FreeBSD and its libc.  That should
also address the issue we ran into here and that Jan reported?
Comment 8 commit-hook freebsd_committer 2021-08-12 07:58:07 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7d6c458605b7075a8bc6d4c0d80605f49f17dd21

commit 7d6c458605b7075a8bc6d4c0d80605f49f17dd21
Author:     Gerald Pfeifer <gerald@FreeBSD.org>
AuthorDate: 2021-08-12 07:53:10 +0000
Commit:     Gerald Pfeifer <gerald@FreeBSD.org>
CommitDate: 2021-08-12 07:57:34 +0000

    emulators/wine-devel: Fix build when devel/libsysinfo is present

    When devel/libsysinfo is present, <sys/sysinfo.h> exists which
    misleads Wine into enabling some code that invokes the sysinfo
    function. That one isn't actually available, though, without
    additional linking parameters (and we don't want to add another
    dependency at this point anyway), so properly test for sysinfo()
    before using it.

    This is a patch of mine that was accepted upstream and should
    come in via Wine 6.15.

    PR:             257398

 .../files/patch-dlls-ntdll-unix-virtual.c (new)    | 68 ++++++++++++++++++++++
 1 file changed, 68 insertions(+)
Comment 9 Gerald Pfeifer freebsd_committer 2021-08-12 09:31:05 UTC
Upstream is good now (my patch having been accepted there) and so is
emulators/wine-devel per the previous commit.

Which leaves emulators/wine-proton, so handing over to Alex...
Comment 10 Alex S 2021-08-12 19:12:33 UTC
(In reply to Gerald Pfeifer from comment #9)

> Which leaves emulators/wine-proton, so handing over to Alex...

What do you expect me do? If that patch applies to emulators/wine-proton it should work there as well. (Well, it seems to.) Or we can simply ignore the issue until the next Proton update, it's ultimately a very niche problem — I don't expect people to run into it often.
Comment 11 Alex S 2021-08-22 21:24:13 UTC
Seriously, I want absolutely nothing to do with it. Especially since I'm not a committer and can't push any patches myself. Not to mention that being spammed by the Bugzilla's automation is not very nice.
Comment 12 Gerald Pfeifer freebsd_committer 2021-09-05 10:02:22 UTC
Yes, this makes sense to be pushed back to quarterly for wine-devel,
just I won't be able to do it myself (capacity-wise).

Based on iwtcex' response, no action for wine-proton, which should get
fixed with a future updates unless someone bothers to patch it locally.

wine-devel has been fixed (first locally, then upstream), so closing
this.
Comment 13 Kubilay Kocak freebsd_committer freebsd_triage 2021-09-06 00:53:40 UTC
^Triage: Leave merge quarterly flag un-acked until merged (if/when merged)
Comment 14 Fernando Apesteguía freebsd_committer 2021-09-16 06:17:30 UTC
*** Bug 258446 has been marked as a duplicate of this bug. ***