microsoft / DirectXShaderCompiler

This repo hosts the source for the DirectX Shader Compiler which is based on LLVM/Clang.
Other
3.09k stars 689 forks source link

DXC.EXE lacks support for long file paths #6667

Open walbourn opened 5 months ago

walbourn commented 5 months ago

When long file paths are enabled on Windows 10 Version 1607 or later, DXC.EXE still fails to compile them.

In general the LLVM codebase supports very long file paths internally, so this is likely just a case of adding the following manifest to the binary.

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
    <asmv3:application>
        <asmv3:windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
            <ws2:longPathAware>true</ws2:longPathAware>
        </asmv3:windowsSettings>
    </asmv3:application>
</assembly>

For example:

md "Projects\C++\this is a rather long path for a path on windows where long paths are a problem with the limit of two hundred fifty characters but there is a solution which implies adding a registry key and configuring the project to include a manifest"
// copy PixelShader.hlsl to this new folder
dxc /T ps_6_0 "Projects\C++\this is a rather long path for a path on windows where long paths are a problem with the limit of two hundred fifty characters but there is a solution which implies adding a registry key and configuring the project to include a manifest\PixelShader.hlsl"
The system cannot find the path specified. Projects\C++\this is a rather long path for a path on windows where long paths are a problem with the limit of two hundred fifty characters but there is a solution which implies adding a registry key and configuring the project to include a manifest\PixelShader.hlsl
llvm-beanz commented 4 months ago

@walbourn We've screened this as dormant and aren't likely to invest resources to fix it but would accept a PR. Can you provide some context for the priority of this issue?

walbourn commented 4 months ago

We are pushing to get as many developer tools updated for long paths as possible. MSBuild supports long paths. CMake/Ninja support long paths. Since this codebase is LLVM based, it should be long path compatible without significant change.

llvm-beanz commented 4 months ago

@walbourn, unfortunately I don’t think that is quite true. DXC doesn’t use LLVM’s filesystem abstractions instead it inserted its own which are hand rolled.

Squall-Leonhart commented 4 months ago

DXC functions with long paths just fine when the manifest is forcibly injected, only tested up to 2000 characters though.