-
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] gcc warning on CMake-based builds: 'cast between incompatible function types' #4273
Comments
Looking at build logs today, I see the following flags used. CRAN build /usr/local/bin/g++-10 \
-std=gnu++11 \
-I"/Library/Frameworks/R.framework/Resources/include" \
-DNDEBUG \
-I./include \
-DEIGEN_MPL2_ONLY \
-DMM_PREFETCH=1 \
-DMM_MALLOC=1 \
-DUSE_SOCKET \
-DLGB_R_BUILD \
-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk \
-I/usr/local/include \
-pthread \
-fPIC \
-Wall \
-g \
-O2 \
-c lightgbm_R.cpp \
-o lightgbm_R.o CMake-based I got these by adding a
I think the use of Lines 273 to 274 in 08d1ce4
reference: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html I think that this warning can safely be ignored for the R package specifically. The pattern used in I'll submit a pull request to suppress it. |
…nd MinGW builds (fixes microsoft#4273)
I think the issue here is that the functions are declared as C++ when they should be declared as extern C. |
Can you please clarify what leads you to believe that they are missing LightGBM/R-package/src/lightgbm_R.h Line 38 in 8937022
which, if I'm not mistaken, will end up adding LightGBM/include/LightGBM/export.h Lines 10 to 23 in d517ba1
What are we missing? |
My bad, it's not an issue with those then. Although in any case I'd also include the R headers in an an extern C block just in case. |
Actually, looking at the R headers in the latest version of R, there doesn't seem to be any need to declare them as extern C, and |
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. |
Description
Building the R package with
CMake
-based installation (https://github.com/microsoft/LightGBM/blob/master/R-package/README.md#install) andgcc
(orMINGW
on Windows results in the following compiler warnings:One such warning is generated for each entry in this list of routines:
LightGBM/R-package/src/lightgbm_R.cpp
Line 684 in 08d1ce4
Reproducible example
Follow https://github.com/microsoft/LightGBM/blob/master/R-package/README.md#install, using
gcc
on Mac or Linux, or MinGW on Windows.This warning does not appear to show up when using
MSVC
orclang
.This warning does not appear when using the CRAN-based installation method (https://github.com/microsoft/LightGBM/blob/master/R-package/README.md#installing-the-cran-package).
I've observed this warning with
gcc
10, on both R 3.6.3 and R 4.0.5.Additional Comments
.cc
or.cpp
) instead of a CC source file (.c
) do thisThe text was updated successfully, but these errors were encountered: