Does anyone succeeds into compiling excel.so for Apple silicon M1?
[edit: I finally did, please read what I tried and finally succeeded to do]
I tried with PHP 7.4.21 to compile libXL v3.8.5.0 (which worked on Intel), I tried libXL v3.8.8.0 and libXL v4.0.0.0. For this latter, I had to patch the source of excel.c like this so that it compiles:
So this should "work" but PHP crashes anyway after rebuilding excel.so against this 3.9.3.0 version of libXL.
Something's strange:
$ otool -L libxl-mac-3.9.3.0/lib/libxl.dylib
libxl-mac-3.9.3.0/lib/libxl.dylib (architecture x86_64):
libxl.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1746.0.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1109.1.1)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 904.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.0.0)
libxl-mac-3.9.3.0/lib/libxl.dylib (architecture arm64):
libxl.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1746.0.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1109.1.1)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 904.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.0.0)
$ sudo cp -p libxl-mac-3.9.3.0/lib/libxl.dylib /usr/local/lib/
$ otool -L /usr/local/lib/libxl.dylib
fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: fatal error in /Library/Developer/CommandLineTools/usr/bin/otool-classic
Digging this problem, I found this: https://developer.apple.com/forums/thread/688830, which solved this issue by first deleting any /usr/local/lib/libxl.dylib prior to copying the version I wanted.
Unfortunately it doesn't help to fix the PHP crash. Recompiling again, I now had the same 4 errors in excel.c when using v3.9.3.0 as I had with v4.0.0.0, so I updated my patch to read 4 times
+#if LIBXL_VERSION >= 0x03090300
instead of
+#if LIBXL_VERSION >= 0x04000000
But nothing helps, either with v3.9.3.0 or v4.0.0.0.
Hi there,
Does anyone succeeds into compiling
excel.so
for Apple silicon M1?[edit: I finally did, please read what I tried and finally succeeded to do]
I tried with PHP 7.4.21 to compile libXL v3.8.5.0 (which worked on Intel), I tried libXL v3.8.8.0 and libXL v4.0.0.0. For this latter, I had to patch the source of
excel.c
like this so that it compiles:When trying to load the
excel.so
extension, PHP crashes right away (<process id> Killed: 9
).After double checking I found this:
So obviously v3.8.5.0 and v3.8.8.0 cannot be used anyway, I succeeded downloading version 3.9.3.0, which results into:
So this should "work" but PHP crashes anyway after rebuilding
excel.so
against this 3.9.3.0 version of libXL.Something's strange:
Digging this problem, I found this: https://developer.apple.com/forums/thread/688830, which solved this issue by first deleting any
/usr/local/lib/libxl.dylib
prior to copying the version I wanted.Unfortunately it doesn't help to fix the PHP crash. Recompiling again, I now had the same 4 errors in
excel.c
when using v3.9.3.0 as I had with v4.0.0.0, so I updated my patch to read 4 timesinstead of
But nothing helps, either with v3.9.3.0 or v4.0.0.0.
I finally remembered that my build script was doing that (thanks to https://github.com/iliaal/php_excel/issues/146):
So I tried NOT doing it, and IT WORKS!!!!
does not crash and shows
excel
!Note: Possibly it would work with libXL v4.0.0.0 (now that there's no
install_name_tool
command to run) but I let you try on your own...