Skip to content

Commit ab36e96

Browse files
authored
fix: pypi packaging issues (#65)
* fix: align cmake flags * require macos15 * fix xgb version for compatibaility
1 parent 0ffea2c commit ab36e96

2 files changed

Lines changed: 41 additions & 12 deletions

File tree

‎scripts/install_deps.sh‎

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,21 @@ install_zstd() {
121121
# Install XGBoost from source
122122
install_xgboost() {
123123
log_info "Installing XGBoost from source..."
124+
# Pinned, not tracking master: XGBoost removed the deprecated XGBoosterPredict
125+
# after v3.3.0, and libCacheSim's GLCache/inference.c still calls it, so a clone
126+
# of master fails to compile with "implicit declaration of function". v3.3.0 is
127+
# also what Homebrew installs, so the Linux and macOS wheels build against the
128+
# same API. The directory carries the version so a checkout left in /tmp by an
129+
# older run of this script is not silently reused.
130+
local xgboost_version="v3.3.0"
131+
local xgboost_dir="xgboost-${xgboost_version}"
132+
124133
pushd /tmp/ >/dev/null
125-
if [[ ! -d "xgboost" ]]; then
126-
git clone --recursive https://github.com/dmlc/xgboost
134+
if [[ ! -d "${xgboost_dir}" ]]; then
135+
git clone --recursive --depth 1 --branch "${xgboost_version}" \
136+
https://github.com/dmlc/xgboost "${xgboost_dir}"
127137
fi
128-
pushd xgboost >/dev/null
138+
pushd "${xgboost_dir}" >/dev/null
129139
mkdir -p build
130140
pushd build >/dev/null
131141
cmake -G Ninja ..
@@ -139,11 +149,18 @@ install_xgboost() {
139149
# Install LightGBM from source
140150
install_lightgbm() {
141151
log_info "Installing LightGBM from source..."
152+
# Pinned for the same reason as XGBoost above -- an unpinned clone means the
153+
# build depends on whatever master happens to be that day. v4.7.0 matches the
154+
# version Homebrew installs for the macOS wheels.
155+
local lightgbm_version="v4.7.0"
156+
local lightgbm_dir="LightGBM-${lightgbm_version}"
157+
142158
pushd /tmp/ >/dev/null
143-
if [[ ! -d "LightGBM" ]]; then
144-
git clone --recursive https://github.com/microsoft/LightGBM
159+
if [[ ! -d "${lightgbm_dir}" ]]; then
160+
git clone --recursive --depth 1 --branch "${lightgbm_version}" \
161+
https://github.com/microsoft/LightGBM "${lightgbm_dir}"
145162
fi
146-
pushd LightGBM >/dev/null
163+
pushd "${lightgbm_dir}" >/dev/null
147164
mkdir -p build
148165
pushd build >/dev/null
149166
cmake -G Ninja ..

‎scripts/install_deps_user.sh‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,22 @@ EOF
236236
install_xgboost() {
237237
log_step "Installing XGBoost..."
238238

239+
# Pinned rather than tracking master: XGBoost removed the deprecated
240+
# XGBoosterPredict after v3.3.0, which libCacheSim's GLCache/inference.c still
241+
# calls, so master no longer compiles. See install_deps.sh for the full note.
242+
local xgboost_version="v3.3.0"
243+
239244
pushd "${HOME}/src" >/dev/null
240-
245+
241246
if [[ ! -d "xgboost" ]]; then
242247
git clone --recursive https://github.com/dmlc/xgboost.git
243248
fi
244-
249+
245250
pushd xgboost >/dev/null
246-
git pull origin master
251+
# Fetch and check out the tag instead of pulling master -- this also repoints a
252+
# checkout that an older version of this script left on master.
253+
git fetch --tags origin
254+
git checkout --quiet "${xgboost_version}"
247255
git submodule update --init --recursive
248256

249257
mkdir -p build
@@ -262,14 +270,18 @@ install_xgboost() {
262270
install_lightgbm() {
263271
log_step "Installing LightGBM..."
264272

273+
# Pinned for the same reason as XGBoost above; v4.7.0 matches Homebrew's version.
274+
local lightgbm_version="v4.7.0"
275+
265276
pushd "${HOME}/src" >/dev/null
266-
277+
267278
if [[ ! -d "LightGBM" ]]; then
268279
git clone --recursive https://github.com/microsoft/LightGBM.git
269280
fi
270-
281+
271282
pushd LightGBM >/dev/null
272-
git pull origin master
283+
git fetch --tags origin
284+
git checkout --quiet "${lightgbm_version}"
273285
git submodule update --init --recursive
274286

275287
mkdir -p build

0 commit comments

Comments
 (0)