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

Building on Windows with mingw_64 #27

Closed
jlmelville opened this issue Jun 22, 2018 · 2 comments
Closed

Building on Windows with mingw_64 #27

jlmelville opened this issue Jun 22, 2018 · 2 comments

Comments

@jlmelville
Copy link
Contributor

jlmelville commented Jun 22, 2018

I tried building this (immensely helpful and educational) package on Windows 10 with RStudio via devtools::load_all(".") and building with the g++ that comes with Rtools\mingw_64 fails. It doesn't realize it's on Windows, and wants to #include <sys/mman.h>.

Both the 32-bit and 64-bit versions of MinGW have a __MINGW32__ macro, so changing the check on line 37 of annoylib.h worked for me:

#if defined(_MSC_VER) || defined(__MINGW32__)
#ifdef _MSC_VER
#define NOMINMAX
#endif
#include "mman.h"
#include <windows.h>
#else
#include <sys/mman.h>
#endif
@eddelbuettel
Copy link
Owner

Hm, but it build fine on Windows as it does everywhere else.

Plus, that is a line in the upstream code.

@eddelbuettel
Copy link
Owner

And it is still unchanged upstream so it seems like you should make sure load_all() does not unset _MSER_VER which it may. Not our fault.

Also, try to communicate with diff output, not new code chunk as that makes the change more apparent.

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

No branches or pull requests

2 participants