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

Can't install PHP 7 on macOS #8

Closed
jeromedalbert opened this issue Feb 3, 2018 · 28 comments
Closed

Can't install PHP 7 on macOS #8

jeromedalbert opened this issue Feb 3, 2018 · 28 comments

Comments

@jeromedalbert
Copy link

jeromedalbert commented Feb 3, 2018

When I try to install PHP 7 on macOS High Sierra after following the instructions in the README, I get the following error:

$ export PHP_CONFIGURE_OPTIONS='--disable-gettext'
$ PATH="$(brew --prefix bison)/bin:$(brew --prefix icu4c)/bin:$(brew --prefix icu4c)/sbin:$PATH" PHP_CONFIGURE_OPTIONS="--with-iconv=$(brew --prefix libiconv) --with-openssl=$(brew --prefix openssl)" asdf install php 7.2.1

...

/usr/local/Cellar/icu4c/60.2/include/unicode/unistr.h:3014:7: error: delegating constructors are permitted only in C++11
      UnicodeString(ConstChar16Ptr(text)) {}
      ^~~~~~~~~~~~~
/usr/local/Cellar/icu4c/60.2/include/unicode/unistr.h:3076:7: error: delegating constructors are permitted only in C++11
      UnicodeString(ConstChar16Ptr(text), length) {}
      ^~~~~~~~~~~~~
/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: *** [ext/intl/intl_convertcpp.lo] Error 1

Any idea about what is going on?

After Googling around I could only find one related and unsolved issue: phpbrew/phpbrew#899

@odarriba
Copy link
Contributor

odarriba commented Feb 4, 2018

It looks like a typical error while compiling with icu4c libraries in recent versions of OSX.

To be honest, I do not longer used this asdf plugin and when I did, getting it ready to run on OSX was near to a nightmare due to complicated dependencies and changes between versions made in the PHP building process itself.

So I don't think I can help you more that searching in Google for that error on your specific OSX version :( sorry about that.

What I would like to ask you is to post here the solution if you find any, so anybody in the same situation can solve it too.

Thanks!

@Ilyes512
Copy link

I think I will be switching back to brew php. Good effort, but it's indeed not very useable or atleast not as easy as it should be.

@lanffy
Copy link

lanffy commented Mar 13, 2018

maybe this will bee helpfule: https://gist.github.com/redefinelab/4188331

@brunowego
Copy link

My issue is different:

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sapi/cli/php] Error 1

@brunowego
Copy link

brunowego commented Jul 2, 2018

@jeromedalbert try:

brew tap magrathealabs/homebrew-mlabs
brew install icu4c icu4c@58.1

5.6

export PATH="$(brew --prefix bison@2.7)/bin:$(brew --prefix icu4c@58.1)/bin:$(brew --prefix icu4c@58.1)/sbin:$PATH"
export PHP_CONFIGURE_OPTIONS="--with-iconv=$(brew --prefix libiconv) --with-openssl=$(brew --prefix openssl)"
asdf install php 5.6.36

7.x

export PATH="$(brew --prefix bison)/bin:$(brew --prefix icu4c)/bin:$(brew --prefix icu4c)/sbin:$PATH"
export PHP_CONFIGURE_OPTIONS="--with-iconv=$(brew --prefix libiconv) --with-openssl=$(brew --prefix openssl)"
export PHP_CONFIGURE_OPTIONS='--disable-gettext'
asdf install php 7.2.6

@jeromedalbert
Copy link
Author

jeromedalbert commented Jul 3, 2018

Thanks @brunowego, that worked! I only needed PHP on my machine for a couple weeks 5 months ago, but it is still nice to know that I can manage all the languages in my machine — PHP included — with asdf.

@odarriba I'm leaving this issue open even though it is fixed for me. Maybe the README should be updated with the content of @brunowego 's comment

@wenzowski
Copy link

Unfortunately, still seem to be subject to php#71343 when trying to install 7.2.12 using recommended PATH and PHP_CONFIGURE_OPTIONS above.

@phortx
Copy link

phortx commented May 29, 2019

https://stackoverflow.com/questions/56364061/how-to-install-php-7-2-18-via-asdf-php-plugin-on-macos/56364194

Thanks @brunowego for your help!

@peterlobster
Copy link

peterlobster commented Jun 9, 2019

@phortx This doesn't work for me 😵. Tidy is no longer available from Homebrew. So I removed it, otherwise, outside of being on High Sierra and trying to install 7.3.6; I'm following your recommendation, this is the error I get...

Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      _do_convert in gdkanji.o
      _php_iconv_string in iconv.o
      __php_iconv_strlen in iconv.o
      _zif_iconv_substr in iconv.o
      __php_iconv_strpos in iconv.o
      _zif_iconv_mime_encode in iconv.o
      __php_iconv_appendl in iconv.o
      ...
  "_libiconv_close", referenced from:
      _do_convert in gdkanji.o
      _php_iconv_string in iconv.o
      __php_iconv_strlen in iconv.o
      _zif_iconv_substr in iconv.o
      __php_iconv_strpos in iconv.o
      _zif_iconv_mime_encode in iconv.o
      __php_iconv_mime_decode in iconv.o
      ...
  "_libiconv_open", referenced from:
      _do_convert in gdkanji.o
      _php_iconv_string in iconv.o
      __php_iconv_strlen in iconv.o
      _zif_iconv_substr in iconv.o
      __php_iconv_strpos in iconv.o
      _zif_iconv_mime_encode in iconv.o
      __php_iconv_mime_decode in iconv.o
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sapi/cli/php] Error 1

@salzig
Copy link
Contributor

salzig commented Jul 25, 2019

maybe partially relevant for you, i created #21 cause i had some problems installing php 7.3.7 on MacOS.

@smorimoto
Copy link
Member

It seems to be able to build without any issues in the latest version.

@StephanMeijer
Copy link

Thank you, @brunowego.

@StephanMeijer
Copy link

checking for cURL support... yes
checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
    easy.h should be in <curl-dir>/include/curl/

After running

brew install libsodium gpg git tmux neovim vim htop curl wget re2c bison zlib libgd libiconv oniguruma postgresql bzip2 readline libedit tidy-html5 openssl libzip

export PATH="$(brew --prefix bison)/bin:$(brew --prefix icu4c)/bin:$(brew --prefix icu4c)/sbin:$PATH"
export PHP_CONFIGURE_OPTIONS="--with-zlib-dir=$(brew --prefix zlib) --with-bz2=$(brew --prefix bzip2) --with-readline=$(brew --prefix readline) --with-libedit=$(brew --prefix libedit) --with-tidy=$(brew --prefix tidy-html5) --with-iconv=$(brew --prefix libiconv) --with-openssl=$(brew --prefix openssl) --with-curl=$(brew --prefix curl)"

asdf install php 7.1.3

PHP 8.0.6 succeeds.

@salzig
Copy link
Contributor

salzig commented May 14, 2021

@StephanMeijer maybe you could, based-upon/inspired-by #21, create a merge request that handles detection of curl?

@StephanMeijer
Copy link

@salzig Yes, that would be a good idea.

@StephanMeijer
Copy link

For other people with issues: put quotes around the paths, like this:

brew install libsodium gpg git tmux neovim vim htop curl wget re2c bison zlib libgd libiconv oniguruma postgresql bzip2 readline libedit tidy-html5 openssl libzip

export PATH="$(brew --prefix bison)/bin:$(brew --prefix icu4c)/bin:$(brew --prefix icu4c)/sbin:$PATH"
export PHP_CONFIGURE_OPTIONS="--with-zlib-dir=\"$(brew --prefix zlib)\" --with-bz2=\"$(brew --prefix bzip2)\" --with-readline=\"$(brew --prefix readline)\" --with-libedit=\"$(brew --prefix libedit)\" --with-tidy=\"$(brew --prefix tidy-html5)\" --with-iconv=\"$(brew --prefix libiconv)\" --with-openssl=\"/usr/local/Cellar/openssl@1.1/1.1.1k\" --with-curl=\"$(brew --prefix curl)\""

echo $PHP_CONFIGURE_OPTIONS

asdf install php 7.1.3 && asdf install php 8.0.6

@StephanMeijer
Copy link

@salzig can't get past this:

Configuring extensions
checking size of long... (cached) 8
checking size of int... (cached) 4
checking for int32_t... yes
checking for uint32_t... yes
checking for sys/types.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for string.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for strtoll... yes
checking for atoll... yes
checking for strftime... (cached) yes
checking for gettimeofday... (cached) yes
checking whether to enable LIBXML support... yes
checking libxml2 install dir... no
checking for xml2-config path... /usr/bin/xml2-config
checking whether libxml build works... yes
checking for OpenSSL support... yes
checking for Kerberos support... no
checking whether to use system default cipher list instead of hardcoded value... no
checking for RAND_egd... no
checking for pkg-config... /usr/local/bin/pkg-config
configure: error: Cannot find OpenSSL's <evp.h>

