doitsujin / dxvk

Vulkan-based implementation of D3D8, 9, 10 and 11 for Linux / Wine
zlib License
13.2k stars 851 forks source link

Compilation fatal error: d3d11on12.h: No such file or directory #3328

Closed dmitryr117 closed 1 month ago

dmitryr117 commented 1 year ago

When compiling on Ubuntu 22.04 using the following command: $ ./package-release.sh master ../dlls/ --no-package

I get the following error:

Run-time dependency threads found: YES
Dependency threads found: YES unknown (cached)
Build targets in project: 14

dxvk v2.1

  Subprojects
    libdisplay-info: YES

  User defined options
    Cross files    : /home/dmitryr117/dev/dxvk/dxvk/build-win64.txt
    bindir         : x64
    buildtype      : release
    libdir         : x64
    prefix         : /home/dmitryr117/dev/dxvk/dlls/dxvk-master
    strip          : True
    build_id       : false

Found ninja-1.10.1 at /usr/bin/ninja
[168/289] Compiling C++ object src/d3d11/d3d11.dll.p/d3d11_class_linkage.cpp.obj
FAILED: src/d3d11/d3d11.dll.p/d3d11_class_linkage.cpp.obj 
x86_64-w64-mingw32-g++ -Isrc/d3d11/d3d11.dll.p -Isrc/d3d11 -I../../../dxvk/src/d3d11 -I../../../dxvk/include -I../../../dxvk/include/vulkan/include -I../../../dxvk/include/spirv/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c++17 -O3 -msse -msse2 -msse3 -mfpmath=sse -Wimplicit-fallthrough -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type -Wno-unused-const-variable -Wno-missing-braces -DNOMINMAX -D_WIN32_WINNT=0xa00 -DDXVK_WSI_WIN32 -MD -MQ src/d3d11/d3d11.dll.p/d3d11_class_linkage.cpp.obj -MF src/d3d11/d3d11.dll.p/d3d11_class_linkage.cpp.obj.d -o src/d3d11/d3d11.dll.p/d3d11_class_linkage.cpp.obj -c ../../../dxvk/src/d3d11/d3d11_class_linkage.cpp
In file included from ../../../dxvk/src/d3d11/d3d11_on_12.h:3,
                 from ../../../dxvk/src/d3d11/d3d11_buffer.h:10,
                 from ../../../dxvk/src/d3d11/d3d11_context.h:16,
                 from ../../../dxvk/src/d3d11/d3d11_cmdlist.h:5,
                 from ../../../dxvk/src/d3d11/d3d11_device.h:17,
                 from ../../../dxvk/src/d3d11/d3d11_class_linkage.cpp:2:
../../../dxvk/src/d3d11/d3d11_on_12_interfaces.h:5:10: fatal error: d3d11on12.h: No such file or directory
    5 | #include <d3d11on12.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
[170/289] Compiling C++ object src/d3d11/d3d11.dll.p/d3d11_annotation.cpp.obj

System information

doitsujin commented 1 year ago

Not sure why Ubuntu wouldn't package that paticular header, it's part of the mingw-headers package on Arch and that's the same version.

dmitryr117 commented 1 year ago

I originally started with mingw-w64 8.0.0 which is default to Ubuntu 22.04. But it failed then as well. I wonder if this has something to do with the issue.

dmitryr117 commented 1 year ago

So I updated to Ubuntu 22.10. And it compiled. The configuration is now as follows:

Blisto91 commented 1 year ago

@dmitryr117 Am i understanding correctly that you solved the issue when updating your distro?

dpieve commented 1 year ago

I had the same error in Ubuntu 22.04. As suggested, I updated to 22.10.

Now it fails here:

Found ninja-1.11.0 at /usr/bin/ninja
[193/289] Compiling C++ object src/d3d11/d3d11.dll.p/d3d11_interop.cpp.obj
FAILED: src/d3d11/d3d11.dll.p/d3d11_interop.cpp.obj
x86_64-w64-mingw32-g++ -Isrc/d3d11/d3d11.dll.p -Isrc/d3d11 -I../../src/d3d11 -I../../include -I../../include/vulkan/include -I../../include/spirv/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -std=c++17 -O3 -msse -msse2 -msse3 -mfpmath=sse -Wimplicit-fallthrough -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type -Wno-unused-const-variable -Wno-missing-braces -DNOMINMAX -D_WIN32_WINNT=0xa00 -DDXVK_WSI_WIN32 -MD -MQ src/d3d11/d3d11.dll.p/d3d11_interop.cpp.obj -MF src/d3d11/d3d11.dll.p/d3d11_interop.cpp.obj.d -o src/d3d11/d3d11.dll.p/d3d11_interop.cpp.obj -c ../../src/d3d11/d3d11_interop.cpp
x86_64-w64-mingw32-g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[210/289] Compiling C++ object src/d3d11/d3d11.dll.p/d3d11_context.cpp.obj
ninja: build stopped: subcommand failed.

Steps:

git clone --recursive https://github.com/doitsujin/dxvk.git
cd dxvk
./package-release.sh master . --no-package

Compiling manually gives the same error

What should I try to fix it?

TheFireKahuna commented 1 year ago

Same issue

[169/289] Compiling C++ object src/d3d11/d3d11.dll.p/d3d11_cuda.cpp.obj
FAILED: src/d3d11/d3d11.dll.p/d3d11_cuda.cpp.obj
i686-w64-mingw32-g++ -Isrc/d3d11/d3d11.dll.p -Isrc/d3d11 -I../src/d3d11 -I../include -I../include/vulkan/include -I../include/spirv/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -std=c++17 -g -msse -msse2 -msse3 -mfpmath=sse -Wimplicit-fallthrough -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type -Wno-unused-const-variable -Wno-missing-braces -DNOMINMAX -D_WIN32_WINNT=0xa00 -gstrict-dwarf -gdwarf-2 -DDXVK_WSI_WIN32 -MD -MQ src/d3d11/d3d11.dll.p/d3d11_cuda.cpp.obj -MF src/d3d11/d3d11.dll.p/d3d11_cuda.cpp.obj.d -o src/d3d11/d3d11.dll.p/d3d11_cuda.cpp.obj -c ../src/d3d11/d3d11_cuda.cpp
In file included from ../src/d3d11/d3d11_on_12.h:3,
                 from ../src/d3d11/d3d11_buffer.h:10,
                 from ../src/d3d11/d3d11_cuda.h:11,
                 from ../src/d3d11/d3d11_cuda.cpp:1:
../src/d3d11/d3d11_on_12_interfaces.h:5:10: fatal error: d3d11on12.h: No such file or directory
    5 | #include <d3d11on12.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
[182/289] Compiling C++ object src/dxgi/dxgi.dll.p/dxgi_output.cpp.obj
ninja: build stopped: subcommand failed.

I've reinstalled mingw, have the following packages installed

Setting up g++-mingw-w64-x86-64-posix (10.3.0-14ubuntu1+24.3) ...
Setting up g++-mingw-w64-x86-64 (10.3.0-14ubuntu1+24.3) ...
Setting up g++-mingw-w64-i686-posix (10.3.0-14ubuntu1+24.3) ...
Setting up g++-mingw-w64-i686 (10.3.0-14ubuntu1+24.3) ...
Setting up g++-mingw-w64 (10.3.0-14ubuntu1+24.3) ...
squidme3 commented 1 year ago

Has anyone found a fix. I am getting the same issue. I 'm also on Ubuntu and upgrading distro and reinstalling mingw did nothing. I am getting this error:

[167/290] Compiling C++ object src/d3d11/d3d11.dll.p/d3d11_class_linkage.cpp.obj
FAILED: src/d3d11/d3d11.dll.p/d3d11_class_linkage.cpp.obj 
x86_64-w64-mingw32-g++ -Isrc/d3d11/d3d11.dll.p -Isrc/d3d11 -I../../src/d3d11 -I../../include -I../../include/vulkan/include -I../../include/spirv/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -std=c++17 -O3 -msse -msse2 -msse3 -mfpmath=sse -Wimplicit-fallthrough -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type -Wno-unused-const-variable -Wno-missing-braces -DNOMINMAX -D_WIN32_WINNT=0xa00 -DDXVK_WSI_WIN32 -MD -MQ src/d3d11/d3d11.dll.p/d3d11_class_linkage.cpp.obj -MF src/d3d11/d3d11.dll.p/d3d11_class_linkage.cpp.obj.d -o src/d3d11/d3d11.dll.p/d3d11_class_linkage.cpp.obj -c ../../src/d3d11/d3d11_class_linkage.cpp
In file included from ../../src/d3d11/d3d11_on_12.h:3,
                 from ../../src/d3d11/d3d11_buffer.h:10,
                 from ../../src/d3d11/d3d11_context.h:16,
                 from ../../src/d3d11/d3d11_cmdlist.h:5,
                 from ../../src/d3d11/d3d11_device.h:17,
                 from ../../src/d3d11/d3d11_class_linkage.cpp:2:
../../src/d3d11/d3d11_on_12_interfaces.h:5:10: fatal error: d3d11on12.h: No such file or directory
    5 | #include <d3d11on12.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
[170/290] Compiling C++ object src/d3d11/d3d11.dll.p/d3d11_annotation.cpp.obj
FAILED: src/d3d11/d3d11.dll.p/d3d11_annotation.cpp.obj 
x86_64-w64-mingw32-g++ -Isrc/d3d11/d3d11.dll.p -Isrc/d3d11 -I../../src/d3d11 -I../../include -I../../include/vulkan/include -I../../include/spirv/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -std=c++17 -O3 -msse -msse2 -msse3 -mfpmath=sse -Wimplicit-fallthrough -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type -Wno-unused-const-variable -Wno-missing-braces -DNOMINMAX -D_WIN32_WINNT=0xa00 -DDXVK_WSI_WIN32 -MD -MQ src/d3d11/d3d11.dll.p/d3d11_annotation.cpp.obj -MF src/d3d11/d3d11.dll.p/d3d11_annotation.cpp.obj.d -o src/d3d11/d3d11.dll.p/d3d11_annotation.cpp.obj -c ../../src/d3d11/d3d11_annotation.cpp
In file included from ../../src/d3d11/d3d11_on_12.h:3,
                 from ../../src/d3d11/d3d11_buffer.h:10,
                 from ../../src/d3d11/d3d11_context.h:16,
                 from ../../src/d3d11/d3d11_cmdlist.h:5,
                 from ../../src/d3d11/d3d11_context_def.h:3,
                 from ../../src/d3d11/d3d11_annotation.cpp:2:
../../src/d3d11/d3d11_on_12_interfaces.h:5:10: fatal error: d3d11on12.h: No such file or directory
    5 | #include <d3d11on12.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
[176/290] Compiling C++ object src/d3d11/d3d11.dll.p/.._dxgi_dxgi_format.cpp.obj
ninja: build stopped: subcommand failed.
Blisto91 commented 1 year ago

Sorry i don't think any of the devs use ubuntu and are all (or most?) on Arch based distros, myself included. Having installed mingw-w64 plus the headers packages here i have the d3d11on12.h files included.

/usr/x86_64-w64-mingw32/include/d3d11on12.h
/usr/i686-w64-mingw32/include/d3d11on12.h

Version 10.0.0 by the looks of it.

Wedge009 commented 1 year ago

I worked around this by manually installing the packages from Ubuntu 22.10.

https://packages.ubuntu.com/kinetic/mingw-w64-i686-dev https://packages.ubuntu.com/kinetic/mingw-w64-x86-64-dev https://packages.ubuntu.com/kinetic/mingw-w64-common

Blisto91 commented 1 year ago

https://github.com/WinterSnowfall/dxvk-build-tools might also be of interest.

Ahmed-E-86 commented 1 year ago

https://github.com/WinterSnowfall/dxvk-build-tools might also be of interest.

The first command in your freaking docker_build.sh contains this command:

docker system prune -f

And this freaking command deletes all stopped containers. I did not notice this command at first, then I found all the containers are deleted, and everything inside them. I do not know how I overlooked this command, but it happened. How did you think it is a good idea to add this command @Blisto91!?

jp7677 commented 1 year ago

Running docker system prune is indeed fatal when you use docker for other affairs. I sincerely hope that you didn't lost any serious data. I solved this slightly different in my build-using-docker-attempt by just deleting the earlier tagged container, https://github.com/jp7677/dxvk-docker/blob/master/setup-dxvk-docker.sh#L8 (usage on you own risk, please also don't trust my scripts, I've written them with my setup and workflow in mind)

Ahmed-E-86 commented 1 year ago

@jp7677 I lost a few local databases that I was testing before production, nothing fatal, but I learned my lesson.

I am working on something related to dxvk-nvapi, but I have not used dxvk-nvapi before mainly because I have an AMD GPU, and I do not know if it is safe to use it globally, or it could to lead to issues with some games, or GPUs.

jp7677 commented 1 year ago

@jp7677 I lost a few local databases that I was testing before production, nothing fatal, but I learned my lesson.

I'm glad to hear that!

I am working on something related to dxvk-nvapi, but I have not used dxvk-nvapi before mainly because I have an AMD GPU, and I do not know if it is safe to use it globally, or it could to lead to issues with some games, or GPUs.

The benefits of dxvk-nvapi i.c.w. are very limited on AMD, I suggest to go through https://github.com/jp7677/dxvk-nvapi/blob/master/README.md and start slowly and enable it game by game if want to go that route. Feel free to open an issue at https://github.com/jp7677/dxvk-nvapi/issues when you have any questions since this is getting out of scope for this issue/issue tracker here.

Blisto91 commented 1 year ago

Note it's not my project. But I am very sorry that I guided you to something that could have deleted important data 😬. Glad to hear nothing fatal was lost.

