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

Add support for Windows? #19

Open
e4lam opened this issue Feb 21, 2021 · 6 comments
Open

Add support for Windows? #19

e4lam opened this issue Feb 21, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@e4lam
Copy link

e4lam commented Feb 21, 2021

On Visual Studio 2019, the code does not build:

$ cl -I../include /O2 /permissive- /std:c++17 simple.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29337 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

simple.cpp
Compilation with -fopenmp is optional but recommended
C:\cygwin\tmp\PGM-index\include\pgm\piecewise_linear_model.hpp(37): error C4235: nonstandard extension used: '__int128' keyword not supported on this architecture
C:\cygwin\tmp\PGM-index\include\pgm\piecewise_linear_model.hpp(37): error C2059: syntax error: '>'
C:\cygwin\tmp\PGM-index\include\pgm\piecewise_linear_model.hpp(37): error C2062: type 'unknown-type' unexpected
C:\cygwin\tmp\PGM-index\include\pgm\piecewise_linear_model.hpp(40): error C2631: 'OptimalPiecewiseLinearModel': a class or enum cannot be defined in an alias template
../include\pgm/pgm_index.hpp(24): error C2143: syntax error: missing ';' before '{'
../include\pgm/pgm_index.hpp(24): error C2447: '{': missing function header (old-style formal list?)
simple.cpp(24): error C2039: 'PGMIndex': is not a member of 'pgm'
C:\cygwin\tmp\PGM-index\include\pgm\piecewise_linear_model.hpp(32): note: see declaration of 'pgm'
simple.cpp(24): error C2065: 'PGMIndex': undeclared identifier
simple.cpp(24): error C2062: type 'int' unexpected
simple.cpp(28): error C2065: 'index': undeclared identifier
simple.cpp(31): error C2672: 'lower_bound': no matching overloaded function found
simple.cpp(31): error C2893: Failed to specialize function template '_FwdIt std::lower_bound(_FwdIt,_FwdIt,const _Ty &)'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\xutility(5871): note: see declaration of 'std::lower_bound'
simple.cpp(31): note: With the following template arguments:
simple.cpp(31): note: '_FwdIt=auto'
simple.cpp(31): note: '_Ty=auto'
simple.cpp(31): error C2780: '_FwdIt std::lower_bound(_FwdIt,const _FwdIt,const _Ty &,_Pr)': expects 4 arguments - 3 provided
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\xutility(5849): note: see declaration of 'std::lower_bound'
simple.cpp(35): fatal error C1004: unexpected end-of-file found
@gvinciguerra gvinciguerra added the enhancement New feature or request label Mar 26, 2021
@zeqi2000
Copy link

zeqi2000 commented Jan 6, 2023

问题出在vs,其不支持__int128关键字,换clion+mingw gcc64即可

@e4lam
Copy link
Author

e4lam commented Jan 6, 2023

Yeah, but Visual Studio C++ is my preferred compiler. I'm actually a bit surprised at the use of __int128 since most (or all?) processors don't have native support for them which would make their use slow. Perhaps I didn't read the paper carefully enough but I didn't see any reasons why there should be this requirement for availability of 128-bit integral operations?

PS. Sorry, don't have time to dig through the code as this was more of a passing curiosity

@zeqi2000
Copy link

zeqi2000 commented Jan 6, 2023

Yes, the windows environment has poor support for int128, but the linux environment can support int128.

ps,I still haven't figured out why they have to use int128

@gvinciguerra
Copy link
Owner

The index construction algorithm uses int128 when the input keys are 64-bit ints. Indeed, at some point, it computes a product between two ints whose result may thus take up to 128 bits. If the input keys are int32s instead, int128 will not be used.

About the support for int128 in Visual Studio there's this feature suggestion.

@e4lam
Copy link
Author

e4lam commented Jan 6, 2023

@gvinciguerra Perhaps 64-bit input keys can be disabled when compiling on MSVC? Not sure how useful that would be though

@brechtsanders
Copy link

I just wanted to let you guys know that native Windows 64-bit build does work with MinGW-w64.

You can find my build instructions at: https://github.com/brechtsanders/winlibs_recipes/blob/main/recipes/pgm-index.winlib

This uses mman port to Windows for which you can find my build instructions at: https://github.com/brechtsanders/winlibs_recipes/blob/main/recipes/mman-win32.winlib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants