Skip to content
Draft
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
2 changes: 1 addition & 1 deletion exaudfclient/base/base.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "googletest", version = "1.15.0")
bazel_dep(name = "rules_java", version = "7.6.1")
bazel_dep(name = "rules_java", version = "7.6.5")
bazel_dep(name = "rules_jvm_external", version = "6.2")

python_local_repository = use_repo_rule("//base:python_repository.bzl", "python_local_repository")
Expand Down
5 changes: 3 additions & 2 deletions exaudfclient/base/java_repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ def _find_shared_libraries(prefix,library,p_repository_ctx):
return path_to_library

def _java_local_repository_impl(repository_ctx):
prefix = "/usr/lib/jvm/java-11-openjdk-amd64"
if 'JAVA_PREFIX' in repository_ctx.os.environ:
prefix = repository_ctx.os.environ['JAVA_PREFIX']
print("java prefix in environment specified; %s"%prefix)
else:
fail("Environment Variable JAVA_PREFIX not found")

print("java prefix in environment specified; %s"%prefix)
path_to_libjvm = paths.dirname(_find_shared_libraries(prefix,"libjvm.so",repository_ctx))

defines = '"ENABLE_JAVA_VM"'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,55 @@ COPY scripts /scripts
RUN mkdir -p /build_info/packages
COPY build_deps/packages /build_info/packages/build_deps

ENV BAZEL_PACKAGE_VERSION="7.2.1"
ENV BAZEL_PACKAGE_FILE="bazel_$BAZEL_PACKAGE_VERSION-linux-x86_64.deb"
ENV BAZEL_PACKAGE_URL="https://github.com/bazelbuild/bazel/releases/download/$BAZEL_PACKAGE_VERSION/$BAZEL_PACKAGE_FILE"

RUN /scripts/install_scripts/install_via_apt.pl --file /build_info/packages/build_deps/apt_get_packages --with-versions

RUN apt-get -y update && \
curl -L --output "$BAZEL_PACKAGE_FILE" "$BAZEL_PACKAGE_URL" && \
apt-get install -y "./$BAZEL_PACKAGE_FILE" && \
rm "$BAZEL_PACKAGE_FILE" && \
apt-get -y clean && \
apt-get -y autoremove

RUN curl -L -o swig-2.0.4.tar.gz https://exasol-script-languages-dependencies.s3.eu-central-1.amazonaws.com/swig-2.0.4.tar.gz && \
tar zxf swig-2.0.4.tar.gz && \
(cd swig-2.0.4 && ./configure --prefix=/usr && make && make install) && \
rm -rf swig-2.0.4 swig-2.0.4.tar.gz
# Install base dependencies
RUN /scripts/install_scripts/install_via_apt.pl \
--file /build_info/packages/build_deps/apt_get_packages --with-versions

RUN locale-gen en_US.UTF-8 && \
update-locale LC_ALL=en_US.UTF-8 && \
ldconfig
# Install Bazelisk (architecture-dependent)
ENV BAZELISK_VERSION="v1.26.0"
ENV USE_BAZEL_VERSION="7.6.1"

RUN touch /env && \
RUN set -e; \
apt-get update && apt-get install -y curl gnupg; \
ARCH=$(dpkg --print-architecture); \
if [ "$ARCH" = "amd64" ]; then \
BAZELISK_URL="https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-linux-amd64"; \
elif [ "$ARCH" = "arm64" ]; then \
BAZELISK_URL="https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-linux-arm64"; \
else \
echo "Unsupported architecture: $ARCH" >&2; exit 1; \
fi; \
curl -fsSL -o /usr/local/bin/bazel "$BAZELISK_URL"; \
chmod +x /usr/local/bin/bazel;

