← All tasks
cpplightgbm-org/LightGBM #6448Not a task: already works

CMake `__BUILD_FOR_R` fails to find R source files

envgap__lightgbm-org__LightGBM-6448

01 / FAILURE SIGNATURE

As reported upstream

CMake Error: Error: generator : MSYS Makefiles
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
69b5bd311ddaae1ee1877735b1a6bf4e8b823231
Manifest
CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

lightgbm-org/LightGBM #6448 · read the original issue
The CMake build has an option to build for R which was working some versions ago, at least under windows:

https://github.com/microsoft/LightGBM/blob/6e78e697f8e27d4bbf493a0ebd9134c3254a2ecd/CMakeLists.txt#L23



Building with this option by calling `cmake` directly with `-D__BUILD_FOR_R=1 -DCMAKE_R_VERSION=<version>` without using the `build_r.R` script is not working anymore, since it assumes that the R package files are under the same directory as the rest of the source files:

```

CMake Error at CMakeLists.txt:358 (add_library):

  Cannot find source file:



    src/lightgbm_R.cpp



  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm

  .ccm .cxxm .c++m .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90

  .f95 .f03 .hip .ispc





CMake Error at CMakeLists.txt:358 (add_library):

  No SOURCES given to target: _lightgbm





CMake Generate step failed.  Build files cannot be regenerated correctly.

```



Building with the latest MSVC using the CI script `build_r.R` under the VS developer console is not working either, since it doesn't recognize all the installed versions - for example, if I use vs2022 in windows 10, I get this error as it tries to look for a windows 8.1 version (note that this doesn't happen when calling `cmake` directly):

```

installing via 'install.libs.R' to C:/Users/david/AppData/Local/R/win-library/4.3/00LOCK-lightgbm/00new/lightgbm

Trying 'Visual Studio 16 2019'

-- Configuring incomplete, errors occurred!

CMake Error at CMakeLists.txt:33 (PROJECT):

See also "C:/Users/david/AppData/Local/Temp/Rtmpk3gflg/R.INSTALLafc1e183436/lightgbm/src/build/CMakeFiles/CMakeOutput.log".

  Generator



    Visual Studio 16 2019



  could not find any instance of Visual Studio.







Trying 'Visual Studio 15 2017'

-- Configuring incomplete, errors occurred!

CMake Error at CMakeLists.txt:33 (PROJECT):

See also "C:/Users/david/AppData/Local/Temp/Rtmpk3gflg/R.INSTALLafc1e183436/lightgbm/src/build/CMakeFiles/CMakeOutput.log".

  Generator



    Visual Studio 15 2017



  could not find any instance of Visual Studio.







Trying 'Visual Studio 14 2015'

-- Configuring incomplete, errors occurred!

CMake Error at CMakeLists.txt:33 (PROJECT):

See also "C:/Users/david/AppData/Local/Temp/Rtmpk3gflg/R.INSTALLafc1e183436/lightgbm/src/build/CMakeFiles/CMakeOutput.log".

  Failed to run MSBuild command:



    MSBuild.exe



  to get the value of VCTargetsPath:



    MSBuild version 17.9.8+b34f75857 for .NET Framework

    Build started 5/6/2024 7:21:50 PM.



    Project "C:\Users\david\AppData\Local\Temp\Rtmpk3gflg\R.INSTALLafc1e183436\lightgbm\src\build\CMakeFiles\3.24.3\VCTargetsPath.vcxproj" on node 1 (default targets).

    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\x64\PlatformToolsets\v140\Toolset.targets(36,5): error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:\Users\david\AppData\Local\Temp\Rtmpk3gflg\R.INSTALLafc1e183436\lightgbm\src\build\CMakeFiles\3.24.3\VCTargetsPath.vcxproj]

    Done Building Project "C:\Users\david\AppData\Local\Temp\Rtmpk3gflg\R.INSTALLafc1e183436\lightgbm\src\build\CMakeFiles\3.24.3\VCTargetsPath.vcxproj" (default targets) -- FAILED.



    Build FAILED.



    "C:\Users\david\AppData\Local\Temp\Rtmpk3gflg\R.INSTALLafc1e183436\lightgbm\src\build\CMakeFiles\3.24.3\VCTargetsPath.vcxproj" (default target) (1) ->

    (Desktop_PlatformPrepareForBuild target) ->

      C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\x64\PlatformToolsets\v140\Toolset.targets(36,5): error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:\Users\david\AppData\Local\Temp\Rtmpk3gflg\R.INSTALLafc1e183436\lightgbm\src\build\CMakeFiles\3.24.3\VCTargetsPath.vcxproj]



        0 Warning(s)

        1 Error(s)



    Time Elapsed 00:00:00Warning in eval(ei, envir) :.15





  Exit code: 1









  Building with Visual Studio failed. Attempting with MSYS2

CMake Error: Error: generator : MSYS Makefiles

Does not match the generator used previously: Visual Studio 14 2015

Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.

CMake Error: Error: generator : MSYS Makefiles

Does not match the generator used previously: Visual Studio 14 2015

Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.

Error in .run_shell_command("cmake", c(cmake_args, "..")) :

  Command failed with exit code: 1

* removing 'C:/Users/david/AppData/Local/R/win-library/4.3/lightgbm'

Error in .run_shell_command(install_cmd, install_args) :

  Command failed with exit code: 1

Execution halted

```
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]