Skip to content

Commit 0811bbf

Browse files
authored
Merge pull request #224 from czgdp1807/upgrade_deps
2 parents 5b47144 + d81db16 commit 0811bbf

17 files changed

Lines changed: 148 additions & 581 deletions

.bazelrc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# This macro is needed in order for mlmd to build with ZetaSQL which can only
1616
# be compiled upon c++17 or higher.
1717
build --cxxopt="-std=c++17"
18+
build --host_cxxopt="-std=c++17"
1819

1920
# Needed to avoid zetasql proto error.
2021
build --protocopt=--experimental_allow_proto3_optional
@@ -26,3 +27,28 @@ build --incompatible_require_linker_input_cc_api=false
2627

2728
build:macos --apple_platform_type=macos
2829
build:macos_arm64 --cpu=darwin_arm64
30+
build:macos_arm64 --linkopt=-Wl,-undefined,dynamic_lookup
31+
build:macos_arm64 --host_linkopt=-Wl,-undefined,dynamic_lookup
32+
build --conlyopt=-std=c11
33+
build --host_conlyopt=-std=c11
34+
build --cxxopt=-std=c++17
35+
build --host_cxxopt=-std=c++17
36+
build --copt=-Wno-error
37+
build --cxxopt=-Wno-error
38+
build --cxxopt=-fpermissive
39+
build --conlyopt=-Wno-array-parameter
40+
build --conlyopt=-Wno-implicit-function-declaration
41+
build --host_copt=-Wno-error
42+
build --host_cxxopt=-Wno-error
43+
build --host_cxxopt=-fpermissive
44+
build --host_conlyopt=-Wno-array-parameter
45+
build --host_conlyopt=-Wno-implicit-function-declaration
46+
# Linux-only linker flags (not supported on macOS)
47+
build:linux --linkopt=-Wl,--no-as-needed
48+
build:linux --host_linkopt=-Wl,--no-as-needed
49+
build:macos_arm64 --copt=-Wno-error=c23-extensions
50+
build:macos_arm64 --host_copt=-Wno-error=c23-extensions
51+
build:macos_arm64 --copt=-Wno-c23-extensions
52+
build:macos_arm64 --host_copt=-Wno-c23-extensions
53+
build:macos_arm64 --action_env=CONDA_PREFIX
54+
build:macos_arm64 --action_env=CMAKE_ICONV_FLAG="-DCMAKE_DISABLE_FIND_PACKAGE_Iconv=ON -DICONV_LIBRARIES=$CONDA_PREFIX/lib/libiconv.dylib -DICONV_INCLUDE_DIR=$CONDA_PREFIX/include"

.github/workflows/build.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/conda-build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
os: [ubuntu-latest]
21-
python-version: ["3.9", "3.10", "3.11"]
20+
os: [ubuntu-latest, macos-latest]
21+
python-version: ["3.9", "3.10", "3.11", "3.12"]
2222

2323
steps:
2424
- name: Checkout
@@ -27,7 +27,7 @@ jobs:
2727
- name: Setup Micromamba
2828
uses: mamba-org/setup-micromamba@v1
2929
with:
30-
environment-file: ci/environment.yml
30+
environment-file: ${{ matrix.os == 'macos-latest' && 'ci/environment-macos.yml' || 'ci/environment.yml' }}
3131
cache-environment: true
3232
create-args: >-
3333
python=${{ matrix.python-version }}
@@ -62,7 +62,7 @@ jobs:
6262
run: |
6363
python -m build --wheel --no-isolation
6464
65-
- name: Repair wheel for manylinux
65+
- name: Repair wheel (Linux)
6666
if: runner.os == 'Linux'
6767
shell: bash -l {0}
6868
run: |

.github/workflows/conda-test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
os: [ubuntu-latest]
19-
python-version: ["3.9", "3.10", "3.11"]
18+
os: [ubuntu-latest, macos-latest]
19+
python-version: ["3.9", "3.10", "3.11", "3.12"]
2020

