-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Pybind fails to build with MSVC 19.16 in C++17 mode #2089
Comments
I can't reproduce this with pybind 2.5.0, Python 3.8, and MSVC 19.25.28614.0:
So let's assume things got fixed in 2.5.0 or a newer MSVC version? I don't think it's worth it to go retracing what actually went wrong and we're cleaning up the issues, so I'm closing this. But please reopen if this is still an issue! |
Thanks for checking this @YannickJadoul ! I tested it with 2.5.0, but unfortunately the same error occurs in C++17 mode. Still works in C++14. I see from your log you used Visual Studio 2019, MSVC MSVC 19.25, so looks like the compiler is the difference. The compiler I used: MSVC 19.16, is shipped with Visual Studio 2017, which is still the "main-line" for a lot of people. I personally could overcome this problem, so for me it's OK to close the ticket. However I would consider trying to fix this, since VS 2017 is still widely used. It's up to you. |
Let's reopen this, but it might take some time before we can have a good look at this. |
Alright. Thanks for telling us! I'll see if I can find a VS 2017 installation, and I'll try again! :-) |
@LeslieGerman Still can't reproduce with VS 2017 (MSVC 19.16.27041.0). Both with 32-bit and Python 3.7, as well as with 64-bit and Python 3.8 (these just happen to be the Python architecture versions I have installed on the Windows machine):
Can you reproduce, and give more details about the error (i.e., not just the 6 lines from your original post, but the full log, including where the occur, and what else the compiler says about it) ? |
@YannickJadoul , huh, strange! I re-tested it again, and here's the full log: 64 bit Windows, cmake and ninja used from VS 2017, pybind 2.5.0, python 3.6.10
Exactly the same error with python 3.6.10, 3.7.6, 3.8.3. |
I tried with "Visual Studio 15 2017 Win64" generator, too, but it produced the same error: 64 bit Windows, pybind 2.5.0, python 3.6.10
I did NOT try with 32 bit compiler and 32 bit python... |
Thanks! :-) Let's see if the full errors make sense, now!
Don't, it's fine like this. Both worked for me. |
Oh, something else. Have you tried updating VS? It's probably not going to be that, but ... |
I think I've seen this before. If I recall correctly, a workaround is adding an empty docstring. Try something like this: |
But it's in pybind11's own tests? So if I can't reproduce, there's a difference between @LeslieGerman's MSVC 19.16.27038.0 and my MSVC 19.16.27041.0?
Or ditching a broken compiler and an environment/OS that demonstrates again and again it's really not made for development? ;-) |
Hooooooold your horses. Running that build again with |
OK. Reproduced. So some weird compiler thing we'll have to make a workaround for? Thanks for holding on, @LeslieGerman! EDIT: I reproduced by putting |
You are welcome! 😄 |
@LeslieGerman, this issue is only triggered without |
@YannickJadoul , the ideal would be that pybind (and the tests) could be compiled both with I think lots of people does not use |
@LeslieGerman, we were planning to add it to pybind11's CMake by default (but I didn't get to that yet), but we didn't find a maintainer willing to maintain support for the compiler if it doesn't comply to the standard. Also, this is only from C++17 (C++14 still works without I'm open to other arguments, but it's frustrating to chase problems and work around things that aren't specified in the standard. For example, this error: I don't even know why MSVC doesn't manage to compile the template without If someone wants to submit a PR to fix something, and the PR is something local that doesn't hinder the other compilers, I'm pretty sure it will be easily accepted. If you feel called, please do ;-) |
Note: from what I understand, this works fine in VS 2019 as is? I'm not sure I'd trust a compiler that came out in 2017 to support a language revision that was finished late 2017. |
Last I checked: no, it doesn't, because without |
Scratch that, sorry. Once again, you're completely correct, @henryiii! As far as I can confirm, only VS 2017 (or MSVC 14.1x / 19.1x ¹), C++17, without (Again, unless some MSVC user is eager to find how to fix that bug in VS 2017 C++17 mode and is willing to provide a patch?) ¹ Even with this glorious Wikipedia page, I'm confused. These are the version numbes CMake gave me:
|
Corollary: That does mean that currently, we still seem to be supporting MSVC foo.bar.baz.qux.xyzzy (the one from VS 2019), without requiring Should we officially support that, or follow MS themselves in considering |
MSVC 2019 supports C++17 just fine with no changes, we are now testing that in GHA. We should add a note to the docs that MSVC 2017 can build and pass our test suite in C++17 mode with |
Agreed. I'll rework my investigating PR to add a note to the docs. But I would nót add it by default, then! @LeslieGerman, @bstaletic, is that something you can live with? |
Absolutely.
According to cppreference, Though pybind isn't the first library that I've used that doesn't work with MSC 19.14 and C++17 - GTest was the other. |
|
I'm going to reopen this so I don't forget making that PR that updates the docs. |
I agree, @henryiii is right about the C++17 compiler support. Guys, it's awesome how much care and work you put into this issue I reported - I did not hope this 😄 |
Thanks, @LeslieGerman! :-) And thanks for sticking along and trying out all these things so we could debug! |
Fails to build with MSVC 19.16.27034.0 in C++17
I used pybind v 2.4.3
Error:
No problem with the default c++14 mode.
Great library, BTW! 😃 👍
The text was updated successfully, but these errors were encountered: