Skip to content
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

I cannot install PHP 7.1.9 on macOS 10.11.6 (El Capitan) #899

Closed
peracchi opened this issue Sep 3, 2017 · 18 comments
Closed

I cannot install PHP 7.1.9 on macOS 10.11.6 (El Capitan) #899

peracchi opened this issue Sep 3, 2017 · 18 comments
Labels

Comments

@peracchi
Copy link

peracchi commented Sep 3, 2017

Despite the warning, I do not believe the problem is caused by the rootless mode.

Command used:
$ phpbrew install 7.1.9 +default +dbs +fpm +gd +intl -- --with-gd=shared

Output:

#WARNING: it seems you are running PHPBrew under MacOS 10.11 or above with rootless enabled. it's recommended turn off rootless before your continue, or you may experience some issues.
===> phpbrew will now build 7.1.9
===> Loading and resolving variants...
Downloading http://www.php.net/get/php-7.1.9.tar.bz2/from/this/mirror via curl extension
Redirecting to http://php.net/distributions/php-7.1.9.tar.bz2
[==================================================================] 14.39/14.39MB 100%
===> Extracting /Users/peracchi/.phpbrew/distfiles/php-7.1.9.tar.bz2 to /Users/peracchi/.phpbrew/build/tmp.1504466886/php-7.1.9
===> Moving /Users/peracchi/.phpbrew/build/tmp.1504466886/php-7.1.9 to /Users/peracchi/.phpbrew/build/php-7.1.9
===> Checking patches...
Checking patch for replace apache php module name with custom version name
===> Configuring 7.1.9...


Use tail command to see what's going on:
   $ tail -F /Users/peracchi/.phpbrew/build/php-7.1.9/build.log


===> Checking patches...
Checking patch for php5.3.29 multi-sapi patch.
Checking patch for php5.3.x on 64bit machine when intl is enabled.
Checking patch for openssl dso linking patch
6 changes patched.
===> Building...
Error: Make failed:
The last 5 lines in the log file:
/usr/local/Cellar/icu4c/59.1/include/unicode/unistr.h:3180:7: error: delegating constructors are permitted only in C++11

      UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {}

      ^~~~~~~~~~~~~

2 warnings and 3 errors generated.

make: *** [ext/intl/intl_convertcpp.lo] Error 1

Please checkout the build log file for more details:
	 tail /Users/peracchi/.phpbrew/build/php-7.1.9/build.log

Additional info:

$ brew config
HOMEBREW_VERSION: 1.3.1
ORIGIN: https://github.com/Homebrew/brew
HEAD: 69799d97b1e7314912b2ee234dec2c179c5fb969
Last commit: 4 weeks ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: e45386e283911db18e69aeefbc69d6608343e555
Core tap last commit: 2 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit sandybridge
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.10.1 => /Library/Developer/CommandLineTools/usr/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /Users/peracchi/.rvm/rubies/ruby-2.4.1/bin/ruby
Java: 1.8.0_144
macOS: 10.11.6-x86_64
Xcode: N/A
CLT: 8.2.0.0.1.1480973914
X11: N/A
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ brew list
adns		curl		gettext		intltool	libgcrypt	libtiff		libyaml		nginx		pcre		readline
autoconf	dnsmasq		gmp		jpeg		libgpg-error	libtool		mcrypt		npth		pinentry	webp
automake	fontconfig	gnupg		libassuan	libksba		libunistring	mhash		openssl		pkg-config
bison		freetype	gnutls		libevent	libpng		libusb		mysql		openssl@1.1	postgresql
coreutils	gd		icu4c		libffi		libtasn1	libxml2		nettle		p11-kit		re2c
$ brew info icu4c
icu4c: stable 59.1 (bottled), HEAD [keg-only]
C/C++ and Java libraries for Unicode and globalization
http://site.icu-project.org/
/usr/local/Cellar/icu4c/59.1 (246 files, 65.4MB) *
  Poured from bottle on 2017-09-03 at 13:53:57
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/icu4c.rb
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/icu4c/lib
    CPPFLAGS: -I/usr/local/opt/icu4c/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/icu4c/lib/pkgconfig

Any idea on how to proceed?

@patrickjahns
Copy link

This problem is related to icu4c version 59.1.

Install an older version of icu4c (i.e. 58.2) and manually link against it:
--with-icu-dir=/usr/local/Cellar/icu4c/58.2/

@peracchi
Copy link
Author

peracchi commented Sep 4, 2017

@patrickjahns how can I install version 58.2 of icu4c with brew?

I have made a complete reinstallation of my Macbook and homebrew installs version 59.1 of icu4c.

@patrickjahns
Copy link

You can install it via directly linking to an older version of the homebrew formula:

brew install https://raw.githubusercontent.com/ilovezfs/homebrew-core/d2485c72643aa7e6aec0da9ced3aa66401ae42ce/Formula/icu4c.rb

I would recommend that you link 59.1 to /usr/... and keep 58.2 in the cellar for php.

The better/more import fix would be, that phpbrew uses ENV.cx11 environment - see related issues in homebrew:
https://github.com/Homebrew/homebrew-php/issues/4383

@peracchi
Copy link
Author

peracchi commented Sep 4, 2017

@patrickjahns thanks for the command to install the previous version of icu4c.

I just needed to uninstall 59.1 and then use the command you provided.

@patrickjahns
Copy link

just keep in mind that there might be homebrew packages asking for 59.1 and that will override your version again.

That's why I build it directly against the cellar version

@mirfilip
Copy link

