-
Notifications
You must be signed in to change notification settings - Fork 166
Fix building under windows targets. #210
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
Conversation
Thanks very much for submitting, on a first glance this looks great! It will be important to identify why the SHA256 test is failing. But if the reason turns out to be something that is basically superficial, we should be able to modify the tests to vary their expectations depending on the platform. Two additional items that would be great to bring along with this if you can find the time:
|
Yes, i think it's important too. However i'm not so familiar with TeX... So i'll try to understand what's in the content of the "plain.fmt" file, and compare it to what the linux version generates... It will take several days, and it will be useful if you can point me to a few web pages about them. And i'm not satisfied my current building process, the "c dependencies" part is still a bit hacky. I'll make use of AppVeyor to find out a clean way to do it. In the meantime i'll also try to make the windows-msvc version build too. I plan to write some docs on the Windows build process when all of these are ready. |
The first thing I'd suggest is doing a binary diff on your format and the Linux version ... the difference might just be an extra zero byte at the end of the file, or something simple like that. In which case it will probably not be so hard to locate the relevant code. Another possibility is that there is code to byte-swap the format files and maybe everything is getting byte-swapped relative to the reference files. The relevant C code starts here and I think is all in that file. It refers to "dump" files rather than "format" files. The format is a little complex but I have trouble seeing how anything platform-dependent would sneak into the higher-level code, so it probably has to do with the low-level I/O. As ever, TeX: The Program is the canonical reference for the original design ... as written in a language no one else uses, for mathematicians, for a different version of the code :-/. I'm afraid that know very little about how to build software on Windows so I don't feel that I can contribute much to the bigger infrastructure, but thank you for taking the effort to polish the build process! |
Codecov Report
@@ Coverage Diff @@
## master #210 +/- ##
==========================================
- Coverage 37.89% 37.88% -0.01%
==========================================
Files 131 131
Lines 60339 61500 +1161
==========================================
+ Hits 22864 23300 +436
- Misses 37475 38200 +725
Continue to review full report at Codecov.
|
@pkgw I traced the program a little, and now i think i understand where did the difference come from. But during dumping (the place you pointed out), the whole memory is dumped out, including the 0 position. So in theory the 0 position contains garbage. (Accessing it is UB, i think). On linux, the data dumped out over there is 0. On Windows, it's some random bytes, thus the difference. So, what do you think we should do? |
@crlf0710 Nice sleuthing! If that's the case, we should either write and read the array starting at the 1 index, or explicitly zero out the 0th element. I am curious to take a look at this but am busy so might not get a chance to soon — if you are able to implement a fix, feel free to do so. You will have to run the Linux version and calculate the new SHA256 sum yourself if the format file changes. Once again, nice work! |
I don't want to change much of the logic happening inside TeX, so i just changed |
Also i've previously added some hacks to make the code buildable in MSVC too. I've got several files from Now the MSVC version can build. It can also correctly generate the Blocking issues:
Nice to have: |
That's very rapid progress!
|
Progress update: I've written appveyor configuration. There're test failures related with failuring to lock the manifest files in cache. Sadly i can't directly debug this on machine. From my network here i can't access the online bundle, and i'm always using (dogfooded) offline mode (#211). I'm not if this behavior is something wrong with interaction with |
Thanks for the update. I would really like to get this merged, so I will see if I can investigate on my end. |
Hi, @pkgw. I've known the cause of the failure of locking problem. It's because windows doesn't support locking a file in append mode. But at the same time, i read the code a little and it seems to me that "formats" in cache is not locked at all? It seems to me that when a few instances is running simultaneously nothing will stop them from trying to add the plain format into formats and collide. However i'm not able to run this part of code locally and can't be sure of it... |
@crlf0710 Dashing off a quick response here — several of the operations in the caching code rely on Unix filesystem semantics, where file renames are atomic and can be used to set up cache files without any explicit locking. If Windows doesn't provide the same semantics, we'll need some new code to lock appropriately. |
@pkgw Ok, i think that's where the problem is. I don't think MoveFileEx() in winapi provides the same semantics. Anyway i've rebased, moved MSVC stuff off the shelf and got everything i'm certain of here. The appveyor setting is included, you can set it up in ci.appveyor.com, but because of the cache locking problem the tests won't pass now. |
OK, let's get this merged! Note that we're still not properly supporting Windows because of the locking issues, but at least now we'll compile, and the CI infrastructure will be in place to see if we can get things working. |
This commit adds support for building under windows-gnu target. (and windows-msvc target, see below)
This works if:
I can compile this branch locally and run the tests. There's one test still failing, which is the sha256 comparison in formats.rs. Still don't know why yet. I will look into it later.