-
Notifications
You must be signed in to change notification settings - Fork 10
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
Crazy hack and problems with building on Windows with MSys2 #2
Comments
This crazy hack will be removed and replaced with the strategy used is the one described on the wiki page: https://github.com/blueCFD/Core/wiki/Quick-notes-on-how-to-update-build#updating-the-build-of-openfoam-4x-in-bluecfd-core-2016 |
It seems like we can't undo this hack for blueCFD-Core-2016-2. It also looks like this issue is related to the same issue as reported here: arduino/Arduino#2989 - therefore this is something that affects everyone. |
Not including the version object seems to help... |
OK, it seems that I've figured it out. By padding out with some semi-random bytes (a string table), it gives a larger stack for This has worked with But for future reference, the sizes of the binary objects for the |
OK, it seems that the padding needs to be more controlled. There were a couple of utilities that failed when the object file was sized 2238. This gives off the vibe that we're padding out for a specific size, but I haven't figured out what should be the magical size. Using the new padding should have fixed the issue, but instead it lead to other utilities not being linked in the first run, instead of the ones we had at first. |
Partial fix done in this commit: blueCFD/OpenFOAM-dev@419b22b |
Fixed in this commit: blueCFD/OpenFOAM-dev@6d8da04 |
After running
where insert_name_here is any of the names above. |
Here is the command we can use for checking the binaries:
Here is the command that rebuilds only these broken ones:
|
OK, so at least Shortening the padding by 20 bytes solved the issue... sizes of the version object file:
Each padding table row has 31 bytes (62 in Unicode 16) in the previous commits... and it appears that technically it also accounts for the fact that it has to fill up to 8 bytes chunks. Using a more strict padding strategy, namely to use 24 bytes (48 Unicode 16) per row, it gets us a bit more fine control about the final byte size, making it actual multiples of 8 for the total object file size.
|
For detailed reference:
|
After using the following padding block:
the following utilities failed to build:
which have the following sizes:
What seems to be common is that these are not multiples of 8... all ending in .75 when dividing by 8... |
The names changed in the template resource file are:
This means that when the 3 are replaced with
But this still doesn't justify why padding the end sorts it out in some cases... specially because without the last 4(8) bytes on the padding, |
Interesting... even after padding out each entry for |
Nope, I'm unable to find a proper pattern. The issue can be triggered either:
It could be because the total object map has a very small chunk of it occupied... but there is no clear pattern. The best I can do is to use a specific environment variable that is set per application that is affected, so that it knows ahead of time what is the padding size needed. |
OK, after changing the padding mechanism a bit and added the environment variable See commits below for more details about the implementation. The
|
…ed for building an application. This is directly related to blueCFD/Core#2
OK, using the new padding method, the currently broken utilities are:
Will need to use the Problems:
|
So my suspicion is that accessing the default manifest object is giving us these problems. Namely the one mentioned here: https://sourceforge.net/p/mingw-w64/wiki2/default_manifest/ We're not the only ones with problems with this: msys2/MSYS2-packages#454
|
Padding out the whole 1348 bytes that Currently trying with a padding of 2256, just to be sure if this isn't enough... because from what I inspected at the end of the damaged executable, the padding is actually prefixed to the version information... and I have confirmed that the manifest is appended at the very end of the binary. OK it seems like the massive padding did the trick, without the need for extra |
…ing needed for building an application." This is no longer needed, as documented in blueCFD/Core#2 This reverts commit 2009f48.
The massive padding seems to have failed with only one application: Apparently it was because the padding when overboard:
But it's still too soon to tell, because this happened after there were some building problems, because I was messing with the git tree while it was trying to build things... will do another clean rebuild to confirm if it's working or not. The next rebuild gave an error with There are a few other solvers with long names, but they didn't trigger any linking errors and the final builds can be monitored with So, maybe we should at least trim out 1 row or 2 from the padding... Nope, trimming out 2 rows resulted in |
Sigh... now it's |
OK, looks like that using |
…ing. See ��blueCFD/Core#2 for more details.
Next time we upgrade to the latest MSys2 stack, namely for blueCFD-Core 2017-1, we should have this fixed automatically, because the patch has been included on their stack. So all that will be left for this task will later on to remove the hacks that have been introduced above. |
Have reverted the padding in commit blueCFD/OpenFOAM-dev@4eb2a93 for blueCFD-Core 2017-1. For people trying to compile OpenFOAM 5.x on blueCFD-Core 2016-1 stack, please run the following commands to undo this change:
|
For the builds of OpenFOAM 4.x, we had to implement a workaround for the following reason:
This problem seems to occur possibly due to the anti-virus butting in while the linker is still updating the executable file with new objects and features. For example, the
manifest
file object is added after most of the objects have already been added to the final binary; nonetheless, the executable booting header section is only added at the very end of the linking process.The workaround was this:
This possibly will be solved in future versions of GNU ld that are provided with MSys2, therefore we should check back on this after updating and/or using the latest MSys2 software stack.
The text was updated successfully, but these errors were encountered: