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

[MSVC] LightGBM failed to build due to error C2039: 'invalid_argument': is not a member of 'std' with option /permissive- #6230

Closed
Zhaojun-Liu opened this issue Dec 12, 2023 · 2 comments · Fixed by #6232
Labels

Comments

@Zhaojun-Liu
Copy link
Contributor

Description

Recently, we updated the commit of LightGBM for RWC testing. It failed to build due to error C2039: 'invalid_argument': is not a member of 'std'. with option /permissive-. Could you please help look this issue? Thanks.

Reproducible example

Repro setps:

  1. Open VS2022 x64 Native Tools command.
  2. git clone https://github.com/microsoft/LightGBM F:\gitP\microsoft\LightGBM
  3. cd F:\gitP\microsoft\LightGBM
  4. Execute:
    CL.exe /c /IF:\gitP\microsoft\LightGBM\external_libs\eigen /IF:\gitP\microsoft\LightGBM\include /IF:\gitP\microsoft\LightGBM\tests\cpp_tests /nologo /W4 /WX- /diagnostics:column /MP /O2 /Ob2 /Oi /Ot /Oy /D _MBCS /D WIN32 /D _WINDOWS /D NDEBUG /D EIGEN_MPL2_ONLY /D EIGEN_DONT_PARALLELIZE /D USE_SOCKET /D WIN_HAS_INET_PTON /D "CMAKE_INTDIR=\"Release\"" /Gm- /EHsc /MT /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /openmp /external:W4 /Gd /TP /errorReport:queue F:\gitP\microsoft\LightGBM\src\io\dataset_loader.cpp /permissive-

Actual result:

F:\gitP\microsoft\LightGBM\include\LightGBM\arrow.tpp(184,18): error C2039: 'invalid_argument': is not a member of 'std'
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.38.33130\include\vector(25,1): note: see declaration of 'std'
F:\gitP\microsoft\LightGBM\include\LightGBM\arrow.tpp(16,45): note: This diagnostic occurred in the compiler generated function 'std::function<T(const ArrowArray *,size_t)> LightGBM::get_index_accessor(const char *)'

Note:
I found that add #include <stdexcept> to https://github.com/microsoft/LightGBM/blob/master/include/LightGBM/arrow.h can solve this issue.

Environment info

LightGBM version or commit hash: 522f0f0

Command(s) you used to install LightGBM

Additional Comments

@jameslamb
Copy link
Collaborator

Thanks for using LightGBM.

for RWC testing

What is "RWC"?

with option /permissive-

We don't currently pass /permissive- in this project's MSVC builds by default, but based on https://learn.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance?view=msvc-170 it sounds like it could be helpful for improving the portability of the project's code. Thanks for noting that.

add #include <stdexcept> ... can solve this issue

If you feel you've identified a fix, please open a pull request and we'd be happy to review it. You can @ me for help with the contribution process if you need help.

@jameslamb jameslamb added the bug label Dec 12, 2023
@Zhaojun-Liu
Copy link
Contributor Author

Thanks for using LightGBM.

for RWC testing

What is "RWC"?

with option /permissive-

We don't currently pass /permissive- in this project's MSVC builds by default, but based on https://learn.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance?view=msvc-170 it sounds like it could be helpful for improving the portability of the project's code. Thanks for noting that.

add #include <stdexcept> ... can solve this issue

If you feel you've identified a fix, please open a pull request and we'd be happy to review it. You can @ me for help with the contribution process if you need help.

RWC testing means Real World Code testing.

I submitted a PR #6232, could you please help review and approval it? Thanks. @jameslamb

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

Successfully merging a pull request may close this issue.

2 participants