2121
steps:
2222
- name: Checkout
@@ -25,7 +25,7 @@ jobs:
2525
- name: Setup Micromamba
2626
uses: mamba-org/setup-micromamba@v1
2727
with:
28-
environment-file: ci/environment.yml
28+
environment-file: ${{ matrix.os == 'macos-latest' && 'ci/environment-macos.yml' || 'ci/environment.yml' }}
2929
cache-environment: true
3030
create-args: >-
3131
python=${{ matrix.python-version }}
@@ -55,7 +55,7 @@ jobs:
5555
run: |
5656
python setup.py bdist_wheel
5757
58-
- name: Install built wheel (Linux/macOS)
58+
- name: Install built wheel
5959
shell: bash -l {0}
6060
run: |
6161
pip install dist/*.whl

.github/workflows/test.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

WORKSPACE

Lines changed: 36 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,23 @@ http_archive(
2424
sha256 = "5308fc1d8865406a49427ba24a9ab53087f17f5266a7aabbfc28823f3916e1ca",
2525
)
2626

27-
# Install version 0.9.0 of rules_foreign_cc, as default version causes an
28-
# invalid escape sequence error to be raised, which can't be avoided with
29-
# the --incompatible_restrict_string_escapes=false flag (flag was removed in
30-
# Bazel 5.0).
31-
RULES_FOREIGN_CC_VERSION = "0.9.0"
27+
# Install version 0.12.0 of rules_foreign_cc
28+
RULES_FOREIGN_CC_VERSION = "0.12.0"
3229
http_archive(
3330
name = "rules_foreign_cc",
34-
sha256 = "2a4d07cd64b0719b39a7c12218a3e507672b82a97b98c6a89d38565894cf7c51",
31+
sha256 = "a2e6fb56e649c1ee79703e99aa0c9d13c6cc53c8d7a0cbb8797ab2888bbc99a3",
3532
strip_prefix = "rules_foreign_cc-%s" % RULES_FOREIGN_CC_VERSION,
3633
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/refs/tags/%s.tar.gz" % RULES_FOREIGN_CC_VERSION,
37-
patch_tool = "patch",
38-
patches = ["//ml_metadata/third_party:rules_foreign_cc.patch",],
3934
)
4035

4136
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
4237
rules_foreign_cc_dependencies()
4338

4439
http_archive(
4540
name = "com_google_absl",
46-
urls = ["https://github.com/abseil/abseil-cpp/archive/940c06c25d2953f44310b68eb8aab6114dba11fb.zip"],
47-
strip_prefix = "abseil-cpp-940c06c25d2953f44310b68eb8aab6114dba11fb",
48-
sha256 = "0e800799aa64d0b4d354f3ff317bbd5fbf42f3a522ab0456bb749fc8d3b67415",
41+
urls = ["https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.1.tar.gz"],
42+
strip_prefix = "abseil-cpp-20230802.1",
43+
sha256 = "987ce98f02eefbaf930d6e38ab16aa05737234d7afbab2d5c4ea7adbe50c28ed",
4944
)
5045

5146
http_archive(
@@ -60,18 +55,18 @@ http_archive(
6055
http_archive(
6156
name = "org_sqlite",
6257
build_file = clean_dep("//ml_metadata/third_party:sqlite.BUILD"),
63-
sha256 = "87775784f8b22d0d0f1d7811870d39feaa7896319c7c20b849a4181c5a50609b",
64-
strip_prefix = "sqlite-amalgamation-3390200",
58+
sha256 = "aa73d8748095808471deaa8e6f34aa700e37f2f787f4425744f53fdd15a89c40",
59+
strip_prefix = "sqlite-amalgamation-3470200",
6560
urls = [
66-
"https://www.sqlite.org/2022/sqlite-amalgamation-3390200.zip",
61+
"https://www.sqlite.org/2024/sqlite-amalgamation-3470200.zip",
6762
],
6863
)
6964

7065
http_archive(
7166
name = "com_google_googletest",
72-
sha256 = "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2",
73-
strip_prefix = "googletest-release-1.12.1",
74-
urls = ["https://github.com/google/googletest/archive/refs/tags/release-1.12.1.tar.gz"],
67+
sha256 = "7b42dc4b2106035276f8f0a5019c929a77d9c606ab43b8e0e1c4b7cc27c8e5ce",
68+
strip_prefix = "googletest-release-1.15.2",
69+
urls = ["https://github.com/google/googletest/archive/refs/tags/release-1.15.2.tar.gz"],
7570
)
7671

7772
http_archive(
@@ -84,13 +79,13 @@ http_archive(
8479
sha256 = "6281aa4eeecb9e932d7091f99872e7b26fa6aacece49c15ce5b14af2b7ec050f",
8580
)
8681

87-
# 1.5.0
82+
# 1.7.1
8883
http_archive(
8984
name = "bazel_skylib",
90-
sha256 = "cd55a062e763b9349921f0f5db8c3933288dc8ba4f76dd9416aac68acee3cb94",
85+
sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f",
9186
urls = [
92-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz",
93-
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz",
87+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz",
88+
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz",
9489
],
9590
)
9691

@@ -117,13 +112,26 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
117112

118113
protobuf_deps()
119114

115+
# Override upb from protobuf_deps() to apply our patch
116+
http_archive(
117+
name = "upb",
118+
sha256 = "017a7e8e4e842d01dba5dc8aa316323eee080cd1b75986a7d1f94d87220e6502",
119+
strip_prefix = "upb-e4635f223e7d36dfbea3b722a4ca4807a7e882e2",
120+
urls = [
121+
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/protocolbuffers/upb/archive/e4635f223e7d36dfbea3b722a4ca4807a7e882e2.tar.gz",
122+
"https://github.com/protocolbuffers/upb/archive/e4635f223e7d36dfbea3b722a4ca4807a7e882e2.tar.gz",
123+
],
124+
patches = ["//ml_metadata/third_party:upb.patch"],
125+
patch_args = ["-p0"],
126+
)
127+
120128
# Needed by Protobuf.
121129
http_archive(
122130
name = "zlib",
123131
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
124-
sha256 = "d8688496ea40fb61787500e863cc63c9afcbc524468cedeb478068924eb54932",
125-
strip_prefix = "zlib-1.2.12",
126-
urls = ["https://github.com/madler/zlib/archive/v1.2.12.tar.gz"],
132+
sha256 = "17e88863f3600672ab49182f217281b6fc4d3c762bde361935e436a95214d05c",
133+
strip_prefix = "zlib-1.3.1",
134+
urls = ["https://github.com/madler/zlib/archive/v1.3.1.tar.gz"],
127135
)
128136

129137
http_archive(
@@ -136,9 +144,10 @@ http_archive(
136144
http_archive(
137145
name = "pybind11",
138146
urls = [
139-
"https://github.com/pybind/pybind11/archive/v2.10.1.tar.gz",
147+
"https://github.com/pybind/pybind11/archive/v2.13.6.tar.gz",
140148
],
141-
strip_prefix = "pybind11-2.10.1",
149+
sha256 = "e08cb87f4773da97fa7b5f035de8763abc656d87d5773e62f6da0587d1f0ec20",
150+
strip_prefix = "pybind11-2.13.6",
142151
build_file = "@pybind11_bazel//:pybind11.BUILD",
143152
)
144153

@@ -247,33 +256,7 @@ http_archive(
247256
url = "https://github.com/gflags/gflags/archive/a738fdf9338412f83ab3f26f31ac11ed3f3ec4bd.zip",
248257
)
249258

250-
ZETASQL_COMMIT = "ac37cf5c0d80b5605176fc0f29e87b12f00be693" # 08/10/2022
251-
http_archive(
252-
name = "com_google_zetasql",
253-
urls = ["https://github.com/google/zetasql/archive/%s.zip" % ZETASQL_COMMIT],
254-
strip_prefix = "googlesql-%s" % ZETASQL_COMMIT,
255-
#patches = ["//ml_metadata/third_party:zetasql.patch"],
256-
sha256 = '86f81591ab5ec20457a5394eb2c5c981e6f6c89f4c49c211d096c3acffec1eb1'
257-
)
258-
259-
load("@com_google_zetasql//bazel:zetasql_deps_step_1.bzl", "zetasql_deps_step_1")
260-
zetasql_deps_step_1()
261-
load("@com_google_zetasql//bazel:zetasql_deps_step_2.bzl", "zetasql_deps_step_2")
262-
zetasql_deps_step_2(
263-
analyzer_deps = True,
264-
evaluator_deps = True,
265-
tools_deps = False,
266-
java_deps = False,
267-
testing_deps = False)
268-
269-
# This is part of what zetasql_deps_step_3() does.
270-
load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
271-
switched_rules_by_language(
272-
name = "com_google_googleapis_imports",
273-
cc = True,
274-
)
275-
276-
259+
# ZetaSQL removed - not needed for core functionality
277260

278261
# Please add all new ML Metadata dependencies in workspace.bzl.
279262
load("//ml_metadata:workspace.bzl", "ml_metadata_workspace")

ci/environment-macos.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Conda environment for building and testing ml-metadata on macOS
2+
name: mlmd-dev
3+
channels:
4+
- conda-forge
5+
dependencies:
6+
# Note: Bazel is installed separately via official installer (conda package is unreliable)
7+
- setuptools<69.3 # Pin to avoid Metadata-Version 2.4 (PyPI only supports up to 2.3)
8+
- wheel
9+
- pip
10+
- numpy>=1.23,<2.0
11+
- pytest
12+
- pytest-cov
13+
- cmake=3.29 # Required for building libmysqlclient (CMake 4.x is incompatible)
14+
- six # Required by ZetaSQL build tools
15+
- libiconv # Required by libmysqlclient for character encoding conversions
16+
17+
# C/C++ compilers
18+
- clang
19+
- clangxx
20+
21+
- pip:
22+
- delocate # For macOS wheel repair

ci/environment.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ dependencies:
1313
- patchelf # For wheel repair on Linux
1414
- cmake=3.29
1515

16-
# C/C++ compilers - GCC 8.x to match manylinux2014 devtoolset-8
17-
- gcc_linux-64=8.5.0
18-
- gxx_linux-64=8.5.0
16+
- gcc_linux-64
17+
- gxx_linux-64
1918
- sysroot_linux-64=2.17 # CentOS 7/manylinux2014 compatible glibc headers
2019

2120
- pip:

ml_metadata/libmysqlclient.BUILD

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ config_setting(
3939
visibility = ["//visibility:public"],
4040
)
4141

42+
config_setting(
43+
name = "darwin_arm64",
44+
values = {"cpu": "darwin_arm64"},
45+
visibility = ["//visibility:public"],
46+
)
47+
4248
cc_library(
4349
name = "libmysqlclient",
4450
srcs = configure_out_srcs + [
@@ -91,7 +97,19 @@ cc_library(
9197
"-DLIBICONV_PLUG",
9298
"-DHAVE_OPENSSL",
9399
"-DHAVE_TLS",
94-
],
100+
# Fix implicit function declarations
101+
"-D_GNU_SOURCE",
102+
] + select({
103+
# On Linux/GCC 13 / Ubuntu 24.04: define legacy MySQL types using stdint.h types
104+
# On macOS: these types are already correct size, don't redefine to avoid conflicts
105+
":darwin": [],
106+
":darwin_arm64": [],
107+
"//conditions:default": [
108+
"-Duint=uint32_t",
109+
"-Dushort=uint16_t",
110+
"-Dulong=uint64_t",
111+
],
112+
}),
95113
includes = [
96114
"build/include/",
97115
"include/",
@@ -103,6 +121,7 @@ cc_library(
103121
"-lm",
104122
] + select({
105123
":darwin": ["-liconv"],
124+
":darwin_arm64": ["-liconv"],
106125
"//conditions:default": [],
107126
}),
108127
visibility = ["//visibility:public"],

0 commit comments

Comments
 (0)