-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Open
Labels
Description
With this app.manifest
:
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application>
</assembly>
With a simple hello world program manifest_test.cpp
:
#include <cstdio>
int main() {
puts("Hello world");
}
Build:
clang++ -target x86_64-pc-windows-msvc manifest_test.cpp -c -o manifest_test.obj
lld-link -defaultlib:libcmt /OUT:manifest_test.exe /manifest:embed /manifestinput:app.manifest /manifestinput:app.manifest /SUBSYSTEM:CONSOLE /MACHINE:X64 manifest_test.obj
If you try to run the output binary, you will get this error: "The application has failed to start because its side-by-side configuration is incorrect"
Extracting the manifest from the binary using resource hacker gives this:
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo>
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application>
</assembly>
The <windowsSettings>
element is duplicated, which I presume is what making Windows unhappy.
Try the same using link.exe instead of lld-link, and the resulting embedded manifest does not have this duplicated element:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"><trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><requestedPrivileges><requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel></requestedPrivileges></security></trustInfo><application xmlns="urn:schemas-microsoft-com:asm.v3"><windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings"><ws2:longPathAware>true</ws2:longPathAware></windowsSettings></application></assembly>