# Determine architecture and write relevant env vars to /env
RUN ARCH=$(dpkg --print-architecture) && \
if [ "$ARCH" = "amd64" ]; then \
JAVA_PREFIX="/usr/lib/jvm/java-11-openjdk-amd64"; \
OPENSSL_LIB="/usr/lib/x86_64-linux-gnu"; \
elif [ "$ARCH" = "arm64" ]; then \
JAVA_PREFIX="/usr/lib/jvm/java-11-openjdk-arm64"; \
OPENSSL_LIB="/usr/lib/aarch64-linux-gnu"; \
else \
echo "Unsupported architecture: $ARCH" && exit 1; \
fi && \
echo "export JAVA_PREFIX=$JAVA_PREFIX" >> /env && \
echo "export ARCH=$ARCH" >> /env && \
echo "export PROTOBUF_LIBRARY_PREFIX=/usr/lib/" >> /env && \
echo "export PROTOBUF_INCLUDE_PREFIX=/usr/include/" >> /env && \
echo "export ZMQ_LIBRARY_PREFIX=/usr/lib" >> /env && \
echo "export ZMQ_INCLUDE_PREFIX=/usr/include" >> /env && \
echo "export OPENSSL_LIBRARY_PREFIX=$OPENSSL_LIB" >> /env && \
echo "export OPENSSL_INCLUDE_PREFIX=/usr/include/openssl" >> /env && \
echo "export PROTOBUF_BIN=/usr/bin/protoc" >> /env && \
echo "export JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64" >> /env
echo "export USE_BAZEL_VERSION=$USE_BAZEL_VERSION" >> /env

# Install SWIG 2.0.4
RUN curl -fsSL -o swig-2.0.4.tar.gz \
https://exasol-script-languages-dependencies.s3.eu-central-1.amazonaws.com/swig-2.0.4.tar.gz && \
tar zxf swig-2.0.4.tar.gz && \
(cd swig-2.0.4 && ./configure --build=$(arch)-unknown-linux-gnu --prefix=/usr && make -j"$(nproc)" && make install) && \
rm -rf swig-2.0.4 swig-2.0.4.tar.gz

# Configure UTF-8 locale
RUN locale-gen en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 && ldconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ coreutils|8.32-4.1ubuntu1.2
locales|2.35-0ubuntu3.10
tar|1.34+dfsg-1ubuntu0.1.22.04.2
curl|7.81.0-1ubuntu1.20
openjdk-11-jdk-headless|11.0.27+6~us1-0ubuntu1~22.04
openjdk-11-jdk-headless|11.0.28+6-1ubuntu1~22.04.1
build-essential|12.9ubuntu3
libpcre3-dev|2:8.39-13ubuntu0.22.04.1
protobuf-compiler|3.12.4-1ubuntu7.22.04.4
chrpath|0.16-2
libleveldb-dev|1.23-3build1
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ libnss-db|2.2.3pre1-6ubuntu3
libzmq3-dev|4.3.4-2
libprotobuf-dev|3.12.4-1ubuntu7.22.04.4
libssl-dev|3.0.2-0ubuntu1.19
libleveldb-dev|1.23-3build1
88 changes: 56 additions & 32 deletions scripts/installUdfClientDeps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,79 @@ set -euo pipefail

source /etc/os-release

if [ "$VERSION_CODENAME" != "jammy" ]; then
echo "Script can only work correctly under Ubuntu 22.04"
if [[ "$VERSION_CODENAME" != "jammy" ]]; then
echo "Error: Script can only work correctly under Ubuntu 22.04 (jammy)."
exit 1
fi