Using:

brew install libsodium gpg git tmux neovim vim htop curl wget re2c bison zlib libgd libiconv oniguruma postgresql bzip2 readline libedit tidy-html5 openssl libzip pcre mhash libxml2

export PATH="$(brew --prefix bison)/bin:$(brew --prefix icu4c)/bin:$(brew --prefix icu4c)/sbin:$PATH"
export PHP_CONFIGURE_OPTIONS="--with-zlib-dir=\"$(brew --prefix zlib)\" --with-bz2=\"$(brew --prefix bzip2)\" --with-readline=\"$(brew --prefix readline)\" --with-libedit=\"$(brew --prefix libedit)\" --with-tidy=\"$(brew --prefix tidy-html5)\" --with-iconv=\"$(brew --prefix libiconv)\" --with-openssl=\"$(brew --prefix openssl)\" --with-curl=\"$(brew --prefix curl)\""

export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

echo $PHP_CONFIGURE_OPTIONS

asdf install php 7.1.3

Do you know what to look at? Tried playing with LDFLAGS, CPPFLAGS and --with-openssl.

@salzig
Copy link
Contributor

salzig commented May 14, 2021

did you try brew link openssl --force already? Maybe openssl is not linked correctly.

@StephanMeijer
Copy link

Yes, gives me the following results:

Warning: Refusing to link macOS provided/shadowed software: openssl@1.1
If you need to have openssl@1.1 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

@salzig
Copy link
Contributor

salzig commented May 14, 2021

what does brew --prefix openssl print out?

@StephanMeijer
Copy link

stephanmeijer@beheerders-MacBook-Pro ~ % brew --prefix openssl 
/usr/local/opt/openssl@1.1
stephanmeijer@beheerders-MacBook-Pro ~ % cd /usr/local/opt/openssl@1.1
stephanmeijer@beheerders-MacBook-Pro openssl@1.1 % pwd
/usr/local/opt/openssl@1.1
stephanmeijer@beheerders-MacBook-Pro openssl@1.1 % ls ..
1.1.1k
stephanmeijer@beheerders-MacBook-Pro openssl@1.1 % cd ..
stephanmeijer@beheerders-MacBook-Pro opt % ls | grep openssl
openssl
openssl@1.1

@StephanMeijer
Copy link

StephanMeijer commented May 14, 2021

Now ran the following:

  1. pkg-config openssl
  2. No result:
I resolved this question in mac below:
brew install openssl
and replace the XXX to you installed's version of the openssl
ln -s /usr/local/Cellar/openssl@XX/xxx/include/openssl /usr/local/include/openssl
and it will be ok

No result. No change.

@salzig
Copy link
Contributor

salzig commented May 14, 2021

Ok, haven't used PHP for quite some time but tested the installation of 8.0.2 anyways.

  • tried to run asdf install php 8.0.2, failed for wrong bison version (2.7, was used previously). Needed to update the asdf plugin asdf plugin update php.
  • rerun asdf install php 8.0.2, this time "re2c" was missing, so brew install re2c
  • then again:
$ asdf install php 8.0.2
$ asdf global php 8.0.2
$ php -v
PHP 8.0.2 (cli) (built: May 14 2021 15:32:34) ( NTS )
Copyright (c) The PHP Group
$ php -r 'echo "hello world\n";'
hello world

Looks like it should normaly work without big problems. Are you sure you're using an up to date version of the php plugin?

@StephanMeijer
Copy link

I am sure I am not using an up-to-date version, as I try to install php 7.1.3 specifically.

@StephanMeijer
Copy link

php 8.0.6 gives no errors.

@salzig
Copy link
Contributor

salzig commented May 17, 2021

@StephanMeijer i was talking about asdf-php, not php itself. Is your asdf-php plugin up to date?

@smorimoto
Copy link
Member

There are too many irrelevant people in the thread. If you need help, open a new post on discussions.

@smorimoto
Copy link
Member

Apropos #22 (comment), I'm suspecting that you can solve the problem by doing this instead of using the brew prefix.

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

No branches or pull requests