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

[DO NOT MERGE] Release v3.3.3 #5525

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .appveyor.yml
@@ -1,4 +1,4 @@
version: 3.3.2.99.{build}
version: 3.3.3.{build}

image: Visual Studio 2015
platform: x64
Expand Down
12 changes: 7 additions & 5 deletions .ci/test_r_package_windows.ps1
Expand Up @@ -54,11 +54,13 @@ Remove-From-Path ".*PostgreSQL.*"
Remove-From-Path ".*\\R\\.*"
Remove-From-Path ".*R Client.*"
Remove-From-Path ".*rtools40.*"
Remove-From-Path ".*rtools42.*"
Remove-From-Path ".*shells.*"
Remove-From-Path ".*Strawberry.*"
Remove-From-Path ".*tools.*"

Remove-Item C:\rtools40 -Force -Recurse -ErrorAction Ignore
Remove-Item C:\rtools42 -Force -Recurse -ErrorAction Ignore

# Get details needed for installing R components
#
Expand All @@ -74,11 +76,11 @@ if ($env:R_MAJOR_VERSION -eq "3") {
$env:RTOOLS_EXE_FILE = "rtools35-x86_64.exe"
$env:R_WINDOWS_VERSION = "3.6.3"
} elseif ($env:R_MAJOR_VERSION -eq "4") {
$RTOOLS_INSTALL_PATH = "C:\rtools40"
$RTOOLS_INSTALL_PATH = "C:\rtools42"
$env:RTOOLS_BIN = "$RTOOLS_INSTALL_PATH\usr\bin"
$env:RTOOLS_MINGW_BIN = "$RTOOLS_INSTALL_PATH\mingw64\bin"
$env:RTOOLS_EXE_FILE = "rtools40v2-x86_64.exe"
$env:R_WINDOWS_VERSION = "4.1.3"
$env:RTOOLS_MINGW_BIN = "$RTOOLS_INSTALL_PATH\x86_64-w64-mingw32.static.posix\bin"
$env:RTOOLS_EXE_FILE = "rtools42-5253-5107.exe"
$env:R_WINDOWS_VERSION = "4.2.1"
} else {
Write-Output "[ERROR] Unrecognized R version: $env:R_VERSION"
Check-Output $false
Expand Down Expand Up @@ -147,7 +149,7 @@ Write-Output "Building R package"
# R CMD check is not used for MSVC builds
if ($env:COMPILER -ne "MSVC") {

$PKG_FILE_NAME = "lightgbm_*.tar.gz"
$PKG_FILE_NAME = "lightgbm_$env:LGB_VER.tar.gz"
$LOG_FILE_NAME = "lightgbm.Rcheck/00check.log"

if ($env:R_BUILD_TYPE -eq "cmake") {
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/cuda.yml
Expand Up @@ -37,17 +37,17 @@ jobs:
compiler: gcc
python_version: "3.10"
cuda_version: "9.0"
task: cuda
- method: source
compiler: gcc
python_version: "3.8"
cuda_version: "11.7.1"
task: cuda_exp
- method: pip
compiler: clang
python_version: "3.9"
cuda_version: "10.0"
task: cuda_exp
# task: cuda
# - method: source
# compiler: gcc
# python_version: "3.8"
# cuda_version: "11.7.1"
# task: cuda_exp
# - method: pip
# compiler: clang
# python_version: "3.9"
# cuda_version: "10.0"
# task: cuda_exp
steps:
- name: Setup or update software on host machine
run: |
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/r_package.yml
Expand Up @@ -83,7 +83,7 @@ jobs:
task: r-package
compiler: MINGW
toolchain: MSYS
r_version: 4.1
r_version: 4.2
build_type: cmake
# Visual Studio 2019
- os: windows-2019
Expand All @@ -97,7 +97,7 @@ jobs:
task: r-package
compiler: MSVC
toolchain: MSVC
r_version: 4.1
r_version: 4.2
build_type: cmake
###############
# CRAN builds #
Expand All @@ -112,7 +112,7 @@ jobs:
task: r-package
compiler: MINGW
toolchain: MSYS
r_version: 4.1
r_version: 4.2
build_type: cran
- os: ubuntu-latest
task: r-package
Expand Down Expand Up @@ -166,6 +166,7 @@ jobs:
shell: pwsh -command ". {0}"
run: |
$env:BUILD_SOURCESDIRECTORY = $env:GITHUB_WORKSPACE
$env:LGB_VER = (Get-Content -TotalCount 1 $env:BUILD_SOURCESDIRECTORY\VERSION.txt).trim().replace('rc', '-')
$env:TOOLCHAIN = "${{ matrix.toolchain }}"
$env:R_VERSION = "${{ matrix.r_version }}"
$env:R_BUILD_TYPE = "${{ matrix.build_type }}"
Expand Down
10 changes: 6 additions & 4 deletions .readthedocs.yaml
@@ -1,10 +1,12 @@
version: 2
build:
os: "ubuntu-20.04"
tools:
python: "miniconda3-4.7"
conda:
environment: docs/env.yml
formats:
- pdf
python:
version: 3
install:
- requirements: docs/requirements.txt
sphinx:
builder: html
configuration: docs/conf.py
Expand Down
12 changes: 12 additions & 0 deletions CMakeLists.txt
Expand Up @@ -299,6 +299,18 @@ if(WIN32 AND MINGW)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++")
endif()

# Check if inet_pton is already available, to avoid conflicts with the implementation in LightGBM.
# As of 2022, MinGW started including a definition of inet_pton.
if(WIN32)
include(CheckSymbolExists)
list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32")
check_symbol_exists(inet_pton "ws2tcpip.h" WIN_INET_PTON_FOUND)
if(WIN_INET_PTON_FOUND)
add_definitions(-DWIN_HAS_INET_PTON)
endif()
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "ws2_32")
endif()

if(MSVC)
SET(variables
CMAKE_C_FLAGS_DEBUG
Expand Down
5 changes: 5 additions & 0 deletions R-package/README.md
Expand Up @@ -94,13 +94,18 @@ After installing `Rtools` and `CMake`, be sure the following paths are added to
- If you have `Rtools` 4.0, example:
- `C:\rtools40\mingw64\bin`
- `C:\rtools40\usr\bin`
- If you have `Rtools` 4.2, example:
- `C:\rtools42\x86_64-w64-mingw32.static.posix\bin`
- `C:\rtools42\usr\bin`
* `CMake`
- example: `C:\Program Files\CMake\bin`
* `R`
- example: `C:\Program Files\R\R-3.6.1\bin`

NOTE: Two `Rtools` paths are required from `Rtools` 4.0 onwards because paths and the list of included software was changed in `Rtools` 4.0.

NOTE: `Rtools42` takes a very different approach to the compiler toolchain than previous releases, and how you install it changes what is required to build packages. See ["Howto: Building R 4.2 and packages on Windows"](https://cran.r-project.org/bin/windows/base/howto-R-4.2.html).

#### Windows Toolchain Options

A "toolchain" refers to the collection of software used to build the library. The R package can be built with three different toolchains.
Expand Down
18 changes: 9 additions & 9 deletions R-package/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for lightgbm 3.3.2.
# Generated by GNU Autoconf 2.69 for lightgbm 3.3.3.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -576,8 +576,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='lightgbm'
PACKAGE_TARNAME='lightgbm'
PACKAGE_VERSION='3.3.2'
PACKAGE_STRING='lightgbm 3.3.2'
PACKAGE_VERSION='3.3.3'
PACKAGE_STRING='lightgbm 3.3.3'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Expand Down Expand Up @@ -1182,7 +1182,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures lightgbm 3.3.2 to adapt to many kinds of systems.
\`configure' configures lightgbm 3.3.3 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

Expand Down Expand Up @@ -1244,7 +1244,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of lightgbm 3.3.2:";;
short | recursive ) echo "Configuration of lightgbm 3.3.3:";;
esac
cat <<\_ACEOF

Expand Down Expand Up @@ -1311,7 +1311,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
lightgbm configure 3.3.2
lightgbm configure 3.3.3
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
Expand All @@ -1328,7 +1328,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by lightgbm $as_me 3.3.2, which was
It was created by lightgbm $as_me 3.3.3, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ $0 $@
Expand Down Expand Up @@ -2398,7 +2398,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by lightgbm $as_me 3.3.2, which was
This file was extended by lightgbm $as_me 3.3.3, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -2451,7 +2451,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
lightgbm config.status 3.3.2
lightgbm config.status 3.3.3
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

Expand Down
25 changes: 25 additions & 0 deletions R-package/configure.win
Expand Up @@ -66,6 +66,31 @@ then
LGB_CPPFLAGS="${LGB_CPPFLAGS} -DMM_MALLOC=1"
fi

#############
# INET_PTON #
#############

ac_inet_pton="no"

cat > conftest.cpp <<EOL
#include <ws2tcpip.h>
int main() {
int (*fptr)(int, const char*, void*);
fptr = &inet_pton;
return 0;
}
EOL

${CXX} ${CXXFLAGS} ${CPPFLAGS} -o conftest conftest.cpp 2>/dev/null && ./conftest && ac_inet_pton="yes"
rm -f ./conftest
rm -f ./conftest.cpp
echo "checking whether INET_PTON works...${ac_inet_pton}"

if test "${ac_inet_pton}" = "yes";
then
LGB_CPPFLAGS="${LGB_CPPFLAGS} -DWIN_HAS_INET_PTON=1"
fi

# Generate Makevars.win from Makevars.win.in
sed -e \
"s/@LGB_CPPFLAGS@/$LGB_CPPFLAGS/" \
Expand Down
25 changes: 14 additions & 11 deletions R-package/src/install.libs.R
@@ -1,5 +1,6 @@
# User options
use_gpu <- FALSE
make_args_from_build_script <- character(0L)

# For Windows, the package will be built with Visual Studio
# unless you set one of these to TRUE
Expand All @@ -22,6 +23,11 @@ if (!(R_int_UUID == "0310d4b8-ccb1-4bb8-ba94-d36a55f60262"
warning("Warning: unmatched R_INTERNALS_UUID, may not run normally.")
}

# Get some paths
source_dir <- file.path(R_PACKAGE_SOURCE, "src", fsep = "/")
build_dir <- file.path(source_dir, "build", fsep = "/")
inst_dir <- file.path(R_PACKAGE_SOURCE, "inst", fsep = "/")

# system() will not raise an R exception if the process called
# fails. Wrapping it here to get that behavior.
#
Expand All @@ -31,7 +37,7 @@ if (!(R_int_UUID == "0310d4b8-ccb1-4bb8-ba94-d36a55f60262"
on_windows <- .Platform$OS.type == "windows"
has_processx <- suppressMessages({
suppressWarnings({
require("processx") # nolint
require("processx") # nolint: undesirable_function
})
})
if (has_processx && on_windows) {
Expand Down Expand Up @@ -64,7 +70,8 @@ if (!(R_int_UUID == "0310d4b8-ccb1-4bb8-ba94-d36a55f60262"
# try to generate Visual Studio build files
.generate_vs_makefiles <- function(cmake_args) {
vs_versions <- c(
"Visual Studio 16 2019"
"Visual Studio 17 2022"
, "Visual Studio 16 2019"
, "Visual Studio 15 2017"
, "Visual Studio 14 2015"
)
Expand Down Expand Up @@ -94,18 +101,14 @@ if (!(R_int_UUID == "0310d4b8-ccb1-4bb8-ba94-d36a55f60262"

# Move in CMakeLists.txt
write_succeeded <- file.copy(
"../inst/bin/CMakeLists.txt"
file.path(inst_dir, "bin", "CMakeLists.txt")
, "CMakeLists.txt"
, overwrite = TRUE
)
if (!write_succeeded) {
stop("Copying CMakeLists.txt failed")
}

# Get some paths
source_dir <- file.path(R_PACKAGE_SOURCE, "src", fsep = "/")
build_dir <- file.path(source_dir, "build", fsep = "/")

# Prepare building package
dir.create(
build_dir
Expand All @@ -120,7 +123,7 @@ use_visual_studio <- !(use_mingw || use_msys2)
# to create R.def from R.dll
if (WINDOWS && use_visual_studio) {
write_succeeded <- file.copy(
"../../inst/make-r-def.R"
file.path(inst_dir, "make-r-def.R")
, file.path(build_dir, "make-r-def.R")
, overwrite = TRUE
)
Expand All @@ -132,7 +135,7 @@ if (WINDOWS && use_visual_studio) {
# Prepare installation steps
cmake_args <- NULL
build_cmd <- "make"
build_args <- "_lightgbm"
build_args <- c("_lightgbm", make_args_from_build_script)
lib_folder <- file.path(source_dir, fsep = "/")

# add in command-line arguments
Expand Down Expand Up @@ -194,7 +197,7 @@ if (WINDOWS) {
cmake_args <- c(cmake_args, "-G", shQuote(windows_makefile_generator))
.run_shell_command("cmake", c(cmake_args, ".."), strict = FALSE)
build_cmd <- windows_build_tool
build_args <- "_lightgbm"
build_args <- c("_lightgbm", make_args_from_build_script)
} else {
visual_studio_succeeded <- .generate_vs_makefiles(cmake_args)
if (!isTRUE(visual_studio_succeeded)) {
Expand All @@ -203,7 +206,7 @@ if (WINDOWS) {
cmake_args <- c(cmake_args, "-G", shQuote(windows_makefile_generator))
.run_shell_command("cmake", c(cmake_args, ".."), strict = FALSE)
build_cmd <- windows_build_tool
build_args <- "_lightgbm"
build_args <- c("_lightgbm", make_args_from_build_script)
} else {
build_cmd <- "cmake"
build_args <- c("--build", ".", "--target", "_lightgbm", "--config", "Release")
Expand Down
13 changes: 12 additions & 1 deletion R-package/tests/testthat/test_basic.R
Expand Up @@ -1251,7 +1251,18 @@ test_that("lgb.train() supports non-ASCII feature names", {
data = matrix(rnorm(400L), ncol = 4L)
, label = rnorm(100L)
)
feature_names <- c("F_零", "F_一", "F_二", "F_三")
# content below is equivalent to
#
# feature_names <- c("F_零", "F_一", "F_二", "F_三")
#
# but using rawToChar() to avoid weird issues when {testthat}
# sources files and converts their encodings prior to evaluating the code
feature_names <- c(
rawToChar(as.raw(c(0x46, 0x5f, 0xe9, 0x9b, 0xb6)))
, rawToChar(as.raw(c(0x46, 0x5f, 0xe4, 0xb8, 0x80)))
, rawToChar(as.raw(c(0x46, 0x5f, 0xe4, 0xba, 0x8c)))
, rawToChar(as.raw(c(0x46, 0x5f, 0xe4, 0xb8, 0x89)))
)
bst <- lgb.train(
data = dtrain
, nrounds = 5L
Expand Down
4 changes: 4 additions & 0 deletions R-package/tests/testthat/test_dataset.R
Expand Up @@ -247,6 +247,10 @@ test_that("lgb.Dataset: Dataset should be able to construct from matrix and retu
})

test_that("cpp errors should be raised as proper R errors", {
testthat::skip_if(
Sys.getenv("COMPILER", "") == "MSVC"
, message = "Skipping on Visual Studio"
)
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
@@ -1 +1 @@
3.3.2
3.3.3