Problems running Wine after building from Source on 10.14.6 Mojave

Questions about Wine on macOS.
Post Reply
mackie14
Newbie
Newbie
Posts: 4
Joined: Fri May 01, 2020 7:36 am

Problems running Wine after building from Source on 10.14.6 Mojave

Post by mackie14 » Fri May 01, 2020 8:04 am

Hi guys,

I'm trying to build Wine from source on Mac OS 10.14.6 Mojave so that I can test this patch for winevdm https://github.com/otya128/winevdm/pull/547/files to fix https://github.com/otya128/winevdm/issues/545 which I also submitted as https://bugs.winehq.org/show_bug.cgi?id=48673 and submit it as a patch myself.

I've built Wine successfully, but whenever I run it from the build directory I get an error and it doesn't start:

Code: Select all

./wine winecfg
0024:err:environ:run_wineboot failed to start wineboot c00000e5
0024:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0)
0024:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0024:err:winediag:nodrv_CreateWindow The explorer process failed to start.
Another example:

Code: Select all

./wine ~/Downloads/X5D-Editor/SETUP.EXE 
0024:err:environ:run_wineboot failed to start wineboot c00000e5
0024:err:module:__wine_process_init L"Z:\\[removed_for_privacy]\\Downloads\\X5D-Editor\\SETUP.EXE" not supported on this system
I followed https://wiki.winehq.org/MacOS/Building and https://wiki.winehq.org/Building_Wine:

These were my steps:
XCode command line tools were installed already.

Code: Select all

git clone git://source.winehq.org/git/wine.git ~/wine-dirs/wine-source

Code: Select all

brew cask install xquartz
brew install bison flex mingw-w64 pkgconfig
Then I executed

Code: Select all

echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile
to have bison first in my PATH.

I then ran

Code: Select all

./configure --enable-win64 CC="clang" CXX="clang++" CFLAGS="-std=gnu89 -g" LFFLAGS="-Wl,-rpath,/opt/X11/lib"
make -j5
First I got an error about Freetype so I installed it via

Code: Select all

brew install freetype
and now I get the error posted above. Some searching reveals that it's apparently related to X11 but I also restarted and thought that xquartz should fix this?

Previously I was able to run wine via brew and package (which I removed again) but to apply and test the winevdm patch I'd like to run it from source.

Any help is appreciated!

Gcenx
Level 5
Level 5
Posts: 499
Joined: Mon Dec 25, 2017 12:11 pm

Re: Problems running Wine after building from Source on 10.14.6 Mojave

Post by Gcenx » Fri May 01, 2020 6:50 pm

First thing I’d recommend not pulling git from head instead checkout a the most recent release being wine-5.7 as usually there is breakage between releases especially for macOS.

If your only interested in compile wine64 you can use the following commands

Code: Select all

export PKG_CONFIG_PATH="/opt/X11/lib/pkgconfig”
export C_INCLUDE_PATH="/opt/X11/include/
export LIBRARY_PATH=“/opt/X11/lib”
export LFFLAGS=“ -Wl,-rpath,/opt/X11/lib
./configure --enable-wine64
The above is a little overkill but it will pickup everything provided by XQuartz including libfreetype/libpng etc.

The wineboot error, I’ve not received that error since installing mingw but that could have been caused from a missing libraries or some upstream breakage...

The installer you attempted to run was lightly 32Bit remember wine64 will fail to run 32Bit code.


As your on Mojave it’s still possible to compile wine & wine64 you just need to provide a 10.13SDK and use that over the Xcode Command Line Tools version.

If you wanted to build a more full featured wow64 compile of wine (wine & wine64) then unfortunately homebrew isn’t viable as they don’t provide universal libraries anymore, but the good news is it’s possible to patch macports to still build universal libraries in most cases you can check macports-wine, it contains custom versions of wine-stable/win-devel/wine-staging/wine-crossover and some pathed Portfiles as needed.

mackie14
Newbie
Newbie
Posts: 4
Joined: Fri May 01, 2020 7:36 am

Re: Problems running Wine after building from Source on 10.14.6 Mojave

Post by mackie14 » Sat May 02, 2020 8:12 am

Thanks!

I tried it with your options but got an error message executing configure.

So I installed xcode command line tools 9.4.1 from the Apple developer portal. Now configure finds the 32 bit development libraries and I could built it.

However I now get the following error:

Code: Select all

./wine winecfg
dyld: __dyld section not supported in /[...]/wine-dirs/wine-build/loader/wine-preloader
Abort trap: 6
Some research shows that this is a known error on Mojave caused by a profiling option "-pg". However I could not find any hint for this option in the makefile.

Any hint how to turn it off?

Thanks in advance!

Gcenx
Level 5
Level 5
Posts: 499
Joined: Mon Dec 25, 2017 12:11 pm

Re: Problems running Wine after building from Source on 10.14.6 Mojave

Post by Gcenx » Sat May 02, 2020 7:12 pm

I just compiled Wine-5.7 using XQuartz dependencies over macports and the compile launched winecfg without issue on my end, it sounds like your attempting to compile git from HEAD I'd avoid that as I keep seeing breakage recently for macOS.

mackie14
Newbie
Newbie
Posts: 4
Joined: Fri May 01, 2020 7:36 am

Re: Problems running Wine after building from Source on 10.14.6 Mojave

Post by mackie14 » Sun May 03, 2020 7:00 am

Thanks.

I checked out the tags/wine-5.7 tag and did a clean build. However I still get the same error:

Code: Select all

dyld: __dyld section not supported in /[...]/wine-dirs/wine-build/loader/wine64-preloader
Abort trap: 6
Sorry to ask for this, but could you please describe your steps to get a working build on MacOS in more detail?

Thank you!

