-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile errors on M1 ARM Mac #32
Comments
|
You need an M1 build of libfbclient before you would even be able to build a M1 build of php-firebird. As far as I'm aware, there is no M1 build of Firebird/libfbclient. |
I don't see this file anywhere, doesn't look like being part of the Firebird or firebird-php install either. From my research looks like it should be part of firebird-dev package on Linux, but apparently there is nothing like it for MacOS.
Well I see |
On 6/15/22 14:05, Jan Zikmund wrote:
Unfortunately the log doesn't give me many pointers, but I have
checked that
/Library/Frameworks/Firebird.framework/Versions/Current/Libraries
contains |libfbclient.dylib| and |libib_util.dylib| but |libgds.dylib|
is missing, not sure how far that's an issue. I tried to look it up,
but without success. I even replaced Firebird 3.0.10 by older 3.0.5
LIPO package from here <https://firebirdsql.org/en/firebird-3-0-5/> ,
but even here the |libgds| is missing.
|libgds.dylib should be a symbolic link to libfbclient.dylib, create it
yourself and repeat build process
|
|
I got the following from Paul Beach privately, because it seems he couldn't post it here (at least not by mail):
Maybe it can help. |
Thanks, I have it installed in place of my original 3.0.10. When I now try to compile php-firebird using
I've tried that, both with 3.0.10 and the 3.0.8 M1, but unfortunately makes no difference. |
An update for anyone interested: The M1-compiled beta 3.0.8 linked above is not really usable, because it behaves very buggy on SQL queries where For the PHP connection itself, unfortunately no success, still having the errors as per above and I am just unable to crack this without the core team fixing it. So I rather focused on creating a Docker container with Debian version of PHP and that seems to be the correct way. I have it pretty much working, just need to fix a few things and then I will link it here as a walk-around solution until (if ever) is the driver issue for ARM Macs resolved. |
Ok, here are the docker files. They just need to be placed in the project folder and then run using That being said, it would still be nice to have a native adapter so if anyone reading this has an idea how to compile the native php-firebird extension on ARM, please share your findings. # Dockerfile
FROM php:7.4-apache
# allows PHP to check the environment using <?php if(getenv('RUNNING_IN_DOCKER_CONTAINER')) { ...
ENV RUNNING_IN_DOCKER_CONTAINER=1
# Install Some Additional Packages
RUN apt-get update && apt-get install -y \
build-essential \
libpng-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
locales \
unzip \
libaio1 \
jpegoptim optipng pngquant gifsicle \
curl \
wget \
git \
firebird-dev
# Copy default php.ini
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
# Build firebird driver
RUN cd /tmp; \
git clone -v https://github.com/FirebirdSQL/php-firebird.git; \
cd php-firebird; \
phpize; \
CPPFLAGS=-I/usr/include/firebird ./configure ; \
make; \
make install; \
echo "extension=interbase.so" > /usr/local/etc/php/conf.d/ext-interbase.ini;
# Remove Cache
RUN apt-get clean && rm -rf /var/lib/apt/lists*
# Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# PDO_Firebird (not necessary if we go with AdoDB)
RUN docker-php-ext-install pdo_firebird
# Restart apache
RUN apachectl -k restart; # docker-compose.yaml
version: '3'
services:
web_app:
container_name: my-app
build:
context: .
dockerfile: Dockerfile
image: my-apache-php74-firebird
tty: true
ports:
- "8080:80"
working_dir: /var/www/html
volumes:
- .:/var/www/html/ |
Hi @janzikmund. In my experience, you must have an arm version of Firebird to successfully compile the extension on an arm mac. Since Firebird 4.0.2, there is official support for mac arm, meaning you can compile the source following the build instructions in their GitHub workflows file main.yml (https://github.com/FirebirdSQL/firebird/blob/v4.0-release/.github/workflows/main.yml). I have no idea why there is no official binary, though. Anyway, I'm attaching my compilation of version 4.0.2-2816. Hope it helps. By the way, I use the same steps described in first post to compile php-firebird. |
@janzikmund very great solution! Solved my issue. I was trying to mount exactly that. Thank you !! |
On my old, Intel-based MacBook (BigSur, PHP7.4, Firebird 3.0.10), I managed to compile the driver just fine using the following steps:
git clone https://github.com/FirebirdSQL/php-firebird.git
cd php-firebird
phpize
CPPFLAGS=-I/Library/Frameworks/Firebird.framework/Versions/Current/Headers LDFLAGS=-L/Library/Frameworks/Firebird.framework/Versions/Current/Libraries ./configure
make
This gave me the compiled
modules/interbase.so
file, which I then copied to my extension_dir and enabled inphp.ini
.Now when attempting the same on the new M1 ARM MacBook with MacOS Monterey, it just fails on step 4 with the following:
configure: error: libfbclient, libgds or libib_util not found! Check config.log for more information.
Unfortunately the log doesn't give me many pointers, but I have checked that /Library/Frameworks/Firebird.framework/Versions/Current/Libraries contains
libfbclient.dylib
andlibib_util.dylib
butlibgds.dylib
is missing, not sure how far that's an issue. I tried to look it up, but without success. I even replaced Firebird 3.0.10 by older 3.0.5 LIPO package from here , but even here thelibgds
is missing.I found out that if I do step 4 with additionally passing architecture flag, it helps and the following compiles successfully:
CFLAGS='-arch x86_64' CPPFLAGS=-I/Library/Frameworks/Firebird.framework/Headers LDFLAGS=-L/Library/Frameworks/Firebird.framework/Resources/lib ./configure
The problem is, that after moving the resulting
interbase.so
to php extension_dir, it just doesn't load and PHP states the following error, which is probably reasonable:Warning: PHP Startup: Unable to load dynamic library 'interbase.so' (tried: /opt/homebrew/lib/php/pecl/20190902/interbase.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/interbase.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20190902/interbase.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))), /opt/homebrew/lib/php/pecl/20190902/interbase.so.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/interbase.so.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20190902/interbase.so.so' (no such file))) in Unknown on line 0
.. where the important part imo is the mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')
So I try from scratch and replace step 4 with
CFLAGS='-arch arm64e' CPPFLAGS=-I/Library/Frameworks/Firebird.framework/Headers LDFLAGS=-L/Library/Frameworks/Firebird.framework/Resources/lib ./configure
, but that terminates after a few lines of output with the following:I even tried with
-arch arm64
instead of-arch arm64e
, but in that case I just get theconfigure: error: libfbclient, libgds or libib_util not found!
error again.Has anyone managed to do it successfully? Only guidelines I found is this SO thread, but that suggests replacing PHP and other brew dependecies by 64bit versions, and I am not sure if that would work at all with my webserver (Laravel Valet).
The text was updated successfully, but these errors were encountered: