-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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] use C++ compiler for pre-compile checks on Windows #4504
Conversation
I'm seeing several errors in CI today about connecting to GitHub. For example, from an R package job: https://github.com/microsoft/LightGBM/pull/4504/checks?check_run_id=3282998279
And a Python-package job: https://github.com/microsoft/LightGBM/pull/4504/checks?check_run_id=3282997602
It does not seem like there were any incidents on GitHub today (https://www.githubstatus.com/history). Azure is not reporting any recent incidents either (https://status.azure.com/en-us/status/history/). I'm not sure what's happening :/ |
/gha run r-solaris Workflow Solaris CRAN check has been triggered! 🚀 solaris-x86-patched: https://builder.r-hub.io/status/lightgbm_3.2.1.99.tar.gz-8fbce35a96824fd9bc025ca6079ab602 |
/gha run r-valgrind Workflow R valgrind tests has been triggered! 🚀 Status: failure ❌. |
/gha run r-valgrind Workflow R valgrind tests has been triggered! 🚀 Status: success ✔️. |
Just pushed 4884a69, adding |
Installing |
Should we add |
I think so, yeah. I'll be away from my computer for a few hours. You can push a commit here directly if you'd like, otherwise I'll do it later tonight. |
Added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good sign in Windows jobs!
checking whether MM_PREFETCH works...yes
checking whether MM_MALLOC works...yes
Please check two my questions about consistency with Unix version of configure
below
R-package/configure.win
Outdated
@@ -6,7 +6,9 @@ | |||
########################### | |||
|
|||
R_EXE="${R_HOME}/bin${R_ARCH_BIN}/R" | |||
CC=`"${R_EXE}" CMD config CC` | |||
CXX=`"${R_EXE}" CMD config CXX` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we use CXX11
for Unix and CXX
here to configure CXX
variable (considering #4506 as well)??
LightGBM/R-package/configure.ac
Line 24 in b43b6c7
CXX=`"${R_HOME}/bin/R" CMD config CXX11` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah! thanks for noticing, that is an oversight. It should be CXX11 since we explicitly set a C++ standard
CXX_STD = CXX11 |
From https://cran.r-project.org/doc/manuals/R-exts.html#Configure-and-cleanup
If the package specifies a non-default C++ standard, use the config variable names (such as
CXX17
) appropriate to the standard
From R's perspective, our use of C++ is "non-default". See https://cran.r-project.org/doc/manuals/R-exts.html#Using-C_002b_002b-code.
As from R 4.0.0 a C++ compiler will be selected only if it conforms to the 2011 standard (‘C++11’). A minor update43 (‘C++14’) was published in December 2014 and will be used by default as from R 4.1.0 if supported
updated in b576a4f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems we are setting less variables than it's done in the example from https://cran.r-project.org/doc/manuals/R-exts.html#Using-C_002b_002b-code.
CXX11=`"${R_EXE}" CMD config CXX11`
CXX11STD=`"${R_EXE}" CMD config CXX11STD`
CXX="${CXX11} ${CXX11STD}"
CXXFLAGS=`"${R_EXE}" CMD config CXX11FLAGS`
CPPFLAGS=`"${R_EXE}" CMD config CPPFLAGS`
Also note that CXX11FLAGS
is used to configure CXXFLAGS
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to find a similar code in the wild by searching for CXX11FLAGS filename:configure.ac
. For example,
https://github.com/cbg-ethz/MC-CBN/blob/6cd55b8289d22809a5029981f87cd1cbe5be27ea/configure.ac#L21-L38
https://github.com/cran/spp/blob/2603673566115871405f5842e489454805b9f5c0/configure.ac#L15-L22
https://github.com/akhikolla/ClusterTests/blob/1c7702ba4035511ffe7d4dd27e9021b6962718fe/BART/configure.ac#L19-L22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oooo interesting, I missed that! Thanks for pointing it out. I just made those changes here and on #4506 .
/gha run r-valgrind Workflow R valgrind tests has been triggered! 🚀 Status: success ✔️. |
/gha run r-solaris Workflow Solaris CRAN check has been triggered! 🚀 solaris-x86-patched: https://builder.r-hub.io/status/lightgbm_3.2.1.99.tar.gz-ffbce948622047e4a07e5e413fcbbb8d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for this PR! LGTM!
This pull request 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. |
Looking into #4131 as part of #4310, I've noticed some other areas for possible improvement in the
configure
andconfigure.win
scripts.This PR fixes one in
configure.win
. I noticed that the mm_prefetch and mm_malloc tests are being run with a C compiler on Windows. They should be done with a C++ compiler, as they are on Linux/MacLightGBM/R-package/configure.ac
Line 41 in 5fe27d5
and for all CMake-based builds
LightGBM/CMakeLists.txt
Line 253 in 5fe27d5
I'm not aware of any problems caused by the fact that these checks were being done by a C compiler, but a C++ compiler is going to be used for compiling
lib_lightgbm
.Notes for Reviewers
To understand the difference between
CXXFLAGS
andCPPFLAGS
and why they are both included, see the documentation fromR CMD config
.