Swoole-src: MacOS MoJave10.14.5编译安装swoolev4.4.0失败

Created on 12 Jul 2019  ·  4Comments  ·  Source: swoole/swoole-src

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a simple script for reproducing the error.
 phpize-7.3.5 
./configure  
sudo make && make install
  1. What did you expect to see?

正常安装swoole

  1. What did you see instead?

安装的扩展目录不是我预期的

Installing shared extensions:     /usr/lib/php/extensions/no-debug-non-zts-20160303/
cp: /usr/lib/php/extensions/no-debug-non-zts-20160303/#INST@26485#: Permission denied
make: *** [install-modules] Error 1
  1. What version of Swoole are you using (show your php --ri swoole)?

git clone的最新版本v4.4.0

  1. What is your machine environment used (including version of kernel & php & gcc) ?

OS: MacOS Mojave10.14.5 ,已经关掉了rootless(csrutil disable)
PHP:包含默认的php7.1.23 还有我自己安装XAMPP包含的7.3.5

$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

-----------------------------安装过程(使用XAMPP的PHP7.3.5)--------------------------

$ phpize-7.3.5 .
Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731

$ ./configure
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-apple-darwin18.6.0
checking host system type... x86_64-apple-darwin18.6.0
checking target system type... x86_64-apple-darwin18.6.0
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib/php/extensions/no-debug-non-zts-20160303
checking for PHP installed headers prefix... /usr/include/php
....

这里发现默认用的是系统自带的PHP,以及默认的扩展目录

sudo make && make install 
Build complete.
Don't forget to run 'make test'.
....
dsymutil .libs/swoole.so || :
creating swoole.la
(cd .libs && rm -f swoole.la && ln -s ../swoole.la swoole.la)
/bin/sh /Users/spark/work/downloads/swoole-src/libtool --mode=install cp ./swoole.la /Users/spark/work/downloads/swoole-src/modules
cp ./.libs/swoole.so /Users/spark/work/downloads/swoole-src/modules/swoole.so
cp ./.libs/swoole.lai /Users/spark/work/downloads/swoole-src/modules/swoole.la
----------------------------------------------------------------------
Libraries have been installed in:
   /Users/spark/work/downloads/swoole-src/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
     during execution

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------


Installing shared extensions:     /usr/lib/php/extensions/no-debug-non-zts-20160303/
cp: /usr/lib/php/extensions/no-debug-non-zts-20160303/#INST@26485#: Permission denied
make: *** [install-modules] Error 1

请问如何指定我自己安装的PHP路径及扩展路径,指定后可否解决此问题?

感谢,

question

Most helpful comment

php-config 使用绝对路径


./configure --with-php-config=/Applications/XAMPP/bin/php-config

All 4 comments

个人建议:
1、phpize 用绝对路径;
2、./configure 加上 --with-phpize= 加绝对路径
3、make 和 make install 分开,先 make,然后 sudo make install

个人建议:
1、phpize 用绝对路径;
2、./configure 加上 --with-phpize= 加绝对路径
3、make 和 make install 分开,先 make,然后 sudo make install

我用了绝对路径,也加了参数,但还是找的系统默认的PHP
`$ /Applications/XAMPP/bin/phpize-7.3.5 .
Configuring for:
PHP Api Version: 20180731
Zend Module Api No: 20180731
Zend Extension Api No: 320180731
(base)

$ ./configure --with-phpize=/Applications/XAMPP/bin/phpize-7.3.5
configure: WARNING: unrecognized options: --with-phpize
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-apple-darwin18.6.0
checking host system type... x86_64-apple-darwin18.6.0
checking target system type... x86_64-apple-darwin18.6.0
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib/php/extensions/no-debug-non-zts-20160303
checking for PHP installed headers prefix... /usr/include/php
...
`

php-config 使用绝对路径


./configure --with-php-config=/Applications/XAMPP/bin/php-config

php-config 使用绝对路径

./configure --with-php-config=/Applications/XAMPP/bin/php-config

可以啦,多谢!

Was this page helpful?
0 / 5 - 0 ratings