protonscr

macOS compilation

dxvkclosed question
doitsujin/dxvk#952 · opened 2019-03-06 by SergeySlice · updated 2019-10-09 · 10 comments · github
SSergeySlice 2019-03-06 github

Is it possible to make native macOS compilation like meson --buildtype release --prefix /opt build.a64?
Wine compilation successful with Xcode10,1 (clang 10.0)
I got an error

The Meson build system
Version: 0.49.2
Source dir: /Volumes/MacHD/Users/sergey/Documents/Projects/dxvk
Build dir: /Volumes/MacHD/Users/sergey/Documents/Projects/dxvk/build.a64
Build type: native build
Project name: dxvk
Project version: v1.0
Native C compiler: cc (clang 10.0.0 "Apple LLVM version 10.0.0 (clang-1000.11.45.5)")
Native C++ compiler: c++ (clang 10.0.0 "Apple LLVM version 10.0.0 (clang-1000.11.45.5)")
Build machine cpu family: x86_64
Build machine cpu: x86_64
Checking if "winelib check" compiles: NO

meson.build:46:2: ERROR:  C++ library 'vulkan-1' not found

I see no explanation where it expected the library to be.

The cross-compilation is successful but I got too large files

MacBook-Pro-Sergey:dxvk sergey$ ls -la bin/
total 140576
drwxr-xr-x   8 sergey  staff       272  5 мар 22:19 .
drwxr-xr-x  26 sergey  staff       884  6 мар 06:58 ..
-rw-r--r--@  1 sergey  staff      6148  5 мар 19:58 .DS_Store
-rwxr-xr-x   1 sergey  staff  13334312  5 мар 22:19 d3d10.dll
-rwxr-xr-x   1 sergey  staff  13334312  5 мар 22:19 d3d10_1.dll
-rwxr-xr-x   1 sergey  staff  13333800  5 мар 22:19 d3d10core.dll
-rwxr-xr-x   1 sergey  staff  16563965  5 мар 22:19 d3d11.dll
-rwxr-xr-x@  1 sergey  staff  15392460  5 мар 22:19 dxgi.dll
MacBook-Pro-Sergey:dxvk sergey$ 

Is it normal?

Ccdavis5e 2019-03-06 github
Checking if "winelib check" compiles: NO

What's build.a64/meson-logs/meson-log.txt say? Look for this line in there, and paste all the lines from "Running compile:" up to it.

Is it normal?

Did you build using the debug configuration? That's pretty normal for a debug build; the debug info in particular takes up a lot of space. If you aren't sure, you almost certainly did, because that's the default.

SSergeySlice 2019-03-06 github

You mean --buildtype release? Yes, I set it.

Llieff 2019-03-06 github

But IIRC MoltenVK still do not supports all needed features for DXVK? Or that's changed?

SSergeySlice 2019-03-06 github

