Skip to content
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

native Windows compilation #25

Merged
merged 41 commits into from Sep 3, 2020
Merged

Conversation

cmacdonald
Copy link
Contributor

Please consider this pull request for review. This PR addresses the compilation and running of trec_eval on Windows, when using the standard Microsoft Visual Studio toolchain (e.g. rather than cygwin). This is required in order to get pytrec_eval working under Windows (see cvangysel/pytrec_eval#27).

The changes to trec_eval include:

  • find some free/BSD-license implementations of get_opt_long(), mmap() etc.
  • change some of the qrel reading code to use fopen(), fseek() rather than open() and lseek();
    All new files are included in a separate "windows" sub-directory.

I also created a Github Action workflow that does compilation and testing on Linux, Mac and Windows (see .github/workflows). The last run is at https://github.com/cmacdonald/trec_eval/actions/runs/137772843

There were a lot of commits, so you might consider squash-merge to make the revision history simpler.

I would hope that once we have this merged, we can improve the action to put trec_eval.exe file in the Github releases directory when you do each release.

Copy link
Collaborator

@isoboroff isoboroff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the problem being solved in e.g. get_prefs.c. Does MSVC not have standard library calls like read()?
Other than that I'm ready to merge.

@cmacdonald
Copy link
Contributor Author

Something like that. I think perhaps fread() etc are more preferable these days and cross-platform?

My REAME.windows.md did record some motivations.

A few additional includes are used:
 - `mman.h` - a mmap() implementation for Windows
 - `unistd.h` - dropin replacement for the Unix header file unistd.h
 - `ya_getopt.h` - BSD licensed getopt_log() implementation

Other advantages would also be Github actions for automatic testing - see https://github.com/cmacdonald/trec_eval/actions

@cmacdonald
Copy link
Contributor Author

My search history for 16th June is full of read vs fread. I think read is a syscall and varies by platform; fread is more reliable and behaves in a standard way. Similar discussion about lseek vs fseek. (It might have been lseek that drove the change.)

GitHub actions shows this version passing on Windows, Ubuntu and Mac.

@isoboroff
Copy link
Collaborator

I do like the automatic testing doodad, that's a winner. Merging!

@isoboroff isoboroff merged commit d95ca64 into usnistgov:master Sep 3, 2020
@cmacdonald
Copy link
Contributor Author

woop. Do you need a version for version 10 branch?

@isoboroff
Copy link
Collaborator

I'm going to try to cherrypick it into v10-dev, if that doesn't work I'll hit you up. This seems good enough it should go in both. I already packaged up a new 9.0.8 release.

@cmacdonald
Copy link
Contributor Author

cmacdonald commented Sep 3, 2020 via email

isoboroff added a commit that referenced this pull request Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants