Opened 3 years ago

Last modified 3 years ago

#13796 new bug

hard to embed custom manifest on windows

Reported by: joeyhess Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.0.2
Keywords: Cc:
Operating System: Windows Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


I want to use a custom manifest file on windows to enable long filename support. I tried several ghc options to find a way to do it, and it does not seem easily possible to do this.

First I thought, let's use -fno-gen-manifest, and since ghc generates foo.exe.manifest when building foo.hs, I'll provide a file with that name and it'll pick it up. But it seems that -fno-gen-manifest implies -fno-embed-manifest, so it didn't run windres, and this didn't work.

Then I tried using -optwindres, hoping to pass windres -i foo.rc, and make that file point to my custom manifest. But, despite being documented as options that are passed to windres, -optwindres actually adds to the end of the windres --preprocessor option, so this caused it to run windres --preprocessor "gcc.exe ... -i foo.rc"

The only remaining option seems to be to use -pgmwindres with a wrapper program that runs windres with the options I want. It seemed easier to file a ghc bug at this point..

I feel that the best fix would be either to still run windres when -fno-gen-manifest is used, or to add a new option like -fuse-custom-manifest-file=filename

Change History (2)

comment:1 Changed 3 years ago by garethr

Would it be possible to opt in to long filenames by default on Windows 10? Is there any part of ghc or a library that assumes paths have a maximum of 260 characters?

The relevant Microsoft documentation is here:

Tip Starting in Windows 10, version 1607, MAX_PATH limitations have been removed from common Win32 file and directory functions. However, you must opt-in to the new behavior.

comment:2 Changed 3 years ago by joeyhess

See for the long paths on windows issue.

Note: See TracTickets for help on using tickets.