Bug 244547

Summary: Installation of emulators/i386-wine fails to execute nvidia.sh script on latest nvidia-driver version
Product: Ports & Packages Reporter: Max <maxsteciuk>
Component: Individual Port(s)Assignee: Lorenzo Salvadore <salvadore>
Status: Closed FIXED    
Severity: Affects Only Me CC: daemonpup, gerald, hardy.schumacher, iwtcex, maxsteciuk, sascha.folie
Priority: --- Flags: salvadore: maintainer-feedback+
Version: Latest   
Hardware: amd64   
OS: Any   
Bug Depends on: 244369    
Bug Blocks:    
Attachments:
Description Flags
Patch to support pre-390 and post-390 nvidia driver download none

Description Max 2020-03-01 21:28:53 UTC
Created attachment 212084 [details]
Patch to support pre-390 and post-390 nvidia driver download

Hello all, 
It appears that on the latest nvidia-driver version such as *v440.53* *emultators/i386-wine* fails on the installation step of running *files/nvidia.sh* script. The reason seems to be that NVidia does not package 32-bit libraries separately but rather in the same FreeBSD-x86_64  package since *v396.13*

I tested the fix on my system which is GhostBSD based on *FreeBSD-12.1-STABLE* and the nvidia.sh script completed successfully.

Please find the proposed patch attached.
Comment 1 Max 2020-03-01 21:30:01 UTC
Sorry, I forgot to reference the NVidia answer  on their forum related to the same issue: https://devtalk.nvidia.com/default/topic/1065886/freebsd-solaris/request-include-32-bit-libraries-with-64-bit-drivers/
Comment 3 Max 2020-03-01 23:01:52 UTC
Thank you for referencing that!
It seems the issue is solved. Could you please let me know when I can expect to find the commit merged?

Thanks
Max
Comment 4 Max 2020-03-02 00:28:42 UTC
Okay, so it is the nvidia libraries that seemed to be sorted in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=243272 

Still probably something needs to be done about the *files/nvidia.sh* script otherwise pkg install failure message might sound misleading...

>>[1/1] Installing i386-wine-3.0.4_1,1...
>>[1/1] Extracting i386-wine-3.0.4_1,1: 100%
>> * WARNING: you are stopping a boot service
>>A NVIDIA GRAPHICS DRIVER HAS BEEN DETECTED ON THIS SYSTEM AND THE AUTOMATED
>>PATCHING HAS FAILED, execute (as root)
>>	sh /usr/local/share/wine/patch-nvidia.sh
>>to get 2D/3D acceleration to work with the nvidia driver.  Without this wine
>>will crash when a program requires 2D/3D graphics acceleration.
>>=====
>>Message from i386-wine-3.0.4_1,1:
>>

Thanks
Max
Comment 5 Max 2020-03-02 00:29:54 UTC
Okay, so it is the nvidia libraries that seemed to be sorted in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=243272 

Still probably something needs to be done about the *files/nvidia.sh* script otherwise pkg install failure message might sound misleading...

>>[1/1] Installing i386-wine-3.0.4_1,1...
>>[1/1] Extracting i386-wine-3.0.4_1,1: 100%
>> * WARNING: you are stopping a boot service
>>A NVIDIA GRAPHICS DRIVER HAS BEEN DETECTED ON THIS SYSTEM AND THE AUTOMATED
>>PATCHING HAS FAILED, execute (as root)
>>	sh /usr/local/share/wine/patch-nvidia.sh
>>to get 2D/3D acceleration to work with the nvidia driver.  Without this wine
>>will crash when a program requires 2D/3D graphics acceleration.
>>=====
>>Message from i386-wine-3.0.4_1,1:
>>