if [ $# -ne 1 ];
then
if [[ $# -ne 1 ]]; then
me=$(basename "$0")
echo "Usage: '$me <out_env_file>'. For example: '$me .env'. <out_env_file> will contain necessary environment variables to run 'bazel build'."
echo "Usage: $me <out_env_file>"
echo "Example: $me .env"
echo "<out_env_file> will contain environment variables needed to run 'bazel build'."
exit 1
fi

OUT_ENV_FILE="$1"

export DEBIAN_FRONTEND=noninteractive

# Detect architecture
ARCH=$(dpkg --print-architecture)
case "$ARCH" in
amd64)
BAZELISK_URL="https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64"
;;
arm64)
BAZELISK_URL="https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-arm64"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac

# Install dependencies
apt update
apt install -y curl openjdk-11-jdk libzmq3-dev python3 protobuf-compiler build-essential python3-pip libpcre3-dev chrpath tar locales coreutils libssl-dev

BAZEL_PACKAGE_VERSION="7.2.1"
BAZEL_PACKAGE_FILE="bazel_$BAZEL_PACKAGE_VERSION-linux-x86_64.deb"
BAZEL_PACKAGE_URL="https://github.com/bazelbuild/bazel/releases/download/$BAZEL_PACKAGE_VERSION/$BAZEL_PACKAGE_FILE"


curl -L --output "$BAZEL_PACKAGE_FILE" "$BAZEL_PACKAGE_URL" && \
apt install -y "./$BAZEL_PACKAGE_FILE" && \
rm "$BAZEL_PACKAGE_FILE" && \

apt -y clean
apt -y autoremove


curl -L -o swig-2.0.4.tar.gz https://exasol-script-languages-dependencies.s3.eu-central-1.amazonaws.com/swig-2.0.4.tar.gz && \
tar zxf swig-2.0.4.tar.gz && \
(cd swig-2.0.4 && ./configure --prefix=/usr && make && make install) && \
rm -rf swig-2.0.4 swig-2.0.4.tar.gz


apt install -y \
curl openjdk-11-jdk libzmq3-dev python3 protobuf-compiler \
build-essential python3-pip libpcre3-dev libleveldb-dev chrpath tar \
locales coreutils libssl-dev

# Install Bazelisk
install -d /usr/local/bin
curl -L "$BAZELISK_URL" -o /usr/local/bin/bazel
chmod +x /usr/local/bin/bazel

# Verify Bazelisk is working
bazel version

apt clean
apt autoremove -y

# Build and install SWIG 2.0.4
curl -L -o swig-2.0.4.tar.gz https://exasol-script-languages-dependencies.s3.eu-central-1.amazonaws.com/swig-2.0.4.tar.gz
tar zxf swig-2.0.4.tar.gz
(
cd swig-2.0.4
./configure --prefix=/usr --build=$(arch)-unknown-linux-gnu
make -j"$(nproc)"
make install
)
rm -rf swig-2.0.4 swig-2.0.4.tar.gz

# Install Python numpy package
pip install numpy


cat >"$OUT_ENV_FILE" <<EOL
# Write environment variables to output file
cat > "$OUT_ENV_FILE" << EOF
export PYTHON3_PREFIX=/usr
export PYTHON3_VERSION=python3.10
export ZMQ_LIBRARY_PREFIX=/usr/lib/x86_64-linux-gnu/
export ZMQ_LIBRARY_PREFIX=/usr/lib/${ARCH}-linux-gnu/
export ZMQ_INCLUDE_PREFIX=/usr/include
export PROTOBUF_LIBRARY_PREFIX=/usr/lib/x86_64-linux-gnu
export PROTOBUF_LIBRARY_PREFIX=/usr/lib/${ARCH}-linux-gnu
export PROTOBUF_INCLUDE_PREFIX=/usr/include/
export PROTOBUF_BIN=/usr/bin/protoc
export OPENSSL_LIBRARY_PREFIX=/usr/lib/x86_64-linux-gnu
export OPENSSL_LIBRARY_PREFIX=/usr/lib/${ARCH}-linux-gnu
export OPENSSL_INCLUDE_PREFIX=/usr/include/openssl
EOL
EOF
6 changes: 6 additions & 0 deletions test_container/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,9 @@ RUN pip3 install -r "requirements.txt"
RUN mkdir -p /dev_tools
COPY deps/install_dev_tools.sh /dev_tools
COPY deps/maven-toolchains.xml /root/.m2/toolchains.xml

# Adjust if running on ARM
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then \
sed -i 's/openjdk-amd64/openjdk-arm64/g' /root/.m2/toolchains.xml; \
fi
Loading