Gcenx
Level 5
Level 5
Posts: 499
Joined: Mon Dec 25, 2017 12:11 pm

Re: Problems running Wine after building from Source on 10.14.6 Mojave

Post by Gcenx » Sun May 03, 2020 6:17 pm

My setup isn't exactly standard but here goes

- macOS 10.14.6 18G4032
- Xcode 11.3.1 11C505
- MacOSX10.13.sdk (usually my patched MacOSX10.14.sdk)
- All required utilities to compile wine installed via macports.

To make the test closer to your own I used XQuartz-2.7.7 for the headers and libraries.
Set the exports I had listed above pointing to /opt/X11/

My first step is making all required directories, followed by the commands;
- BUILDTOOLS (configure --enable-win64 && make __tooldeps__)
- BUILD64FOLDER (configure --with-wine-tools="$BUILDTOOLS" --enable-win64 && make)
- BUILD32FOLDER (configure --with-wine-tools="$BUILDTOOLS" && make)
- PREFIXFOLDER (BUILD32FOLDER make install DESTDIR="$PREFIXFOLDER" && BUILD64FOLDER make install DESTDIR="$PREFIXFOLDER")
- PREFIX32FOLDER (BUILD32FOLDER make install DESTDIR="$PREFIXFOLDER")

I like using winetools in this manner as the resulting build doesn't include unnecessary utilities, skipping that step still results in a working compile on my end, even skipping "make install" it works.

mackie14
Newbie
Newbie
Posts: 4
Joined: Fri May 01, 2020 7:36 am

Re: Problems running Wine after building from Source on 10.14.6 Mojave

Post by mackie14 » Wed May 06, 2020 1:39 pm

I've gotten one step closer today!

According to https://stackoverflow.com/questions/525 ... ve-upgrade:
Using -pg Apple LLVM version 10.0.0 (clang-1000.11.45.2) still seems to add a __DATA,__dyld section to your executable, which dyld in Mojave does not seem to support/accept any more.
I couldn't find any "-pg" flag anywhere but I switched again to the Command Line Tools for macOS 10.14 for XCode 10.3 and was able to build the 64 bit wine and it started up!

I then switched again to the Command Line Tools for macOS 10.13 for XCode 9.4.1 to build the 32bit version of Wine. First the 32 bit freetype libraries couldn't be found but I was able to remove and then install freetype via homebrew with the --interactive flag and these instructions:
https://github.com/Homebrew/legacy-home ... ue-6321979

Code: Select all

brew install --interactive freetype
> $ LDFLAGS="-arch i386 -arch x86_64"
> $ CFLAGS="-arch i386 -arch x86_64"
> $ ./configure --prefix=/usr/local/Cellar/freetype/2.10.1
> $ make install
I could then run configure and make successfully, however upon executing Wine 32 bit I still get the following error:

Code: Select all

$ ./wine winecfg
dyld: __dyld section not supported in /Users/tu/wine-dirs/wine-build32/loader/wine-preloader
Abort trap: 6
So my assumption:
Using the command line tools 9.4.1 with 32 bit support adds the __dyld section to the executable which is not supported on Mojave anymore...

I have no idea how to exclude this from the build as I couldn't find any profiling option.

I might try your approach with macports as it seems to be setup better to handle 32 and 64 bit builds.

The .exe I want to execute is 16 bit however but it seems it's not possible to execute it with the 64 bit version? I just want to try and run it and apply a patch in winevdm which executes the 16 bit exe anyways.

Gcenx
Level 5
Level 5
Posts: 499
Joined: Mon Dec 25, 2017 12:11 pm

Re: Problems running Wine after building from Source on 10.14.6 Mojave

Post by Gcenx » Fri May 08, 2020 8:53 am

This seems strange so I did some digging of my own about the error you keep getting, in going to assume homebrew caused this mess when building libfreetype as when I last tested using brew it was only for the listed build dependencies not libraries/headers.

See;
https://trac.macports.org/ticket/57295
Tunning “/usr/bin/libtool -o” causes the problem as skipping it resolved the issue.

Instead of using brew to build freetype do the following;

Code: Select all

./configure CFLAGS="-I/opt/X11/include" LDFLAGS="-L/opt/X11/lib" PKG_CONFIG_PATH="/opt/X11/lib/pkgconfig"
With you PATH set correctly for bison etc this will ensure everything from XQuartz is picked up and used.

You can use the following for CC;

Code: Select all

CC="clang -mmacosx-version-min=10.8 -isysroot/Path/to/MacOSX10.13.sdk/"
You select clang as the default compiler, force minimum target to 10.8 and use the 10.13SDK to allow compiling of 32Bit code even if you have Xcode 10 Command Line Tools installed or even have Xcode11.3.1 set via xcode-select.


Wine = 32Bit (16Bit via trunking) binaries
Wine64 = 64Bit binaries only
Wine32on64 = 32Bit binaries only (16Bit trunking is disabled in the current version)

Gcenx
Level 5
Level 5
Posts: 499
Joined: Mon Dec 25, 2017 12:11 pm

Re: Problems running Wine after building from Source on 10.14.6 Mojave

Post by Gcenx » Sun May 10, 2020 11:56 am

Wine-5.8 is broken with the issue you mentioned, the bug was reported by Gijs https://bugs.winehq.org/show_bug.cgi?id=49131 I confirmed this and linked this thread.


I can confirm what you said about wine not working within a VM correctly, if I move wine I compiled on Mojave to 10.8.5 VM macDriver doesn't function, however using X11 wine functions (Wine-4.15 > Wine-5.7)

Wine-4.14 and lower use macDriver within a VM without issue, not sure if thats something that can be fixed or not as a VM might not be considered a valid target platform

Post Reply