From a75d8fe03003b24fc0ac635c723fe0c12c7ffc98 Mon Sep 17 00:00:00 2001 From: Benson Ma Date: Thu, 19 Dec 2024 14:07:59 -0800 Subject: [PATCH] OSS build fixes (#3514) Summary: X-link: https://github.com/facebookresearch/FBGEMM/pull/599 - Fix the CMake minimum version in conda install - Fix issue with missing `librhash.so.0` when installing `gcc` - Fix build issues with bazel, and upgrade bazel version to latest Pull Request resolved: https://github.com/pytorch/FBGEMM/pull/3514 Reviewed By: spcyppt Differential Revision: D67435456 Pulled By: q10 fbshipit-source-id: 2fe53c59251df3633771b2b6b0d97c15a33df7b6 --- .github/scripts/utils_build.bash | 11 +++++++++-- MODULE.bazel | 2 +- WORKSPACE.bazel | 12 ++++++++++++ bench/CMakeLists.txt | 2 +- fbgemm_gpu/CMakeLists.txt | 2 +- test/CMakeLists.txt | 2 +- 6 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/scripts/utils_build.bash b/.github/scripts/utils_build.bash index f4096caa17..69cc36ca93 100644 --- a/.github/scripts/utils_build.bash +++ b/.github/scripts/utils_build.bash @@ -14,7 +14,7 @@ ################################################################################ setup_bazel () { - local bazel_version="${1:-6.1.1}" + local bazel_version="${1:-8.0.0}" echo "################################################################################" echo "# Setup Bazel" echo "#" @@ -294,12 +294,13 @@ install_build_tools () { # $CONDA_PREFIX/include directory, which is required for FBGEMM tests # # - ncurses is needed to silence libtinfo6.so errors for ROCm+Clang builds + # - rhash is needed bc newer versions of GXX package don't come packaged with this library anymore # # shellcheck disable=SC2086 (exec_with_retries 3 conda install ${env_prefix} -c conda-forge -y \ bazel \ click \ - cmake \ + 'cmake>=3.30' \ hypothesis \ jinja2 \ make \ @@ -307,9 +308,15 @@ install_build_tools () { ninja \ openblas \ patchelf \ + rhash \ scikit-build \ wheel) || return 1 + echo "[INSTALL] Adding symlink librhash.so.0, which is needed by Cmake ..." + # shellcheck disable=SC2155,SC2086 + local conda_prefix=$(conda run ${env_prefix} printenv CONDA_PREFIX) + (print_exec ln -s "${conda_prefix}/lib/librhash.so" "${conda_prefix}/lib/librhash.so.0") || return 1 + # For some reason, the build package for Python 3.12 is missing from Conda, so # we have to install through PyPI instead. # diff --git a/MODULE.bazel b/MODULE.bazel index 02f67d0ee5..43f2f033d9 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -5,4 +5,4 @@ module(name = "fbgemm") -bazel_dep(name = "bazel_skylib", version = "1.5.0") +bazel_dep(name = "bazel_skylib", version = "1.7.1") diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 9a9f9535aa..6161eef189 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -7,6 +7,15 @@ workspace(name = "fbgemm") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +http_archive( + name = "bazel_skylib", + sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz", + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz", + ], +) + http_archive( name = "com_google_googletest", strip_prefix = "googletest-1.14.0", @@ -29,3 +38,6 @@ new_local_repository( build_file = "@//external:asmjit.BUILD", path = "external/asmjit", ) + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") +bazel_skylib_workspace() diff --git a/bench/CMakeLists.txt b/bench/CMakeLists.txt index bd2575100a..385fe6cbb0 100644 --- a/bench/CMakeLists.txt +++ b/bench/CMakeLists.txt @@ -4,7 +4,7 @@ # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. -cmake_minimum_required(VERSION 3.16 FATAL_ERROR) +cmake_minimum_required(VERSION 3.25 FATAL_ERROR) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/fbgemm_gpu/CMakeLists.txt b/fbgemm_gpu/CMakeLists.txt index 922b3f207b..20fe463d8e 100644 --- a/fbgemm_gpu/CMakeLists.txt +++ b/fbgemm_gpu/CMakeLists.txt @@ -8,7 +8,7 @@ # CMake Prelude ################################################################################ -cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.25 FATAL_ERROR) set(CMAKEMODULES ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules) set(FBGEMM_GPU ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index da0be7fe7b..bf2d8dbebf 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,7 +4,7 @@ # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. -cmake_minimum_required(VERSION 3.21 FATAL_ERROR) +cmake_minimum_required(VERSION 3.25 FATAL_ERROR) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_EXTENSIONS OFF)