Bug 255336 - emulators/wine-devel: Fails to run: mmap() error Cannot allocate memory, range
Summary: emulators/wine-devel: Fails to run: mmap() error Cannot allocate memory, range
Status: Closed Not Enough Information
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-emulation (Nobody)
URL:
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2021-04-22 20:19 UTC by Dwayne MacKinnon
Modified: 2021-09-20 07:06 UTC (History)
7 users (show)

See Also:


Attachments
Proposed patch (6.09 KB, patch)
2021-08-01 09:55 UTC, Gerald Pfeifer
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dwayne MacKinnon 2021-04-22 20:19:57 UTC
When I try to do anything with wine-devel, such as winecfg on a new prefix, all I get is this:

err:virtual:try_map_free_area mmap() error Cannot allocate memory, range 0x7fffffdf0000-0x7fffffff0000, unix_prot 0.
err:virtual:try_map_free_area mmap() error Cannot allocate memory, range 0x7fffffdf0000-0x7fffffff0000, unix_prot 0.
002c:fixme:winediag:LdrInitializeThunk wine-staging  is a testing version containing experimental patches.
002c:fixme:winediag:LdrInitializeThunk Please mention your exact version when filing bug reports on winehq.org.
002c:fixme:ntdll:get_firmware_info info_class SYSTEM_FIRMWARE_TABLE_INFORMATION
002c:fixme:ntdll:get_firmware_info info_class SYSTEM_FIRMWARE_TABLE_INFORMATION
002c:err:wineboot:process_run_key Error running cmd L"C:\\windows\\system32\\winemenubuilder.exe -a -r" (1001).
002c:err:wineboot:start_services_process Couldn't start services.exe: error 1001
wine: configuration in L"/home/dwayne/.local/share/wineprefixes/magic" has been updated.
0024:err:module:open_builtin_file failed to load .so lib "/usr/local/lib/wine/kernelbase.dll.so"
0024:err:module:import_dll Loading library kernelbase.dll (which is needed by L"C:\\windows\\system32\\kernel32.dll") failed (error c000007a).
wine: could not load kernel32.dll, status c0000135

The kernel32.dll, kernel32.dll.so, kernelbase.dll and kernelbase.dll.so files all exist.

I've seen this with both the staging patches and without.
Comment 1 Alex S 2021-04-22 21:22:05 UTC
Oh, this error...

Let me quote myself (from the FreeBSD Discord "server"):

> That only happens on FreeBSD 13.
> I'm looking into updating wine-proton to 6.3 and apparently it has this patch from staging applied: https://github.com/wine-staging/wine-staging/blob/534f6ae34e89615fa424ee3e3002b1b3d419a8ba/patches/ntdll-ForceBottomUpAlloc/0003-ntdll-Force-virtual-memory-allocation-order.patch.
> In combination with /usr/local/lib/gcc10/libgcc_s.so.1 this leads to the issue above.
> One workaround is to use /lib/libgcc_s.so.1 instead (for pure C apps they are fully compatible).
> No idea what's the root cause, of course.

Whatever you see without the staging patches is a different issue. (Likely https://bugs.winehq.org/show_bug.cgi?id=50257.)
Comment 2 Gerald Pfeifer freebsd_committer freebsd_triage 2021-08-01 09:55:15 UTC
Created attachment 226831 [details]
Proposed patch

Does the attached patch (which forward ports recent improvements to the
emulators/wine port) improve (or at least change) the situation?
Comment 3 commit-hook freebsd_committer freebsd_triage 2021-08-02 21:43:34 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=27ae28dd240c63c37a2fe17d2a2440d1beda5870

commit 27ae28dd240c63c37a2fe17d2a2440d1beda5870
Author:     Gerald Pfeifer <gerald@FreeBSD.org>
AuthorDate: 2021-08-02 21:40:18 +0000
Commit:     Gerald Pfeifer <gerald@FreeBSD.org>
CommitDate: 2021-08-02 21:40:19 +0000

    emulators/wine-devel: Invoke with LD_BIND_NOW and revampe WoW

    Forward port 1d2af6e08958ac78de9fae727283ac8cdaf8705f and its
    two follow-up fixes ad15b0e748b6bd93ef1e36b1c605c1da29d10565 and
    1b5885c463320a2af0e7fe2ed0fdca93d760ad19 from emulators/wine:

       Wine 6.0 and later need LD_BIND_NOW / LD_32_BIND_NOW on FreeBSD,
       cf. https://bugs.winehq.org/show_bug.cgi?id=50257 and
       https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252307
       so move the actual binaries to wine64.bin / wine.bin and invoke
       them via a script that does those settings. [1]

       Also revamp the WoW handling/packging which combines 32-bit/i386
       Wine into 64-bit/amd64 Wine. [1]

    Submitted by:   Alex S <iwtcex@gmail.com> [1]
    PR:             257284 [1], 252307 [1], 255336, 257020

 emulators/wine-devel/Makefile                  | 12 ++++++++
 emulators/wine-devel/files/pkg32.sh (new)      | 15 +++++++++
 emulators/wine-devel/files/wine-wow64.sh (new) | 42 ++++++++++++++++++++++++++
 emulators/wine-devel/files/wine.sh (new)       | 14 +++++++++
 emulators/wine-devel/pkg-plist                 |  8 +++--
 5 files changed, 89 insertions(+), 2 deletions(-)
Comment 4 Gerald Pfeifer freebsd_committer freebsd_triage 2021-08-02 21:49:18 UTC
This hopefully addresses the non-STAGING case.

For the STAGING case (which is not the default) it looks like this will
require deeper investigations by someone else.
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2021-08-11 00:55:23 UTC
^Triage: Request feedback from reporter on comment 2
Comment 6 Gerald Pfeifer freebsd_committer freebsd_triage 2021-09-20 07:06:26 UTC
No feedback received for six weeks.

wine-devel itself should be working okay again now, so if you are still
seeing this in the default configuration, please advise.

(If this only occurs with the Staging patchset, that is unstable development
on top of the development tree, so two levels of moving objections, and any
issue are best addressed upstream.)