It is fast changing. I can start some vulkan application and want to test DX10/DX11 application with dxvk.
I can compile just a question about too large files. Or may be make native compilation.
The log is not helpful
`Running test binary command: /Volumes/MacHD/Users/sergey/Documents/Projects/dxvk/build.a64/meson-private/sanitycheckcpp.exe
Native C++ compiler: c++ (clang 10.0.0 "Apple LLVM version 10.0.0 (clang-1000.11.45.5)")
Build machine cpu family: x86_64
Build machine cpu: x86_64
Running compile:
Working directory: /var/folders/_h/yd9ch_cj15x5vc1p9fhnk90r0000gn/T/tmp359k27x3
Command line: c++ /var/folders/_h/yd9ch_cj15x5vc1p9fhnk90r0000gn/T/tmp359k27x3/testfile.cpp -pipe -c -o /var/folders/_h/yd9ch_cj15x5vc1p9fhnk90r0000gn/T/tmp359k27x3/output.obj -O0 -fpermissive

Code:
#ifndef WINE
#error 1
#endif
Compiler stdout:

Compiler stderr:
/var/folders/_h/yd9ch_cj15x5vc1p9fhnk90r0000gn/T/tmp359k27x3/testfile.cpp:2:2: error: 1
#error 1
^
1 error generated.

Checking if "winelib check" compiles: NO
Running compile:
Working directory: /var/folders/_h/yd9ch_cj15x5vc1p9fhnk90r0000gn/T/tmp56qhmz9k
Command line: c++ /var/folders/_h/yd9ch_cj15x5vc1p9fhnk90r0000gn/T/tmp56qhmz9k/testfile.cpp -pipe -o /var/folders/_h/yd9ch_cj15x5vc1p9fhnk90r0000gn/T/tmp56qhmz9k/output.exe -O0 -fpermissive

Code:
#include<stdio.h>

    int main(int argc, char **argv) {
        printf("%ld\n", (long)(sizeof(void *)));
        return 0;
    };

Compiler stdout:

Compiler stderr:

Program stdout:

8

Program stderr:

Running compile:
Working directory: /var/folders/_h/yd9ch_cj15x5vc1p9fhnk90r0000gn/T/tmp9vdx46e0
Command line: c++ /var/folders/_h/yd9ch_cj15x5vc1p9fhnk90r0000gn/T/tmp9vdx46e0/testfile.cpp -pipe -c -o /var/folders/_h/yd9ch_cj15x5vc1p9fhnk90r0000gn/T/tmp9vdx46e0/output.obj -O0 -fpermissive --print-search-dirs

Code:

Compiler stdout:
programs: =/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
libraries: =/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0

Compiler stderr:

meson.build:46:2: ERROR: C++ library 'vulkan-1' not found
`

Ccdavis5e 2019-03-06 github

But IIRC MoltenVK still do not supports all needed features for DXVK? Or that's changed?

I'm working on that.

Command line: c++ /var/folders/_h/yd9ch_cj15x5vc1p9fhnk90r0000gn/T/tmp56qhmz9k/testfile.cpp -pipe -o /var/folders/_h/yd9ch_cj15x5vc1p9fhnk90r0000gn/T/tmp56qhmz9k/output.exe -O0 -fpermissive

Did you pass --cross-file build-wine64.txt to meson(1)? That sets the compiler to winegcc. You should probably change the system = 'linux' line to say system = 'darwin' in that file, too.

SSergeySlice 2019-03-06 github

OK, I set --cross-file build-wine64.txt and changed 'linux' to darwin. There is a some progress stoped at error '--no-gnu-unique' is invalid option for clang.
Then I erase this option and meson finished successfully.
Then stop with ninja

fatal error: 'support/win32/locale_win32.h' file not found
# include <support/win32/locale_win32.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
winegcc: clang failed
ninja: build stopped: subcommand failed.
Ccdavis5e 2019-03-07 github

Hmm... I think what's happening is: winegcc(1) defines _WIN32, since it's a Windows-like environment, and as a result libc++ is trying to pull in its Windows headers... which Apple naturally doesn't distribute with Xcode. You may need to build and install libc++ yourself. You may also then need to pass -nostdinc++ -isystem /path/to/libc++/headers to make this work. Oh, and you'll probably need to use -mno-cygwin, since it wants to use a Windows C library.

I probably need to work on making libc++ play nice with winegcc(1)...

SSergeySlice 2019-03-18 github

Somehow I can compile winehq in this environment with existing clang and libraries.

Ccdavis5e 2019-03-18 github

That's because Wine itself isn't written in C++. DXVK is.

Nnatbro 2019-07-20 github

not sure if y'all sorted this out in a different way by manually building libc++, but it also works against vanilla Xcode 9.4.1 and 10+ to build DXVK by making sure you're passing -U_WIN32 when compiling and -lstdc++ when linking. Undefining _WIN32 when calling winegcc is enough to prevent the low-level __locale header from trying to look for <support/win32/locale_win32.h> without causing other windows header problems.

DLLs