Skip to content

Commit

Permalink
OSS build fixes (pytorch#3514)
Browse files Browse the repository at this point in the history
Summary:
X-link: facebookresearch/FBGEMM#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: pytorch#3514

Reviewed By: spcyppt

Differential Revision: D67435456

Pulled By: q10

fbshipit-source-id: 2fe53c59251df3633771b2b6b0d97c15a33df7b6
  • Loading branch information
q10 authored and facebook-github-bot committed Dec 19, 2024
1 parent 7d1c763 commit a75d8fe
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 6 deletions.
11 changes: 9 additions & 2 deletions .github/scripts/utils_build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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 "#"
Expand Down Expand Up @@ -294,22 +294,29 @@ 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 \
ncurses \
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.
#
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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")
12 changes: 12 additions & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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()
2 changes: 1 addition & 1 deletion bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion fbgemm_gpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a75d8fe

Please sign in to comment.