pdo_snowflake
pdo_snowflake copied to clipboard
SNOW-253058: Build for MacOSX successful but extension doesn't load
Hi My goal is to build pdo_snoflake.so for php7.x on MacOSX11
I managed to build pdo_snowflake.so on a 10.13 machine, and the extension is properly loaded on this machine. When I try to use this pdo_snoflake.so on another machine I get this error :
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pdo_snowflake.so' (tried: /usr/local/lib/php/pdo_snowflake.so (dlopen(/usr/local/lib/php/pdo_snowflake.so, 9): Symbol not found: __ZTVN5azure12storage_lite15tinyxml2_parserE
Referenced from: /usr/local/lib/php/pdo_snowflake.so
Expected in: flat namespace
in /usr/local/lib/php/pdo_snowflake.so), /usr/local/lib/php/pecl/20180731//usr/local/lib/php/pdo_snowflake.so.so (dlopen(/usr/local/lib/php/pecl/20180731//usr/local/lib/php/pdo_snowflake.so.so, 9): image not found)) in Unknown on line 0
Is there something I'm missing ? Thanks
Same issue.
If you run ./scripts/build_pdo_snowflake.sh and you see no verbiage the make failed. In my case I open up the the file scripts/_init.sh in which there are several which commands that get ran. Specifically which make3/make. I had to install make/make3 on my mac which allowed the process to proceed. You may run into another issue where your mac doesn't have php.h, that one is a bit more complicated as you'll need to reinstall php through brew or something. Ultimately I ended up throwing up a vagrant box to move forward with this process.
An update for anyone else who comes across this issue as there was very little in regards to troubleshooting:
The above was a start to get the file compiled, but I still had issues getting the plugin installed. I'm using homestead/ubunutu so YMMV, but after compiling, I was still not able to get the module to load properly. I'm not sure which of these finally resolved it for me, but these were my next steps:
Copy cacert.pem from the libsnowflakeclient subdirectory in the repository to the directory containing the PHP configuration files (e.g. /etc/php/7.2/fpm/conf.d for PHP-FPM version 7.2 on Ubuntu). - Instead of dumping the cert in this location, I ended up putting it in /usr/local/php/cacert.pem.
In the same directory that contains the PHP configuration files, create a config file named 20-pdo_snowflake.ini that contains the following settings: - check the read/write perms of your file. When you create it initially, it's probably only going to be 640 or something. The rest of the ini files were set to 777, so I matched. Restarted nginx and the module appeared in the modules list (More info below)
Interestingly enough, running $PHP_HOME/bin/php -dextension=modules/pdo_snowflake.so -m | grep pdo_snowflake
still throws an error for me, but when I run $PHP_HOME/bin/php -dextension=modules/pdo_snowflake.so -m
the extension is listed, and I can access in laravel.
Also noteworthy: running $PHP_HOME/bin/php -dextension=modules/pdo_snowflake.so -m | grep pdo_snowflake
will add an additional .so to whatever you do. This is merely a visual bug. Hopefully it saves you from going down the same rabbit hole I did in trying to find out where in the script is adding an additional .so to the file.
After merging https://github.com/snowflakedb/pdo_snowflake/pull/343 build and extension loading works fine on MacOSX.