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

[R-package] CMake errors in MinGW builds on Windows #3060

Closed
jameslamb opened this issue May 9, 2020 · 6 comments
Closed

[R-package] CMake errors in MinGW builds on Windows #3060

jameslamb opened this issue May 9, 2020 · 6 comments

Comments

@jameslamb
Copy link
Collaborator

See the most recent build on master. There are some errors being generated when building the R package using MinGW. This isn't causing any user-facing issues as far as I know, since it doesn't cause installation to fail, but we should fix these warnings so that they don't waste users' time or lead to unnecessary bug reports.

installing via 'install.libs.R' to C:/projects/lightgbm/lightgbm.Rcheck/00LOCK-lightgbm/00new/lightgbm
[1] "Trying to build with MinGW"
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.16/Modules/CMakeMinGWFindMake.cmake:12 (message):
...
...
...
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

This StackOverflow post suggested that maybe putting MinGW on PATH can fix this but so far I haven't had luck with it.

@jameslamb
Copy link
Collaborator Author

I just tried removing the extra mingw on PATH, per #2965 (comment), and I don't think that solved it.

You can see the changes I made at https://github.com/jameslamb/LightGBM/pull/23/files and the corresponding build in AppVeyor at https://ci.appveyor.com/project/jameslamb/lightgbm/builds/32764241/job/cve3wk1f8obtw6q5

image

@jameslamb
Copy link
Collaborator Author

I found one StackOverflow answer suggesting that the message can be suppressed by installing mingw32-base.

Just to test, I installed mingw-get-setup.exe and used it to install mingw-base. Even after doing that and adding C:\MinGW\bin to PATH (and restarting my shell), the error is still there.

@Laurae2
Copy link
Contributor

Laurae2 commented May 10, 2020

cmake has a one time stopper if it finds any sh.exe in PATH, specifically it has an hardcoded MinGW one time stopper in cmake (intentional known issue on cmake end).

To circumvent it, cmake has to be ran twice. It keeps in cache the previous cmake run hence should not introduce major slowdown, however for users it will print a lot of unnecessary text and an unnecessary cmake error.

There is currently no workaround other than having a very recent cmake version. See the following cmake commit which lifts the one time stopper: https://gitlab.kitware.com/cmake/cmake/-/commit/82ddcf0db1d220564145122c3cce25d25ee0e254 (Nov 2, 2019).

(I could document better the workaround/reason here: 3421bc6#diff-473c89bfc9641f554ac12d37ebc3d377R61) + link to #664 (comment)

@jameslamb
Copy link
Collaborator Author

Thanks very much for the extra context! I saw comments in the code about running cmake -G twice for MinGW, but I didn't make the connection between that and the error messages mentioned in this issue.

I think we could close this issue just by adding a note to the R FAQs telling people they can safely ignore the errors https://lightgbm.readthedocs.io/en/latest/FAQ.html#r-package

@StrikerRUS
Copy link
Collaborator

Closed via #3078.

ChipKerchner pushed a commit to ChipKerchner/LightGBM that referenced this issue Jun 10, 2020
ChipKerchner pushed a commit to ChipKerchner/LightGBM that referenced this issue Jun 11, 2020
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants