您的位置 首页 php

Mac Silicon M1 编译安装 PHP8 & Swoole4.6 ARM64 全过程记录

最近搞了一台 M1 的 Mac mini 准备用这个开发 mixphp v3 版本,之前尝试了几次没有编译成功,今天再次尝试安装成功了,特此分享让后续的人闭坑。

面临的问题

由于最新版本的 macOS Big Sur 即便关闭安全模式 /usr/lib 也无法写入文件,因此导致 make install 无法安装任何 php 扩展,因此想装 Swoole 只能自行编译安装 php 到 /usr/local 目录

 % csrutil status
System Integrity Protection status: disabled.
% mkdir /usr/lib/php/extensions/test
mkdir: /usr/lib/php/extensions/test: Read-only file system  

PHP Build

由于 brew arm64 版本无法使用,只能采用 x64 版本安装了一些依赖,后面导致了很多问题,本想编译一个 x64 PHP+Swoole 在编译 x64 Swoole 的时候异常就没有继续了,转而研究 arm64 PHP+Swoole

 arch -x86_64 brew install  OpenSSL  zlib curl libjpeg libpng libxml2 gettext freetype pcre libiconv libzip  

参数中的路径都需要根据自己电脑所安装的实际路径替换

 ./configure --prefix=/usr/local/php8.0.7 --with-config-file-path=/usr/local/php8.0.7/etc --with-config-file-scan-dir=/usr/local/php8.0.7/etc/php.d --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --with-mhash --enable-tokenizer --enable-pcntl --enable-sockets --enable-soap --enable-simplexml --without-pear --with-pear --with-zlib=/usr/local/opt/zlib --with-curl=/usr/local/Cellar/curl/7.77.0 --with-openssl=/usr/local/Cellar/openssl@1.1/1.1.1k --with-iconv=/usr/local/Cellar/libiconv/1.16
make  

PHP Build ERROR: No package ‘openssl’ found

需要编译安装arm64: openssl (系统自带的 LibreSSL 不可以)

基于 Mac Silicon M1 的OpenSSL 编译:

 sudo cp /usr/local/openssl/lib/pkgconfig/* /usr/local/lib/pkgconfig/  

继续编译:php (将 –with-openssl 更换为 /usr/local/openssl)

PHP Build ERROR: configure: error: Please reinstall the iconv library

需要编译安装arm64:iconv

  wget  
tar xvzf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make && sudo make install  

继续编译:php (将 –with-iconv 更换为 /usr/local/libiconv)

PHP Build ERROR: ld: warning: ignoring file /usr/local/Cellar/oniguruma/6.9.7.1/lib/libonig.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

需要编译安装arm64:oniguruma

 wget 
tar xvzf v6.9.5_rev1.tar.gz
cd oniguruma-6.9.5_rev1
./autogen.sh  

Oniguruma Build ERROR: autoreconf: error: aclocal failed with exit status: 2

需要安装: automake ,安装了一个x64的也可以用

 arch -x86_64 brew install automake  

继续编译:oniguruma

 ./autogen.sh
./configure --prefix=/usr/local/oniguruma
make && sudo make install  

移除 x64 oniguruma 将 arm64 oniguruma 关联到系统

 arch -x86_64 brew uninstall oniguruma
sudo cp /usr/local/oniguruma/lib/pkgconfig/* /usr/local/lib/pkgconfig/
sudo cp /usr/local/oniguruma/include/* /usr/local/include/
export LDFLAGS="-L/usr/local/oniguruma/lib"
export  CPP FLAGS="-I/usr/local/oniguruma/include"
export PKG_CONFIG_PATH="/usr/local/oniguruma/lib/pkgconfig"  
 make clean
./configure --prefix=/usr/local/php8.0.7 --with-config-file-path=/usr/local/php8.0.7/etc --with-config-file-scan-dir=/usr/local/php8.0.7/etc/php.d --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --with-mhash --enable-tokenizer --enable-pcntl --enable-sockets --enable-soap --enable-simplexml --without-pear --with-pear --with-zlib=/usr/local/opt/zlib --with-curl=/usr/local/Cellar/curl/7.77.0 --with-openssl=/usr/local/openssl --with-iconv=/usr/local/libiconv
make  

PHP Build ERROR: ld: can’t write output file: sapi/phpdbg/phpdbg for architecture arm64

 sudo make && sudo make install  

PHP Build ERROR: PEAR package PHP_Archive not installed: generated phar will require PHP’s phar extension be enabled.

忽略这个异常

PHP Build ERROR: Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0

 sudo vim /Users/liujian/Downloads/php-8.0.7/ext/phar/phar.php  

新增 ini_set(“pcre.jit”, “0”);

 sudo make install  

Swoole Build

增加一个 –enable-thread-context ,并指定 –with-openssl-dir 为编译版本的路径

 wget 
tar xvzf v4.6.7.tar.gz
cd swoole-src-4.6.7
./configure --with-php-config=/usr/local/php8.0.7/bin/php-config --enable-openssl --enable-http2 --enable-thread-context --with-openssl-dir=/usr/local/openssl
make && sudo make install  

文章来源:智云一二三科技

文章标题:Mac Silicon M1 编译安装 PHP8 & Swoole4.6 ARM64 全过程记录

文章地址:https://www.zhihuclub.com/80160.shtml

关于作者: 智云科技

热门文章

评论已关闭

41条评论

  1. 6 MG Tadalafil Chewables When VIAGRA levitra generia preis is contraindicated of the same kind as the two-backed beast q

  2. The effectiveness of Viagra may differ from one person to another Viagra may work for some but have little effect on another person

  3. Clomiphene Citrate has advantage of not affecting fertility and not blocking the Hypothalamus-Pituitary-Testis HPT axis.

  4. If signs or symptoms of congestive heart failure occur during administration of SPORANOX Capsules, discontinue administration. Unit costs of intervention contacts.

  5. ive gained weight also i am 51 im on a diet thru my doctor and i also quit smoking about 10 years ago and i sweat so bad when im in quire at church my hair is drenched when i sit down For example, where a therapeutic agent of the dendrimer induces apoptosis of a target cell e

  6. Bourland J, et al In this study, there was no association of total sun exposure score a proxy measure of 25 OH D concentrations with serum 25 OH D concentrations or breast cancer risk

  7. abilify inderal 10 mg and weight gain Jon Hamm hosted the star studded ESPY Awards where athletes and HollywoodГў Moreover, information is limited upon statin dose and exact duration of administration although reported at the initial visit that it was taken on a chronic basis and intended to be continued lifelong, recently reported to affect outcome

  8. The compound according to the invention may be formulated for use in human or veterinary medicine by injection e

  9. Professor of Obstetrics and Gynecology, Director of Reproductive Endocrinology, Fertility, Menopause, University of Massachusetts Medical Center, 01655, Worcester, MA, USA

  10. Another form of dominantly inherited euthyroid hyperthyroxinemia, later to be linked to the albumin gene, is known as familial dysalbuminemic hyperthyroxinemia FDH

  11. The presence of DM was a risk factor for ALT elevation in these patients TamPA Cre is inactive as its NLS pMag CreC and ERT2 CreN nMag protein halves nuclear and cytosolically localized, respectively

  12. rucaparib will increase the level or effect of carbamazepine by affecting hepatic intestinal enzyme CYP3A4 metabolism

  13. At the final analysis, performed at a median follow up of 31 months, there was no significant improvement in invasive DFS with the addition of palbociclib HR, 0 Nathanael WINTOnyEVFhUSwhEu 5 19 2022

  14. Lawrence, USA 2022 06 16 19 25 31 Furthermore, retention of a mitogenic response to estrogen in the apparent absence of progesterone receptor induction has not been described previously in model systems

  15. Also be aware that you will only be permitted a limited number of cycles with Clomid Ma and colleagues 25 have recently demonstrated that dietary restriction of serine and glycine reduces the circulating levels of these amino acids over time courses similar to those in our experiment

  16. 5 ОјL 5 sequence buffer 1 96 C, 0 45 1 ОјL Sequence primer 10ОјM 2 96 C, 0 10 4 ОјL PCR product 3 58 C, 0 05 0 The tests used to diagnose abnormal uterine bleeding may be based on that charting and the symptoms you are having

  17. Women diagnosed with hormone receptor positive breast cancer who are postmenopausal should be offered adjuvant endocrine therapy with one of the following options tamoxifen for 10 years; an AI for 5 years; tamoxifen for 5 years, then switching to an AI for up to 5 years; or tamoxifen for 2 3 years, then switching to an AI for up to 5 years

  18. Venlafaxine CYP2D6 poor metabolizers Alters systemic parent drug and metabolite concentrations KREM 2 News is a Hagadone News Network news partner

  19. The biggest thing they have going for them is name recognition CA125 guided diuretic treatment versus usual care in patients with acute heart failure and renal dysfunction

  20. Nephrotic syndrome may manifest elevated levels of apolipoproteins B, C II and E, which are associated with VLDL and LDL particles; on the other hand, the levels of the major apolipoproteins associated with HDL apolipoproteins A I and A II are usually normal 136

  21. Further development of discriminatory models incorporating these parameters might prove clinically useful in assessment of nonadherence in countries where biochemical analysis is unavailable

  22. The opportunities of structural biology have expanded tremendously with the increase in the spatial resolution of cryogenic electron microscopy cryo EM

  23. 2011b; Cusack, 2003; Cvek and Dvorak, 2011; Einsele, 2010; Ludwig et al PMC free article PMC3383464 PubMed 22870433

  24. Praziquantel and ivermectin are ineffective antiparasitic agents for Borrelia Differential gene analysis showed multiple differentially expressed genes between 2 EC subtypes, while protein CD34 EC acquired a stronger capacity of endothelium development and blood vessel morphogenesis Figure IIIC in the Data Supplement

  25. Even neon women feel that it is very embarrassing for her husband to go home too early, because the hard working people are still working, why did you go home In short, under the influence of this culture, the Yamato nation started a plan to catch up with Xingchen Technology in an all round way Individual antibiotics demonstrate a range of impacts on biogas production, from no effect to complete inhibition

  26. I believe that having the information from the Onco type DX assay in some cases can lead to a much more complicated situation in which the patient experiences a long period of recovery from toxicity for marginal benefit Regardless of your purpose you can expect to receive the following benefits to one degree or another

  27. Experimental in vivo observations show that VDR deficient mice are more susceptible to the development of skin tumors either induced by chemical carcinogens such as 7, 12 dimethylbenzanthracene DMBA or by chronic UVR exposure Bikle, 2012 and Storey, J

  28. Mouse anti claudin 2 catalog no When C Span shows a House or Senatevote, or a House or Senate committee hearing, CRP could giveC Span the relevant data so that along with the chyron showingthe senator s or congressman s name there would be a listing ofthe amount of money he or she has taken in the last four oreight years from the interest groups most affected by the issuebeing debated

  29. One example is the common allergy drug diphenhydramine also known by the brand name Benadryl

  30. Zhongguo Zhong Yao Za Zhi 2009; 34 2079 82 Other symptom outcome measures included the patient global assessment PGA of disease, consumption of pain medication, and the use of walking aids

  31. How do you expect companieswhich are suffering from heavy losses to find cash This can be caused by smoking, inhaling harmful chemicals, and regular exposure to air pollution

  32. It is also a favorite cutting agent to mix with cocaine There was no benefit in terms of survival or recurrence free survival for women treated with lymphadenectomy

  33. Patient reported mood, symptoms, and QOL improved in both groups, and there were no statistically significant differences between the two groups in any of these measures

网站地图