-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App can't run after using upx. #12
Comments
Interesting. In my project, https://github.com/josephspurrier/goversioninfo, the icon resource looks like it messes up the version information when viewed in a resource editor, but still appears fine in the file properties. I wonder if the icon code has a bug that's screwing up the other resources. |
It seems like the icon is not being embedded correctly. Using https://github.com/zed-0xff/pedump on a generated binary, I see the error:
|
Sorry, I totally don't have time to explore this issue now, and won't have for quite some time in the future :/ If anyone would be able to debug this and send a PR with a fix, I'd be very happy to merge; though please note you must be prepared for some back and forth of passing through my review, which may potentially require some refactoring. Anyone wanting to try a dab at this is also welcome to ask me here any questions about the codebase or talk about his/her ideas. Also any further debugging info trying to pinpoint the cause of the issue is welcome here (thanks @tmm1 for starting this!). It may be especially interesting and valuable to find out what exactly is pedump complaining about. Maybe I could even fix it myself then, if it was simple enough. My method for building this app was, after I built the main features, mostly to compare my generated .so files with ones generated by windres in hex editor, and try to pinpoint any differences, then find what they mean and which can be important, and try fixing them until Go linker stops complaining. Pedump could be a nice tool to add to this checking phase. |
Looks like this is actually a bug with pedump, and presumably |
Hello, i think resource data must be aligned on 4 bytes. So, in resource data entry you should only find offsets that are multiples of 4. goversioninfo produces an invalid resource section when, because of the icon, it writes its data misaligned. I wanted to provide a PR, but the code in rsrc is a little too clever for me. I think it'd be easier for me to rewrite it from scratch, or write a syso fixer. I've fixed my own syso with an hex editor, and it suddenly produced a valid exe file according to Resource Hacker, before and after UPX compression. |
I tried misaligned icon pictures, and aligned version info. |
You can try with this fork : https://github.com/tc-hib/rsrc |
Simpler approach to achieve the main goal of #32. Based esp. on a comment by @tc-hib: > in [resource data entry]( > https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#resource-data-entry) > you should only find offsets that are multiples of 4. (#12 (comment)) HUUUUUUGE THANKS to @tc-hib, for his work with PR #32, for his patience, perseverance and replies, and for the invaluable comment quoted above.
I want to compress the binary file, so I try upx. But app can't run after using upx if the generated .syso file contains icon resource. However, the app run correctly if the generated .syso file only contains manifest.
The text was updated successfully, but these errors were encountered: