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

Use clang toolchain to building manylinux2014 wheels #136

Open
wants to merge 1 commit into
base: master
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
3 changes: 2 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ build --action_env=PYTHON_BIN_PATH=python3
build --repo_env=PYTHON_BIN_PATH=python3
build --python_path=python3

build:manylinux2014 --crosstool_top=//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2014:toolchain
build:manylinux2014 --crosstool_top=//third_party/toolchains/clang_toolchain/crosstool:toolchain
build:manylinux2014 --copt="-w"

build -c opt
build --cxxopt="-std=c++17"
Expand Down
20 changes: 10 additions & 10 deletions docker/release.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@ RUN ln -s "/usr/include/x86_64-linux-gnu/python3.11" "/dt9/usr/include/x86_64-li
# bazel build -c opt --copt=-mavx --config=manylinux2014 --test_output=errors //...

# Update binutils to avoid linker(gold) issue. See b/227299577#comment9
RUN \
wget http://old-releases.ubuntu.com/ubuntu/pool/main/b/binutils/binutils_2.35.1-1ubuntu1_amd64.deb \
&& wget http://old-releases.ubuntu.com/ubuntu/pool/main/b/binutils/binutils-x86-64-linux-gnu_2.35.1-1ubuntu1_amd64.deb \
&& wget http://old-releases.ubuntu.com/ubuntu/pool/main/b/binutils/binutils-common_2.35.1-1ubuntu1_amd64.deb \
&& wget http://old-releases.ubuntu.com/ubuntu/pool/main/b/binutils/libbinutils_2.35.1-1ubuntu1_amd64.deb
# RUN \
# wget http://old-releases.ubuntu.com/ubuntu/pool/main/b/binutils/binutils_2.35.1-1ubuntu1_amd64.deb \
# && wget http://old-releases.ubuntu.com/ubuntu/pool/main/b/binutils/binutils-x86-64-linux-gnu_2.35.1-1ubuntu1_amd64.deb \
# && wget http://old-releases.ubuntu.com/ubuntu/pool/main/b/binutils/binutils-common_2.35.1-1ubuntu1_amd64.deb \
# && wget http://old-releases.ubuntu.com/ubuntu/pool/main/b/binutils/libbinutils_2.35.1-1ubuntu1_amd64.deb

RUN \
dpkg -i binutils_2.35.1-1ubuntu1_amd64.deb \
binutils-x86-64-linux-gnu_2.35.1-1ubuntu1_amd64.deb \
binutils-common_2.35.1-1ubuntu1_amd64.deb \
libbinutils_2.35.1-1ubuntu1_amd64.deb
# RUN \
# dpkg -i binutils_2.35.1-1ubuntu1_amd64.deb \
# binutils-x86-64-linux-gnu_2.35.1-1ubuntu1_amd64.deb \
# binutils-common_2.35.1-1ubuntu1_amd64.deb \
# libbinutils_2.35.1-1ubuntu1_amd64.deb

WORKDIR "/tmp/reverb"

Expand Down
Empty file.
2 changes: 2 additions & 0 deletions third_party/toolchains/clang_toolchain/WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# DO NOT EDIT: automatically generated WORKSPACE file for remote_cuda_configure rule
workspace(name = "sigbuild-r2.14-clang_config_cuda")
153 changes: 153 additions & 0 deletions third_party/toolchains/clang_toolchain/crosstool/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# This file is expanded from a template by cuda_configure.bzl
# Update cuda_configure.bzl#verify_build_defines when adding new variables.

load(":cc_toolchain_config.bzl", "cc_toolchain_config")

licenses(["restricted"])

package(default_visibility = ["//visibility:public"])

toolchain(
name = "toolchain-linux-x86_64",
exec_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
target_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
toolchain = ":cc-compiler-local",
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)

cc_toolchain_suite(
name = "toolchain",
toolchains = {
"local|compiler": ":cc-compiler-local",
"darwin|compiler": ":cc-compiler-darwin",
"x64_windows|msvc-cl": ":cc-compiler-windows",
"x64_windows": ":cc-compiler-windows",
"arm": ":cc-compiler-local",
"aarch64": ":cc-compiler-local",
"k8": ":cc-compiler-local",
"piii": ":cc-compiler-local",
"ppc": ":cc-compiler-local",
"darwin": ":cc-compiler-darwin",
},
)

