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

Boost 1.86 SHA1 compatibility fix #69

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cxx_compiler_version:
docker_image:
- quay.io/condaforge/linux-anvil-x86_64-cuda11.8:ubi8
libboost_devel:
- '1.84'
- '1.86'
python_min:
- '3.9'
target_platform:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cxx_compiler_version:
docker_image:
- quay.io/condaforge/linux-anvil-x86_64:alma9
libboost_devel:
- '1.84'
- '1.86'
python_min:
- '3.9'
target_platform:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cxx_compiler_version:
docker_image:
- quay.io/condaforge/linux-anvil-x86_64:alma9
libboost_devel:
- '1.84'
- '1.86'
python_min:
- '3.9'
target_platform:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cxx_compiler_version:
docker_image:
- quay.io/condaforge/linux-anvil-x86_64-cuda11.8:ubi8
libboost_devel:
- '1.84'
- '1.86'
python_min:
- '3.9'
target_platform:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cxx_compiler_version:
docker_image:
- quay.io/condaforge/linux-anvil-x86_64:alma9
libboost_devel:
- '1.84'
- '1.86'
python_min:
- '3.9'
target_platform:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cxx_compiler_version:
docker_image:
- quay.io/condaforge/linux-anvil-x86_64:alma9
libboost_devel:
- '1.84'
- '1.86'
python_min:
- '3.9'
target_platform:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cxx_compiler_version:
docker_image:
- quay.io/condaforge/linux-anvil-x86_64-cuda11.8:ubi8
libboost_devel:
- '1.84'
- '1.86'
python_min:
- '3.9'
target_platform:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cxx_compiler_version:
docker_image:
- quay.io/condaforge/linux-anvil-x86_64:alma9
libboost_devel:
- '1.84'
- '1.86'
python_min:
- '3.9'
target_platform:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cxx_compiler_version:
docker_image:
- quay.io/condaforge/linux-anvil-x86_64:alma9
libboost_devel:
- '1.84'
- '1.86'
python_min:
- '3.9'
target_platform:
Expand Down
14 changes: 14 additions & 0 deletions .ci_support/migrations/libboost186.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
__migrator:
build_number: 1
kind: version
commit_message: "Rebuild for libboost 1.86"
migration_number: 1
assimp:
- 5.4.2
libboost_devel:
- "1.86"
libboost_headers:
- "1.86"
libboost_python_devel:
- "1.86"
migrator_ts: 1723764795.6693385
2 changes: 1 addition & 1 deletion .ci_support/osx_64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cxx_compiler:
cxx_compiler_version:
- '18'
libboost_devel:
- '1.84'
- '1.86'
llvm_openmp:
- '18'
macos_machine:
Expand Down
2 changes: 1 addition & 1 deletion .ci_support/osx_arm64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cxx_compiler:
cxx_compiler_version:
- '18'
libboost_devel:
- '1.84'
- '1.86'
llvm_openmp:
- '18'
macos_machine:
Expand Down
2 changes: 1 addition & 1 deletion .ci_support/win_64_cuda_compiler_versionNone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cuda_compiler_version:
cxx_compiler:
- vs2019
libboost_devel:
- '1.84'
- '1.86'
python_min:
- '3.9'
target_platform:
Expand Down
19 changes: 19 additions & 0 deletions recipe/boost-sha1.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff -ur lightgbm-4.5.0.orig/external_libs/compute/include/boost/compute/detail/sha1.hpp lightgbm-4.5.0/external_libs/compute/include/boost/compute/detail/sha1.hpp
--- lightgbm-4.5.0.orig/external_libs/compute/include/boost/compute/detail/sha1.hpp 2022-11-09 07:37:21.000000000 -0500
+++ lightgbm-4.5.0/external_libs/compute/include/boost/compute/detail/sha1.hpp 2025-02-11 04:25:47.787251140 -0500
@@ -37,12 +37,12 @@
}

operator std::string() {
- unsigned int digest[5];
+ boost::uuids::detail::sha1::digest_type digest;
h.get_digest(digest);

std::ostringstream buf;
- for(int i = 0; i < 5; ++i)
- buf << std::hex << std::setfill('0') << std::setw(8) << digest[i];
+ for(size_t i = 0; i < sizeof(digest) / sizeof(digest[0]); ++i)
+ buf << std::hex << std::setfill('0') << std::setw(sizeof(digest[0]) * 2) << digest[i];

return buf.str();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is ok, but writing out my reasoning to be sure I'm understanding correctly.

The file you're patching here is in LightGBM's vendored copy of the Boost 1.74 headers.

But here in conda-forge, lib_lightgbm is dynamically linking against the latest libboost-devel (1.87.0 as of this writing).

So this allows LightGBM to be built successfully, by pulling forward a specific breaking change in Boost (the one @sofiageo mentioned in microsoft/LightGBM#6786 (comment)).

Right?

If so I'm ok with that. But this is a fragile state to be in (vendoring headers from a version and then linking against a shared library from a different version).

If you know how to get LightGBM building successfully with Boost 1.87, we'd welcome help upstream (cc @StrikerRUS): microsoft/LightGBM#6582

And also longer-term, LightGBM should really be modified upstream to stop vendoring these headers and to instead expect them to be provided in the build environment (maybe as part of microsoft/LightGBM#6774).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file you're patching here is in LightGBM's vendored copy of the Boost 1.74 headers.

But here in conda-forge, lib_lightgbm is dynamically linking against the latest libboost-devel (1.87.0 as of this writing).

According to the logs, boost 1.86 is used for during build (and present in the resulting index.json).

So this allows LightGBM to be built successfully, by pulling forward a specific breaking change in Boost (the one @sofiageo mentioned in microsoft/LightGBM#6786 (comment)).

Right?

Yes, the only difference is that my version works with both pre- and post-1.86 boost. The above PR works with >=1.86 only.

If so I'm ok with that. But this is a fragile state to be in (vendoring headers from a version and then linking against a shared library from a different version).

If you know how to get LightGBM building successfully with Boost 1.87, we'd welcome help upstream (cc @StrikerRUS): microsoft/LightGBM#6582

I didn't try 1.87 yet, because most of conda-forge is compatible with 1.86 at maximum.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 changes: 3 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ source:
# Taken from https://github.com/microsoft/LightGBM/blob/v4.5.0/build-python.sh#L308-L316
# except that we don't copy lib_lightgbm.so to SP_DIR
- use_precompiled.diff
# Compatibility fix for Boost 1.86
- boost-sha1.diff

build:
number: 4
number: 5
string: cuda_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version != "None"]
string: cpu_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version == "None"]
# CUDA is not supported in windows
Expand Down
Loading