pdo_snowflake icon indicating copy to clipboard operation
pdo_snowflake copied to clipboard

SNOW-963813: AWS Arm processor support for PDO driver

Open chrispian opened this issue 2 years ago • 9 comments

What is the current behavior?

Currently on Ubuntu on AWS the Arm64 Processors are not supported by the ODBC client. See: https://github.com/snowflakedb/pdo_snowflake/issues/299#issuecomment-1420965479

What is the desired behavior?

The driver should compile correctly on AWS Arm64 Linux machines.

How would this improve pdo_snowflake?

Arm processors are widely used in hosting and on Mac. I know the Mac's have been updated for PDO but ODBC drivers still fail on Apple silicon and AWS Arm processors. ODBC and PDO should both work on both systems. This way testing on local can be as in sync with prod as possible without having to resort to special Docker containers to solve the problem.

What is your Snowflake account identifier, if any?

Happy to provide this privately. I work for Adtran, Inc. Jeremy Lemmon @ Snowflake can confirm our account etc.

I was able to get the ODBC drivers installed on AWS but would much prefer to use the native PDO so that it's the same across all our systems.

Let me know if you need further details.

chrispian avatar Nov 07 '23 19:11 chrispian

I'm having the same issue with an M3 processor. Is the only workaround to use the OBDC driver? This is very frustrating.

stephenahiggins avatar Jan 27 '24 21:01 stephenahiggins

Update: I've managed to get this working in Docker via the Rosetta emulation (adding platform: linux/x86_64 to docker-compose.yaml.

docker-compose:

services:
    php:
        build:
            context: docker/php
            args:
                TIMEZONE: ${TIMEZONE}
        volumes:
            - ./:/var/www/symfony:cached
        networks:
            - my_app
        platform: linux/x86_64

Dockerfile:

FROM php:8.2-fpm-buster
ARG TIMEZONE

COPY php.ini /usr/local/etc/php/conf.d/docker-php-config.ini
ENV PHP_HOME="/usr/local/bin"
# I've no idea why this is needed
RUN pear config-set php_ini "/usr/local/etc/php/conf.d/docker-php-config.ini"

RUN apt-get update && apt-get install -y \
    gnupg \
    g++ \
    procps \
    openssl \
    git \
    unzip \
    zlib1g-dev \
    libzip-dev \
    libfreetype6-dev \
    libpng-dev \
    libjpeg-dev \
    libicu-dev  \
    libonig-dev \
    libxslt1-dev \
    acl \
    cmake \
    && echo 'alias sf="php bin/console"' >> ~/.bashrc

#Postgres PDO driver install and init
RUN apt-get install -y libpq-dev \
        && docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
        && docker-php-ext-install pdo pdo_pgsql pgsql

####### SNOWFLAKE CONFIG START #######
# Source: https://devilbox.discourse.group/t/how-to-setup-snowflake-pdo/710
RUN mkdir /tmp/snowflake \
    && git clone https://github.com/snowflakedb/pdo_snowflake.git /tmp/snowflake
RUN export PHP_HOME \
    && bash /tmp/snowflake/scripts/build_pdo_snowflake.sh \
    && cp /tmp/snowflake/libsnowflakeclient/cacert.pem /tmp/snowflake/modules/pdo_snowflake.so /usr/local/lib/php/extensions/no-debug-non-zts-*/ \
    && mkdir /etc/php-snowflake \
    && cp /tmp/snowflake/libsnowflakeclient/cacert.pem /etc/php-snowflake/cacert.pem \
    && rm -rf /tmp/snowflakeindex

# Snowflake is also included in php.ini (see line 5)
####### SNOWFLAKE CONFIG END #######

# Set timezone
RUN ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && echo ${TIMEZONE} > /etc/timezone \
    && printf '[PHP]\ndate.timezone = "%s"\n', ${TIMEZONE} > /usr/local/etc/php/conf.d/tzone.ini \
    && "date"

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Install xdebug
RUN pecl install xdebug \
      && docker-php-ext-enable xdebug
# Set work directory
WORKDIR /var/www/symfony

stephenahiggins avatar Jan 31 '24 11:01 stephenahiggins

Most build problems exists because this repository used prebuilt libraries dependencies instead of letting us build them on our own, which increases quite a bit repository size and prevents this extension to be distributed on distros.

kissifrot avatar Feb 05 '24 07:02 kissifrot

hi and thank you for submitting this issue ! since v2.0.0 of the driver the mac arm64 should be supported, but indeed we do not support linux arm64 yet.

there's now an enhancement request open - and i'll keep this thread posted with the progress if any. Thank you for bearing with us !

sfc-gh-dszmolka avatar Feb 23 '24 13:02 sfc-gh-dszmolka

@sfc-gh-dszmolka are there any tricks to getting the Mac ARM64 support going? I'm running into the same error as SNOW-979091 (build2.txt) running the install script in a Debian Docker container on a M1 Pro processor system.

nbennett25 avatar Mar 06 '24 18:03 nbennett25

hi @nbennett25 so checking this on a M1 Mac, this seems to happen

% uname -m
arm64
% docker run debian:12 uname -m 
aarch64 # <-- linux arm64 is not supported yet
% docker run --platform=linux/amd64 debian:12 uname -m
x86_64

if you run the Debian container without forcing the platform, by default it will run as arm64 as the host M1 Mac OS. But for Linux it's not supported yet in the PHP driver.

I would recommend running it as amd64 with forcing the platform as seen in the above example. Hope it helps.

sfc-gh-dszmolka avatar Mar 10 '24 15:03 sfc-gh-dszmolka