Is it possible to set ENV.cx11 inline, so that we could compile any PHP with intl using icu4c newer than 58.x?

I need the newest icu4c for Node.

@morozov
Copy link
Contributor

morozov commented Jan 12, 2018

@mirfilip it should be technically possible. Could you point to some documentation explaining how PHP can be compiled with icu4c of your choice?

@patrickjahns
Copy link

homebrew-php had also the issue for php-intl - this is how they incorporated ENV.cx11 in their buildscripts:
https://github.com/Homebrew/homebrew-php/pull/4382/files

Related discussion:
https://github.com/Homebrew/homebrew-php/issues/4384

@morozov
Copy link
Contributor

morozov commented Jan 14, 2018

Please feel free to submit a pull request and port the fix from Homebrew.

@mirfilip
Copy link

mirfilip commented Jan 15, 2018

@morozov @patrickjahns I tried but failed. I'm not sure what ENV.cxx11 means in brew nomenclature. I presumed I need to set cxx11 env var to some value, so I went with export cxx11=true before both configure and make steps. It failed with the same error.

@ramsey
Copy link

ramsey commented Jan 16, 2018

I'm having this problem, too, but when I try to install an older version of icu4c, it fails, saying the older version is already installed:

$ brew install https://raw.githubusercontent.com/ilovezfs/homebrew-core/d2485c72643aa7e6aec0da9ced3aa66401ae42ce/Formula/icu4c.rb
######################################################################## 100.0%
Warning: icu4c 58.2 is already installed

However, 58.2 does not appear to be installed:

$ ls /usr/local/Cellar/icu4c
60.2/

I can't uninstall icu4c 60.2, since other homebrew formulas depend on it.

So, I'm stuck, unable to build any new versions of PHP.

@jakesylvestre
Copy link

jakesylvestre commented Jan 21, 2018

I'm still getting this issue:

Jakes-MBP:site jakesyl$ phpbrew ext install intl --with-icu-dir=/usr/local/Cellar/icu4c/58.2/
===> Installing intl extension...
Log stored at: /Users/jakesyl/.phpbrew/build/php-7.1.11/ext/intl/build.log
Changing directory to /Users/jakesyl/.phpbrew/build/php-7.1.11/ext/intl
===> Running make clean: /usr/bin/make -C '/Users/jakesyl/.phpbrew/build/php-7.1.11/ext/intl' --quiet 'clean'
===> Phpize...
===> Configuring...
===> Building...
===> Running make all: /usr/bin/make -C '/Users/jakesyl/.phpbrew/build/php-7.1.11/ext/intl' 'all'  >> '/Users/jakesyl/.phpbrew/build/php-7.1.11/ext/intl/build.log' 2>&1
Error: Command failed: /usr/bin/make -C '/Users/jakesyl/.phpbrew/build/php-7.1.11/ext/intl' 'all'  >> '/Users/jakesyl/.phpbrew/build/php-7.1.11/ext/intl/build.log' 2>&1 returns:
The last 5 lines in the log file:
/usr/local/Cellar/icu4c/60.2/include/unicode/unistr.h:3169:7: error: delegating constructors are permitted only in C++11

      UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {}

      ^~~~~~~~~~~~~

12 warnings and 3 errors generated.

make: *** [intl_convertcpp.lo] Error 1

Please checkout the build log file for more details:
	 tail /Users/jakesyl/.phpbrew/build/php-7.1.11/ext/intl/build.log
Jakes-MBP:site jakesyl$

@ramsey
Copy link

ramsey commented Jan 21, 2018

I was able to get past it by building an older ICU and using --with-icu-dir, but then I ran into another build issue with the flock struct. I think it’s an XCode issue. PHP doesn’t seem to like XCode 9.

@mirfilip
Copy link

mirfilip commented Feb 5, 2018

Ladies and Gentlemen, some progress here.

I had a second attempt at the issue. I tried to brew install --debug --build-from-source php56-intl to grasp how setting ENV.cxx11 works in brew.

I assumed I use clang compiler, as brew config shows it uses that. Then, I tried:

CXXFLAGS='-std=c++11 -stdlib=libc++' phpbrew install 5.6 +intl <other variants and config params>

It looks like it works.

FYI, it's my environment:

macOS: 10.12.6-x86_64
Xcode: 8.3.3
CLT: 8.3.2.0.1.1492020469
Clang: 8.1 build 802
icu4c: stable 60.2 (bottled), HEAD [pinned at 60.2, keg-only]

Anyhow, that's a nasty workaround. If I understand it correctly, setting CXXFLAGS='-std=c++11 -stdlib=libc++' works for compilation of every extension. It can easily cause problems with some other extensions.

@ramsey
Copy link

ramsey commented Feb 5, 2018

@mirfilip's solution worked for me, with no need to use --with-icu-dir with an older build of ICU.

@Jnoack331
Copy link

Just install like
phpbrew install {your-version} -intl {your-extensions}
and after that:
CXXFLAGS='-std=c++11 -stdlib=libc++' phpbrew ext install intl
so you only compile intl with the flags

@rovast
Copy link

rovast commented Jan 16, 2019

okay, I just met the problem yesterday.

Firstly, install icu4c. And then configure the library path.

install icu4c

brew install icu4c

find the library path

/usr/local/Cellar/icu4c/63.1

configure with library path

./configure --with-icu-dir=/usr/local/Cellar/icu4c/63.1

@peter279k
Copy link
Member

I think the issue is outdated and some possible solutions are available on previous reply.

It will be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants