macos m1安装seaslog遇到arch不一致(已解决)
gzGunsTan opened this issue · 0 comments
设备:macos m1
报错现象:make test
出现:
PHP : /Applications/MAMP/bin/php/php7.4.12/bin/php
Warning: PHP Startup: Unable to load dynamic library 'seaslog.so' (tried: /Users/flyhold/mycode/SeasLog-2.2.0/modules/seaslog.so (dlopen(/Users/flyhold/mycode/SeasLog-2.2.0/modules/seaslog.so, 9): no suitable image found. Did find:
/Users/flyhold/mycode/SeasLog-2.2.0/modules/seaslog.so: mach-o, but wrong architecture
/Users/flyhold/mycode/SeasLog-2.2.0/modules/seaslog.so: stat() failed with errno=22), /Users/flyhold/mycode/SeasLog-2.2.0/modules/seaslog.so.so (dlopen(/Users/flyhold/mycode/SeasLog-2.2.0/modules/seaslog.so.so, 9): image not found)) in Unknown on line 0
排查&解决过程:
1、确定php arch
~$ which php
/Applications/MAMP/bin/php/php7.4.12/bin/php
~$ file /Applications/MAMP/bin/php/php7.4.12/bin/php
/Applications/MAMP/bin/php/php7.4.12/bin/php: Mach-O 64-bit executable x86_64
确定是x86_64 架构
2、编译安装seaslog时,使用对应架构编译
~$ cd SeasLog-2.2.0
~$ arch -X86_64 ./configure
~$arch -X86_64 make&make test
~$make install
3、php.ini 加入SeasLog.so扩展
4、测试
~$ php -m |grep Seas
SeasLog
~$ php --ri SeasLog
SeasLog
SeasLog support => Enabled
SeasLog Version => 2.2.0
SeasLog Author => Chitao.Gao [ neeke@php.net ]
SeasLog Supports => https://github.com/SeasX/SeasLog
5、总结,php arch 与扩展arch 要一致