Thanks
Max
Comment 6 Lorenzo Salvadore freebsd_committer freebsd_triage 2020-03-02 10:25:56 UTC
*** Bug 243272 has been marked as a duplicate of this bug. ***
Comment 7 Lorenzo Salvadore freebsd_committer freebsd_triage 2020-03-02 10:31:18 UTC
(In reply to Max from comment #5)

I suspected that we would have needed to work a bit more about the nvidia script in i386-wine-devel; indeed that was the reason I was waiting a bit before closing bug #243272: you are right, we should avoid running that script for the latest nvdia driver, so that the misleading message does not appear.

I will fix the issue in the next few days.
Comment 8 commit-hook freebsd_committer freebsd_triage 2020-03-20 15:24:38 UTC
A commit references this bug:

Author: salvadore
Date: Fri Mar 20 15:23:42 UTC 2020
New revision: 528784
URL: https://svnweb.freebsd.org/changeset/ports/528784

Log:
  Update i386-wine-devel/files/nvidia.sh

  Do not try to install any 32-bit nvidia driver if nvidia-driver version is
  440.59 or higher: 440.59 is the first version included in the FreeBSD
  ports tree that packages 32-bit drivers together with 64-bit drivers.

  PR:		244547
  Reported by:	maxtesciuc@gmail.com
  Approved by:	gerald (mentor)

Changes:
  head/emulators/i386-wine-devel/files/nvidia.sh
Comment 9 Lorenzo Salvadore freebsd_committer freebsd_triage 2020-03-20 15:31:23 UTC
(In reply to commit-hook from comment #8)

The above commit fixes only part of the issue: the old nvidia.sh script is still packaged with the prebuilt packages for amd64 systems that the port fetches.
The issue will be completely fixed when the port will be updated (hopefully soon).
Comment 10 daemonpup 2020-04-05 13:06:18 UTC
/hi all!

I had the same problem, yet it still exists. Not sure if I'm doing something wrong, or missing something. I'm using 12.1 Release (64bit) with pkg set to latest (now), and tried with both i386-wine:3.0.4_1,1, and i386-wine-devel:4.0.r1_1,1 and with the versions provided by the quarterly pkgs.

1)at first I tried quaterly Wine (on quarterly system) with Nvidia driver downloaded from website (440.64)
-->>didn't work. I thought maybe some conflict with dependencies. (couldn't launch nvidia-settings either)
2)then tried with the Nvidia driver provided by quarterly pkg. (nvidia-settings now work)
-->>didn't work. I learnt that the 32bit libs are not provided with that version, yet. Maybe.
3)force upgraded the system to the pkg--latest. Again on Nvidia driver 440.64. Wine is pkg latest (i386-wine:3.0.4_1,1, and i386-wine-devel:4.0.r1_1,1).
-->>still don't work.

In each setup tried with both normal, and devel version. Nothing. As far as i can remember, at first, on quarterly, it did not even complain about not finding display, just waited, and didn't start. But what matters, is that now, on pkg-latest, latest Nvidia driver, Wine with the mentioned versions still don't work.

The 32bit Nvidia drivers are right there, but Wine can't find them, or I don't know. Had this similar issue on linux with Steam, but there I could install 32libs separately. Normally Wine should work with latest Nvidia driver out of the box, without needing to download anything, for the obvious reason the drivers are included. Yet fails to do that.

I was trying to make this work for more than 1 day now, and after trying from every possible angle I thought of, I am now desperate for a solution. Does anyone still have the problem, or am I missing something here? In the latter case please forgive me for my puppyness.