cc_toolchain(
name = "cc-compiler-local",
all_files = ":empty",
compiler_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
# To support linker flags that need to go to the start of command line
# we need the toolchain to support parameter files. Parameter files are
# last on the command line and contain all shared libraries to link, so all
# regular options will be left of them.
supports_param_files = 1,
toolchain_identifier = "local_linux",
toolchain_config = ":cc-compiler-local-config",
)

cc_toolchain_config(
name = "cc-compiler-local-config",
cpu = "local",
builtin_include_directories = ["/dt9/usr/include/c++/9", "/dt9/usr/include/c++/9/x86_64-pc-linux-gnu", "/dt9/usr/include/c++/9/backward", "/usr/lib/llvm-17/lib/clang/17/include", "/dt9/usr/include/x86_64-linux-gnu", "/dt9/usr/include", "/usr/lib/llvm-17/lib/clang/17/share"],
extra_no_canonical_prefixes_flags = [],
host_compiler_path = "/usr/lib/llvm-17/bin/clang",
host_compiler_prefix = "/usr/bin",
host_compiler_warnings = [
# Some parts of the codebase set -Werror and hit this warning, so
# switch it off for now.
"-Wno-invalid-partial-specialization"
],
host_unfiltered_compile_flags = [],
linker_bin_path = "/usr/bin",
builtin_sysroot = "/dt9",
# cuda_path = "/usr/local/cuda-12.2",
compiler = "clang",
)

cc_toolchain(
name = "cc-compiler-darwin",
all_files = ":empty",
compiler_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 0,
toolchain_identifier = "local_darwin",
toolchain_config = ":cc-compiler-local-darwin",
)

cc_toolchain_config(
name = "cc-compiler-local-darwin",
cpu = "darwin",
builtin_include_directories = ["/dt9/usr/include/c++/9", "/dt9/usr/include/c++/9/x86_64-pc-linux-gnu", "/dt9/usr/include/c++/9/backward", "/usr/lib/llvm-17/lib/clang/17/include", "/dt9/usr/include/x86_64-linux-gnu", "/dt9/usr/include", "/usr/lib/llvm-17/lib/clang/17/share"],
extra_no_canonical_prefixes_flags = [],
host_compiler_path = "/usr/lib/llvm-17/bin/clang",
host_compiler_prefix = "/usr/bin",
host_compiler_warnings = [
# Some parts of the codebase set -Werror and hit this warning, so
# switch it off for now.
"-Wno-gnu-offsetof-extensions",
"-Wno-invalid-partial-specialization"
],
host_unfiltered_compile_flags = [],
linker_bin_path = "/usr/bin",
)

cc_toolchain(
name = "cc-compiler-windows",
all_files = "%{win_compiler_deps}",
compiler_files = "%{win_compiler_deps}",
ar_files = "%{win_compiler_deps}",
as_files = "%{win_compiler_deps}",
dwp_files = ":empty",
linker_files = "%{win_compiler_deps}",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 1,
toolchain_identifier = "local_windows",
toolchain_config = ":cc-compiler-windows-config",
)

cc_toolchain_config(
name = "cc-compiler-windows-config",
cpu = "x64_windows",
builtin_include_directories = ["/dt9/usr/include/c++/9", "/dt9/usr/include/c++/9/x86_64-pc-linux-gnu", "/dt9/usr/include/c++/9/backward", "/usr/lib/llvm-17/lib/clang/17/include", "/dt9/usr/include/x86_64-linux-gnu", "/dt9/usr/include", "/usr/lib/llvm-17/lib/clang/17/share"],
msvc_cl_path = "%{msvc_cl_path}",
msvc_env_include = "%{msvc_env_include}",
msvc_env_lib = "%{msvc_env_lib}",
msvc_env_path = "%{msvc_env_path}",
msvc_env_tmp = "%{msvc_env_tmp}",
msvc_lib_path = "%{msvc_lib_path}",
msvc_link_path = "%{msvc_link_path}",
msvc_ml_path = "%{msvc_ml_path}",
compiler = "msvc",
)

filegroup(
name = "empty",
srcs = [],
)

filegroup(
name = "crosstool_wrapper_driver_is_not_gcc",
srcs = ["clang/bin/crosstool_wrapper_driver_is_not_gcc"],
)

filegroup(
name = "windows_msvc_wrapper_files",
srcs = glob(["windows/msvc_*"]),
)
Loading