diff --git a/WORKSPACE b/WORKSPACE index 73e65b7b8..f98925490 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -8,6 +8,7 @@ http_archive( build_file = "//ml_metadata:postgresql.BUILD", workspace_file_content = "//ml_metadata:postgresql.WORKSPACE", sha256 = "1cb8e3a59861be5175878159fc3a41240c379e9aabaabba8288e6cfd6980fff0", + patches = ["//ml_metadata/third_party:postgresql.patch"], strip_prefix = "postgresql-12.17", urls = [ "https://ftp.postgresql.org/pub/source/v12.17/postgresql-12.17.tar.gz", @@ -52,10 +53,10 @@ http_archive( http_archive( name = "boringssl", - sha256 = "f69738ca17f1dd30ae3ddb1fa7519245044737d27c8a3defa7a94718d9dfd724", - strip_prefix = "boringssl-68dcc7f7b816e199c8f373ea0a2d6a4e1f526e2d", + sha256 = "579cb415458e9f3642da0a39a72f79fdfe6dc9c1713b3a823f1e276681b9703e", + strip_prefix = "boringssl-648cbaf033401b7fe7acdce02f275b06a88aab5c", urls = [ - "https://github.com/google/boringssl/archive/68dcc7f7b816e199c8f373ea0a2d6a4e1f526e2d.tar.gz", + "https://github.com/google/boringssl/archive/648cbaf033401b7fe7acdce02f275b06a88aab5c.tar.gz", ], ) diff --git a/ml_metadata/metadata_store/metadata_store.py b/ml_metadata/metadata_store/metadata_store.py index 359d30b9e..a97b0b305 100644 --- a/ml_metadata/metadata_store/metadata_store.py +++ b/ml_metadata/metadata_store/metadata_store.py @@ -17,6 +17,8 @@ types can be created on the fly. """ +from absl import flags +flags.FLAGS(['pytest']) import enum import random import time diff --git a/ml_metadata/third_party/postgresql.patch b/ml_metadata/third_party/postgresql.patch new file mode 100644 index 000000000..80785cec2 --- /dev/null +++ b/ml_metadata/third_party/postgresql.patch @@ -0,0 +1,37 @@ +diff --git src/port/pg_bitutils.c src/port/pg_bitutils.c +index 7847e8a..17714af 100644 +--- src/port/pg_bitutils.c ++++ src/port/pg_bitutils.c +@@ -12,12 +12,14 @@ + */ + #include "c.h" + ++#if !defined(__ppc__) && !defined(__PPC__) && !defined(__ppc64__) && !defined(__PPC64__) + #ifdef HAVE__GET_CPUID + #include + #endif + #ifdef HAVE__CPUID + #include + #endif ++#endif + + #include "port/pg_bitutils.h" + +@@ -141,6 +143,7 @@ int (*pg_popcount64) (uint64 word) = pg_popcount64_slow; + static bool + pg_popcount_available(void) + { ++#if !defined(__ppc__) && !defined(__PPC__) && !defined(__ppc64__) && !defined(__PPC64__) + unsigned int exx[4] = {0, 0, 0, 0}; + + #if defined(HAVE__GET_CPUID) +@@ -152,6 +155,9 @@ pg_popcount_available(void) + #endif + + return (exx[2] & (1 << 23)) != 0; /* POPCNT */ ++#else ++ return false; ++#endif + } + + /* diff --git a/ml_metadata/tools/docker_server/Dockerfile.konflux b/ml_metadata/tools/docker_server/Dockerfile.konflux index bafc2afb4..3e693f345 100644 --- a/ml_metadata/tools/docker_server/Dockerfile.konflux +++ b/ml_metadata/tools/docker_server/Dockerfile.konflux @@ -15,18 +15,46 @@ RUN dnf install -y -q \ git \ findutils \ python3 + +RUN arch=$(uname -m) && \ + echo "Detected architecture: $arch" && \ + if [ "$arch" = "ppc64le" ]; then \ + echo "Setting up for ppc64le..." && \ + dnf install -y -q java-11-openjdk-devel wget; \ + fi + + +# Set environment for Bazel and Java +ENV JAVA_HOME=/usr/lib/jvm/java-11 +ENV PATH=$JAVA_HOME/bin:$PATH +ENV BAZEL_VERSION=5.3.0 +ENV BAZEL_JOBS=8 -# Set up Bazel 5.3.0 -ENV BAZEL_VERSION 5.3.0 WORKDIR / -RUN mkdir /bazel && \ + +RUN arch=$(uname -m) && \ + if [ "$arch" = "ppc64le" ]; then \ + echo "Setting up for ppc64le..." && \ + wget https://ftp2.osuosl.org/pub/ppc64el/bazel/el8/bazel-${BAZEL_VERSION} && \ + chmod +x bazel-${BAZEL_VERSION} && \ + mv bazel-${BAZEL_VERSION} /usr/local/bin/bazel && \ + ln -s /usr/local/bin/bazel /usr/bin/bazel && \ + bazel --version; \ + elif [ "$arch" = "x86_64" ]; then \ + echo "Setting up for x86_64..." && \ + mkdir /bazel && \ cd /bazel && \ curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \ curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -o /bazel/LICENSE.txt https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE && \ chmod +x bazel-*.sh && \ ./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \ cd / && \ - rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh + rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh; \ + else \ + echo "Unsupported architecture: $arch" >&2 && \ + exit 1; \ + fi + COPY . /mlmd-src WORKDIR /mlmd-src @@ -34,11 +62,12 @@ WORKDIR /mlmd-src # "-std=c++17" is needed in order to build with ZetaSQL. RUN bazel build -c opt --action_env=PATH \ --define=grpc_no_ares=true \ + --copt="-Wno-maybe-uninitialized" \ + --jobs=${BAZEL_JOBS} \ //ml_metadata/metadata_store:metadata_store_server \ --cxxopt="-std=c++17" --host_cxxopt="-std=c++17" \ --verbose_failures - # copying libmysqlclient source onto THIRD_PARTY folder. RUN mkdir -p /mlmd-src/third_party RUN cp -RL /mlmd-src/bazel-mlmd-src/external/libmysqlclient /mlmd-src/third_party/mariadb-connector-c diff --git a/ml_metadata/tools/docker_server/Dockerfile.redhat b/ml_metadata/tools/docker_server/Dockerfile.redhat index e9f0b0dcc..d0df7e079 100644 --- a/ml_metadata/tools/docker_server/Dockerfile.redhat +++ b/ml_metadata/tools/docker_server/Dockerfile.redhat @@ -37,6 +37,7 @@ WORKDIR /mlmd-src # "-std=c++17" is needed in order to build with ZetaSQL. RUN bazel build -c opt --action_env=PATH \ --define=grpc_no_ares=true \ + --copt="-Wno-maybe-uninitialized" \ //ml_metadata/metadata_store:metadata_store_server \ --cxxopt="-std=c++17" --host_cxxopt="-std=c++17"