Skip to content

Commit

Permalink
connectorx build for aarch
Browse files Browse the repository at this point in the history
  • Loading branch information
vnijs committed Dec 28, 2023
1 parent 31ee5ad commit 0ba24cb
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
54 changes: 54 additions & 0 deletions connectorx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
FROM arm64v8/ubuntu:22.04

# Installing devel dependencies
RUN apt-get update
RUN apt-get install -y \
libmysqlclient-dev \
freetds-dev \
libpq-dev \
wget \
curl \
build-essential \
libkrb5-dev \
clang \
git

# Creating and changing to a new directory
RUN mkdir /wheeler
WORKDIR /wheeler

# Installing and setting up rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="$PATH:/root/.cargo/bin"

# Installing just through cargo
RUN cargo install just

# Installing python3.11.7 from source
RUN wget https://www.python.org/ftp/python/3.11.7/Python-3.11.7.tgz
RUN tar -xvf Python-3.11.7.tgz
RUN cd Python-3.11.7 && ./configure --enable-optimizations
RUN cd Python-3.11.7 && make install
RUN pip3.11 install poetry

# Cloning the connectorx repo and switching to the 0.3.1 tag
RUN git clone https://github.com/sfu-db/connector-x.git
WORKDIR /wheeler/connector-x
RUN git checkout tags/v0.3.2

# Installing maturin
RUN pip3.11 install maturin[patchelf]==0.14.15

# Building the python wheel through maturin
RUN maturin build -m connectorx-python/Cargo.toml -i python3.11 --release

# Copying the wheel into the host system
# the below didn't work for me
# COPY /wheeler/connector-x/connectorx-python/target/wheels/connectorx-* .

# use the below to access the wheel in /wheeler/connector-x/connectorx-python/target/wheels/
# docker run -it -v ./:/root your_user_name/connectorx /bin/bash

# then navigate to the directory below and copy the wheel to the home directory
# which is mounted to your current directory on your host OS
# /wheeler/connector-x/connectorx-python/target/wheel
Binary file not shown.
7 changes: 7 additions & 0 deletions rsm-msba-arm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ RUN pip install \

# catboost # not available for arm64

# connectorx is default for sql stuff in polars but is not built for aarch64
# had to do that manually with a docker file
# see https://github.com/sfu-db/connector-x/issues/386
ENV wheel_name=connectorx-0.3.2-cp311-cp311-manylinux_2_34_aarch64.whl
COPY files/connectorx/${wheel_name} ${wheel_name}
RUN pip install ${wheel_name}

RUN echo "R_LIBS_USER='~/.rsm-msba/R/${R_VERSION}'" >> ${R_HOME}/etc/Renviron.site
RUN echo '.libPaths(unique(c(Sys.getenv("R_LIBS_USER"), .libPaths())))' >> ${R_HOME}/etc/Rprofile.site

Expand Down
6 changes: 6 additions & 0 deletions scripts/build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ launcher () {
}

if [ "$(uname -m)" = "arm64" ]; then

# re-run as needed for arm, polars with sql files
# LABEL=connectorx
# build NO
# exit

LABEL=rsm-msba-arm
build
else
Expand Down

0 comments on commit 0ba24cb

Please sign in to comment.