WinterSnowfall commented 1 year ago

I do not know how I overlooked this command, but it happened. How did you think it is a good idea to add this command @Blisto91!?

@Blisto91's not to blame, it's my fault. In my defense I never intended for people to use these scripts on an environment where they already have other docker containers (I certainly don't), since it's mostly targeted at beginners in docker, but agree it's sort of a big oops/oversight on my end. I will remove it and apologize for any trouble it's caused.

I also tend to use docker volumes for persistent storage (and strongly recommend their use in general), which the offending command doesn't remove, but admittedly resorting to them is a personal choice and I certainly don't expect everyone out there to.

I lost a few local databases that I was testing before production, nothing fatal, but I learned my lesson.

.. I'm very sorry this happened. Hopefully part of that lesson (that was not my intention to teach) is that you should never store persistent state inside of a container. If you'll ever use any IaC solution note that containers are regarded as perishable resources and can get removed/recreated outside of your control, so your persistent data lifecycle should not be tied to them in any way.

Edit: Don't use as of writing. See comment below.

It should be safe(r) to use now, even on a docker-heavy system, sorry for the trouble. As with everything, it's probably a good idea to try out the scripts in a sandbox or a non-critical system before committing to their use.

SwimmingTiger commented 1 year ago

I have the same issue with Ubuntu 22.04 and mingw-w64. But when I build with llvm-mingw, everything works well.

# remove mingw-w64
sudo apt purge --autoremove mingw-w64

# download llvm-mingw
wget https://github.com/mstorsjo/llvm-mingw/releases/download/20230320/llvm-mingw-20230320-ucrt-ubuntu-18.04-x86_64.tar.xz

# unpack
tar xf llvm-mingw-20230320-ucrt-ubuntu-18.04-x86_64.tar.xz

# set env
export PATH="$PWD/llvm-mingw-20230320-ucrt-ubuntu-18.04-x86_64/bin:$PATH" LD_LIBRARY_PATH="$PWD/llvm-mingw-20230320-ucrt-ubuntu-18.04-x86_64/lib"

# build dxvk
git clone --recursive https://github.com/doitsujin/dxvk.git
cd dxvk
./package-release.sh master . --no-package

It works fine.

suamor commented 9 months ago

I worked around this by manually installing the packages from Ubuntu 22.10.

https://packages.ubuntu.com/kinetic/mingw-w64-i686-dev https://packages.ubuntu.com/kinetic/mingw-w64-x86-64-dev https://packages.ubuntu.com/kinetic/mingw-w64-common

Just want to point out that 22.10 has no longer support. The links are no longer valid. Currently you still can find the mingw 10.0 kinetic packages that are compatible, but only via search machine.

Wedge009 commented 9 months ago

I suppose you could try lunar (23.04) packages.

Blisto91 commented 7 months ago

@dmitryr117 Is this still an issue with latest Ubuntu?

Blisto91 commented 6 months ago

@dmitryr117 Friendly ping

hwertz commented 3 months ago

Oh yeah, I had this issue. This isn't the way to do it probably, but I copied dxvk/include/native/directx/d3d11on12.h (or possibly *.h) to dxvk/src/d3d11/

I just recently re-checked out dxvk, due to some header error and now realize this isn't quite working any longer. I get an error about "../../../dxvk/src/d3d8/d3d8_interface.cpp:69:16: error: ‘D3DENUM_WHQL_LEVEL’ was not declared in this scope; did you mean ‘D3DENUM_NO_WHQL_LEVEL’?"

Ahh well. I do have a 24.04 VM, so I can just build it on there if I need to. Or Arch.

LUser-12 commented 1 month ago

fixed it by installing these deb packages manually https://packages.ubuntu.com/noble/mingw-w64-common https://packages.ubuntu.com/noble/mingw-w64-i686-dev https://packages.ubuntu.com/noble/mingw-w64 https://packages.ubuntu.com/noble/mingw-w64-x86-64-dev

K0bin commented 1 month ago

We've clearly established that this is a problem with the packages shipped by specific distributions and a workaround has been posted. So I'd say this issue can be closed.

hwertz commented 1 month ago

Indeed. And for the last error I had (with the error with dxvk/src/d3d8) I simply made a copy of package-release.sh (called pacakage-release-nod3d8.sh) and in the section for "meson setup" I added "-Denable_d3d8=false" to it. I probably could replace my mingw headers with other ones to fix it, but I don't have any games that need the new d3d8 support (I have a few games that old but presumably the wine's wined3d is taking care of them instead...)

So distro-specific, and this bug documents the workarounds even for that distro. Thanks for the great work! --Henry