meson
meson copied to clipboard
Custom manifest does not work with VS backend
Describe the bug
I use .manifest
files with the /MANIFEST:NO
option in my projects.
They worked fine with old versions of meson (e.g. 1.3.2)
But I got errors with meson 1.4.0.
***.exe.intermediate.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified.
I can see /ManifestFile:"***.exe.intermediate.manifest"
in linker options but I don't think there is the file because it uses my custom .manifest
file.
To Reproduce Build libui-ng with VS backend.
git clone https://github.com/libui-ng/libui-ng.git
cd libui-ng
meson setup builddir --backend=vs
meson compile -C builddir --verbose
Or see my failed workflow. https://github.com/matyalatte/libui-ng/actions/runs/8558688815/job/23453770280
Expected behavior Pass the failed workflow https://github.com/matyalatte/libui-ng/actions/runs/8558688815/job/23453770280
system parameters
-
Is this a cross build or just a plain native build (for the same computer)? native build
-
what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.) Windows 10
-
what Python version are you using e.g. 3.8.0 Idk. I installed meson with the released msi. (meson-1.4.0-64.msi)
-
what
meson --version
1.4.0 -
what
ninja --version
if it's a Ninja build not ninja build
https://github.com/mesonbuild/meson/pull/12472 could be the cause. and it should be reverted.
Visual Studio creates a default manifest even if EmbedManifest
is false. (I can see ***.exe.manifest
in the build directory even when using a custom manifest with meson 1.4.0.)
The only way I know to disable the manifest creation is to use /MANIFEST:NO
. But it conflicts with the /ManifestFile:
option. It means EmbedManifest
should be true.
@LBPHacker
Sorry for the ping but I think you should see this comment.
I doubt that you disabled the manifest creation in your project.
And I think you can use /MANIFEST:NO
to use your custom manifest with meson 1.3.2.
The ping is much appreciated. I indeed have not disabled manifest creation in my project, because that was not my goal. My goal was to prevent the embedding of a manifest that I didn't ask for, so I looked for ways to do that.
I did originally look for a linker argument that would control this, which I didn't find and still haven't found. I then found the EmbedManifest
node by diffing .vcxprojs corresponding to different states of the Project Properties/Manifest Tool/Input and Output/Embed Manifest
setting.
I deemed this a safe change for Meson because I had assumed that this option only controls whether the manifest gets embedded. Never in my wildest dreams would I have thought that this also controls whether the manifest file is generated; I expect that to be a function of the Project Properties/Linker/Manifest File/Generate Manifest
setting, whatever node that may map to. I'm still not convinced, but who knows.
I can confirm that adding /MANIFEST:NO
to link_args
makes my project build (~~on my machine™, testing other environments right now, will update this comment later~~; edit: works everywhere I tested) with Meson 1.3.2, though it does this with a warning about /MANIFESTUAC
, something I didn't specify, being ignored because of /MANIFEST:NO
; I suspect that one comes from some other setting of the Meson-generated .vcxproj, annoying.
I can also support the argument that Meson doesn't need to know how to fix problems that originate from user code/data (in this case, my resource script) if they can be fixed elsewhere by other user code/data (in this case, the extra link_arg), especially if its knowing how to fix these problems introduces other problems elsewhere.
Thank you for your reply.
though it does this with a warning about /MANIFESTUAC, something I didn't specify, being ignored because of /MANIFEST:NO; I suspect that one comes from some other setting of the Meson-generated .vcxproj, annoying.
Fair point. Understandable that some people dislike warnings more than unnecessary files.
Never in my wildest dreams would I have thought that this also controls whether the manifest file is generated; I expect that to be a function of the Project Properties/Linker/Manifest File/Generate Manifest setting
I tried ET.SubElement(direlem, 'GenerateManifest').text = 'false'
today. and it worked!
It removed both /ManifestFile:
and /MANIFESTUAC
from linker options.
So, we need to check link_args
to add the GenerateManifest
node?
It looks a little bit hacky but https://github.com/matyalatte/meson/commit/89f0cb4ad0086bbcdb9f9e973b638e07ffa6c9e4 works fine for me.