snowflakedb / pdo_snowflake

PHP PDO driver for snowflake
Apache License 2.0
59 stars 30 forks source link

SNOW-979091: pdo_snowflake build is failing on Ubuntu 20.04 docker running on Apple M2 #354

Closed olysyuk closed 9 months ago

olysyuk commented 9 months ago

I have submitted this as a support case number 00646737.

Please answer these questions before submitting your issue. In order to accurately debug the issue this information is required. Thanks!

  1. What version of PDO/PHP driver are you using? master, php 8.2, ubuntu 20.04

  2. What operating system and processor architecture are you using? Apple M2 OR emulation of linux/amd64

  3. What version of C/C++ compiler are you using? gcc-9 9.4.0 libtool (2.4.6-14) cmake 3.16.3

  4. What did you do? Created a Dockerfile with following contents:

FROM ubuntu:20.04

ENV DEBIAN_FRONTEND="noninteractive"

RUN apt-get update && apt-get install -qqy apt-utils apt-transport-https software-properties-common \
    && add-apt-repository ppa:ondrej/php && apt-get update
RUN apt-get -qqy install git php-dev cmake gcc

ENV PHP_HOME=/usr
RUN git clone https://github.com/snowflakedb/pdo_snowflake.git
WORKDIR /pdo_snowflake
RUN /bin/bash ./scripts/build_pdo_snowflake.sh

Run docker buildx build --platform=linux/amd64 --progress=plain -t test:test1 . and it has succeeded Run docker buildx build --platform=linux/arm64/v8 --progress=plain -t test:test1 . and it has failed

  1. What did you expect to see?

Both builds succeed. One build succeeded with

#9 68.86 libtool: link: ( cd ".libs" && rm -f "pdo_snowflake.la" && ln -s "../pdo_snowflake.la" "pdo_snowflake.la" )
#9 68.89 /bin/bash /pdo_snowflake/libtool --mode=install cp ./pdo_snowflake.la /pdo_snowflake/modules
#9 69.05 libtool: install: cp ./.libs/pdo_snowflake.so /pdo_snowflake/modules/pdo_snowflake.so
#9 69.08 libtool: install: cp ./.libs/pdo_snowflake.lai /pdo_snowflake/modules/pdo_snowflake.la
#9 69.30 libtool: finish: PATH="/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /pdo_snowflake/modules
#9 69.32 ----------------------------------------------------------------------
#9 69.32 Libraries have been installed in:
#9 69.32    /pdo_snowflake/modules
#9 69.32 
#9 69.32 If you ever happen to want to link against installed libraries
#9 69.32 in a given directory, LIBDIR, you must either use libtool, and
#9 69.32 specify the full pathname of the library, or use the '-LLIBDIR'
#9 69.32 flag during linking and do at least one of the following:
#9 69.32    - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
#9 69.32      during execution
#9 69.32    - add LIBDIR to the 'LD_RUN_PATH' environment variable
#9 69.32      during linking
#9 69.32    - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
#9 69.32    - have your system administrator add LIBDIR to '/etc/ld.so.conf'
#9 69.32 
#9 69.32 See any operating system documentation about shared libraries for
#9 69.32 more information, such as the ld(1) and ld.so(8) manual pages.
#9 69.32 ----------------------------------------------------------------------
#9 69.34 
#9 69.37 Build complete.
#9 69.39 Don't forget to run 'make test'.
#9 69.41 
#9 69.42 Linking for Linux
#9 70.96 libtool: install: cp ./.libs/pdo_snowflake.so /pdo_snowflake/modules/pdo_snowflake.so
#9 70.99 libtool: install: cp ./.libs/pdo_snowflake.lai /pdo_snowflake/modules/pdo_snowflake.la
#9 71.21 libtool: finish: PATH="/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /pdo_snowflake/modules

Apple M2 build has failed with

libtool: link: cc -shared  -fPIC -DPIC  .libs/pdo_snowflake.o .libs/snowflake_driver.o .libs/snowflake_stmt.o .libs/snowflake_paramstore.o .libs/snowflake_arraylist.o .libs/snowflake_treemap.o .libs/snowflake_rbtree.o   libsnowflakeclient/lib/linux/libsnowflakeclient.a libsnowflakeclient/deps-build/linux/openssl/lib/libcrypto.a libsnowflakeclient/deps-build/linux/openssl/lib/libssl.a libsnowflakeclient/deps-build/linux/curl/lib/libcurl.a libsnowflakeclient/deps-build/linux/oob/lib/libtelemetry.a libsnowflakeclient/deps-build/linux/aws/lib64/libaws-cpp-sdk-core.a libsnowflakeclient/deps-build/linux/aws/lib64/libaws-cpp-sdk-s3.a libsnowflakeclient/deps-build/linux/azure/lib/libazure-storage-lite.a libsnowflakeclient/deps-build/linux/arrow/lib/libarrow.a libsnowflakeclient/deps-build/linux/arrow_deps/lib/libjemalloc_pic.a libsnowflakeclient/deps-build/linux/boost/lib/libboost_filesystem.a libsnowflakeclient/deps-build/linux/boost/lib/libboost_regex.a libsnowflakeclient/deps-build/linux/boost/lib/libboost_system.a  -g -O2 -Wl,--whole-archive -Wl,--no-whole-archive   -Wl,-soname -Wl,pdo_snowflake.so -o .libs/pdo_snowflake.so
#9 2.033 /usr/bin/ld: libsnowflakeclient/lib/linux/libsnowflakeclient.a(client.c.o): Relocations in generic ELF (EM: 62)
#9 2.033 /usr/bin/ld: libsnowflakeclient/lib/linux/libsnowflakeclient.a(client.c.o): Relocations in generic ELF (EM: 62)
#9 2.033 /usr/bin/ld: libsnowflakeclient/lib/linux/libsnowflakeclient.a(client.c.o): Relocations in generic ELF (EM: 62)
#9 2.033 /usr/bin/ld: libsnowflakeclient/lib/linux/libsnowflakeclient.a(client.c.o): Relocations in generic ELF (EM: 62)
#9 2.033 /usr/bin/ld: libsnowflakeclient/lib/linux/libsnowflakeclient.a(client.c.o): Relocations in generic ELF (EM: 62)
#9 2.033 /usr/bin/ld: libsnowflakeclient/lib/linux/libsnowflakeclient.a(client.c.o): Relocations in generic ELF (EM: 62)
#9 2.033 /usr/bin/ld: libsnowflakeclient/lib/linux/libsnowflakeclient.a(client.c.o): Relocations in generic ELF (EM: 62)
#9 2.033 /usr/bin/ld: libsnowflakeclient/lib/linux/libsnowflakeclient.a(client.c.o): Relocations in generic ELF (EM: 62)
#9 2.033 /usr/bin/ld: libsnowflakeclient/lib/linux/libsnowflakeclient.a: error adding symbols: file in wrong format
#9 2.033 collect2: error: ld returned 1 exit status
#9 2.034 make: *** [Makefile:232: pdo_snowflake.la] Error 1

See detailed build logs build1.txt build2.txt

sfc-gh-dszmolka commented 9 months ago

hi and thank you for raising this issue. Unfortunately, this is a known limitation and this architecture is indeed not supported yet. See #351

we'll clarify this in the readme.md too (https://github.com/snowflakedb/pdo_snowflake/pull/358). While this gets implemented, please consider using the Snowflake ODBC driver in PHP which supports multiple architectures.

ccachor commented 8 months ago

hi and thank you for raising this issue. Unfortunately, this is a known limitation and this architecture is indeed not supported yet. See #351

we'll clarify this in the readme.md too (#358). While this gets implemented, please consider using the Snowflake ODBC driver in PHP which supports multiple architectures.

Is there an estimated timeframe for this?

sfc-gh-dszmolka commented 8 months ago

at this moment, i'm not aware of any particular timeline. However as with all improvement requests: if you're already a Snowflake customer, do reach out to your account team please (Sales rep is SPOC) and word how the particular improvement is important for your use case. This can be then used to prioritize amongst the requests.