/wave all!
Comment 11 Lorenzo Salvadore freebsd_committer freebsd_triage 2020-04-05 13:32:10 UTC
(In reply to daemonpup from comment #10)

I am working rigth now to update i386-wine-devel to version 5.5 and I hope to have it working within a week, hopefully less. So you might have more chance with the new version. Moreover, this update should remove the misleading error message from the nvidia script.

Let's see if your issue is related to this bug or not. Could you please answer to the following questions?

- Do you get any error message for wine not starting? (Make sure to run it from a terminal, otherwise you will not see anything.) Can you report it?

- Do you have the FreeBSD base systems 32-bit libraries installed? You need them. Please check that you have a /usr/lib32 directory full of files and a /libexec/ld-elf32.so.1 file.

The configuration that should normally work best at the moment is installing i386-wine-devel and nvidia drivers 440.64 without the need to run the nvidia script (and if you run it you get an error message that you can safely ignore). I would recommed using the latest branch, but the last quarterly branch has been created just a few days ago so it should not make any difference.
Comment 12 daemonpup 2020-04-05 16:26:25 UTC
(In reply to Lorenzo Salvadore from comment #11)

Thank you for your answer and help, at first.

-- Yes, I do have 32libs, I installed them with system. I have the 32bit Nvidia libs too, as the driver installed them. And so have /libexec/ld-elf32.so.1.
-- As for my first attempts with quarterly system and Wine, with the downloaded Nvidia driver, and with the quarterly one, I cannot be sure what was the error message in console.
-- Right now with updated latest system, and Wine, and the Nvidia drivers, 440.64, it gives me the following:

---->> popup window saying:
"Failed to find a suitable display device. Exiting program"

---->> in terminal:
0009:fixme:win:EnumDisplayDevicesW ((null),0,0x32edd8,0x00000000), stub!
0009:fixme:win:EnumDisplayDevicesW ((null),0,0x32ed68,0x00000000), stub!
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
0009:err:wgl:X11DRV_WineGL_InitOpenglInfo  couldn't initialize OpenGL, expect problems
0009:fixme:win:EnumDisplayDevicesW ((null),0,0x32f250,0x00000000), stub!

I did not copy these error messages previously, because I assumed I have the same problem like others in this thread, and the ones (2) you already closed. As for the script bug, I just ignored it from start, knowing it was unnecesery anyways.

I do have another error, though probably unrelated, Wine is unable to find fontconfig. This error message appeared after upgrading system to latest, that is for sure.

"Fontconfig error: Cannot load config file from /usr/local/etc/fonts/fonts.conf"

And lists a hundred or so error and warning messages not finding fonts and configs. Probably unrelated, but who knows, better to make it clear, maybe gives you a hint on my problems.
Comment 13 Lorenzo Salvadore freebsd_committer freebsd_triage 2020-04-05 17:25:10 UTC
(In reply to daemonpup from comment #12)

I also have an error related to OpenGL, but it is unrelated to this bug.
In my case it is due to having used the patch in bug #244306 to update mesa to 19.0.8. Have you used it too?
If you did, I can probably help you but it will need some time.

If not, it is also possible that your issue is with the particular application you are trying to run. Can you try another application and see if you get other errors? If you get them please report them again. Could you also tell which applications are you testing?
If the problem is indeed application specific it might be fixed by the coming soon i386-wine-devel update.
You might also get more information about support for the applications you are testing here: https://appdb.winehq.org/
Comment 14 Alex S 2020-04-05 17:44:07 UTC
There is a possibility that i386-wine replaces /usr/local/lib32/libGL.so.1 with a symlink to Mesa's libGL.so if you happen to install it after nvidia-driver.
Comment 15 daemonpup 2020-04-05 18:48:59 UTC
(In reply to Lorenzo Salvadore from comment #13)

--- with regard of the win application, im trying to start wow.exe. That is World of Warcraft (2.4.3). This one should work, it has been since like 10years for now with Wine. (probably). It works on linux, Wine version: 5.2, worked before, on older versions. Therefore I doubt it has anything to do with it.

--- I did not check that thread before, I did not use that patch. I have Mesa 18.3 ones.

--- for your asking, I downloaded Godot (for windows), to check as "another" windows application, as a doublecheck. It gaves the same error messages, for the 32bit one:

Godot Engine v3.2.1.stable.official - https://godotengine.org
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
0009:err:wgl:X11DRV_WineGL_InitOpenglInfo  couldn't initialize OpenGL, expect problems
ERROR: is_viable: Error initializing GLAD
   At: drivers/gles2/rasterizer_gles2.cpp:166

To be sure, I downloaded both the 32bit, and 64bit versions of Godot (for windows), so I can check whether it works with the normal, 64bit Wine. And the 64bit one Godot works without any problem with 64bit Wine (wine-5.0,1).

Therefore my problem has definitely something to do with the 32bit opengl libraries.
The reason I checked with Godot, is that it is using opengl for sure, and has both 32 and 64 bit executables. (the wow.exe is 32bit one)
Comment 16 daemonpup 2020-04-05 19:06:26 UTC
(In reply to Alex S from comment #14)

Well my /usr/local/lib32/libGL.so is a symlink to libGL.so.1, which in turn is a symlink to .libGL/libGL.so.1. Is that the Mesa one?
Comment 17 commit-hook freebsd_committer freebsd_triage 2020-04-07 13:36:23 UTC
A commit references this bug:

Author: salvadore
Date: Tue Apr  7 13:36:12 UTC 2020
New revision: 530978
URL: https://svnweb.freebsd.org/changeset/ports/530978

Log:
  emulators/i386-wine-devel: Update to 5.5

  This update also fixes bug #244547.

  PR:		244547
  Approved by:	gerald (mentor)
  Differential Revision:	https://reviews.freebsd.org/D24320

Changes:
  head/emulators/i386-wine-devel/Makefile.amd64
  head/emulators/i386-wine-devel/distinfo
  head/emulators/i386-wine-devel/pkg-plist
Comment 18 Lorenzo Salvadore freebsd_committer freebsd_triage 2020-04-07 13:44:05 UTC
The nvidia issue should now be completely fixed for i386-wine-devel. For i386-wine it is still there, but the error message can be safely ignored. We are working on many things on the i386 wine ports and we are giving priority to the -devel port at the moment, so the error message for the non -devel port will stay for a while (as little time as possible, of course).

daemonpup: Your issue does not seem to me related to this PR. See if things improve with the update to 5.5. If you still have problems, please open a new PR in which you can reference this one.
Comment 19 daemonpup 2020-04-09 20:37:51 UTC
After updating to i386-wine-devel-5.5,1,
my problem, that is Wine not finding the 32bit opengl libraries was still not resolved. FreeBSD native OpenGL apps work fine, nvidia kernel module loaded, everything seems to be in order, yet no success.

As Alex S. mentioned in comment #14,
as for me Wine was already installed, my:
----/usr/local/lib32/libGL.so.1
was a symlink to -->
----/usr/local/lib32/.libGL/libGL.so.1.
(not sure whether it is the mesa one though, and it is probably irrelevant)

At first I had my chances with the upgraded Wine version, yet because it was no success, I tried with reinstalling the Nvidia driver.

As it turned out, after fresh nvidia-driver install the
----/usr/local/lib32/libGL.so.1
is a regular file, that is the actual library.
Which means it was overwritten by Wine when it was installed (after the nvidia-driver).

Well it was not so obvious at first, since Wine was already installed for me, therefore it was already a symlink in my case. For me, there is no logical answer for Wine overwriting an opengl library to a symlink to another one. I don't know why would it want to do it.

Anyway,

After FRESH Nvidia driver install
----/usr/local/lib32/libGL.so.1
IS a regular file, NOT a symlink, in my case at
-- nvidia-driver version: 440.64 --> 532.0 KiB (544768 bytes).


This all means, to anyone reading this, that Wine should be either installed BEFORE the nvidia-driver, or the nvidia-driver MUST BE re-installed after Wine.

Whether it was already a problem before nvidia changing their drivers to include the 32bit ones, or it has anything to do with Wine-s not capable of downloading the 32bit libs, it is all beyond my understanding.

Yet, everyone keep in mind, that:
/usr/local/lib32/libGL.so.1  ---->> MUST be the actual library. Or else Wine will not be able to start an opengl windows executable.


And now everything works fine. The sun shines, the moon, well not, yet at least lights in my room while I am able to play.
And FreeBSD gave me another 15-20 FPS. And the mouse-pointer's graphics are now viewable, not on linux.

Well. All good. Thank you for all your help finding out, and trying to solve this issue. After all of this at least, this will help others, so it will be not a problem anymore for anyone.

****************************************************************
If it is a possibility, there should be a notice about this when installing Wine. Maybe in next patch?
****************************************************************
Comment 20 Lorenzo Salvadore freebsd_committer freebsd_triage 2020-04-09 21:27:11 UTC
(In reply to daemonpup from comment #19)

The lib32/libGL.so.1 conflict is definitely an issue that must be resolved. I will open a new PR to deal with this.

Thanks daemonpup for reporting and Alex for suggesting the solution.
Comment 21 commit-hook freebsd_committer freebsd_triage 2020-05-03 20:38:25 UTC
A commit references this bug:

Author: salvadore
Date: Sun May  3 20:37:27 UTC 2020
New revision: 533808
URL: https://svnweb.freebsd.org/changeset/ports/533808

Log:
  emulators/i386-wine: Update to 5.0

  Update to 5.0 and forward emulators/wine-devel improvements from revisions
  r528784, r533164 and r533267. In particular, fix bug #244547.

  PR:		244547, 244368
  Approved by:	gerald (mentor)
  Differential Revision:	https://reviews.freebsd.org/D24631

Changes:
  head/emulators/i386-wine/Makefile
  head/emulators/i386-wine/Makefile.amd64
  head/emulators/i386-wine/Makefile.i386
  head/emulators/i386-wine/distinfo
  head/emulators/i386-wine/files/mergeplist.py
  head/emulators/i386-wine/files/nvidia.sh
  head/emulators/i386-wine/pkg-plist
Comment 22 Lorenzo Salvadore freebsd_committer freebsd_triage 2020-05-03 21:04:39 UTC
This bug should be fixed for i386-wine as well.