asdf-community/asdf-php

Update documentation on the README for MacOS installs

BennyHoward opened this issue · 8 comments

I had some initial trouble getting the plugin to install PHP on MacOS.
I did manage to fix it.

Here is the exact command I ran:
asdf install php 7.4.7

Here is the error:
configure: error: bison 3.0.0 or later is required to generate PHP parsers (excluded versions: none).


I went through the .github/workflows/workflow.yml file to get additional information then ran:

brew install autoconf automake bison freetype gettext icu4c krb5 libedit libiconv libjpeg libpng libxml2 libzip pkg-config re2c zlib openssl postgresql

export PKG_CONFIG_PATH="$(brew --prefix icu4c)/lib/pkgconfig:$(brew --prefix krb5)/lib/pkgconfig:$(brew --prefix libedit)/lib/pkgconfig:$(brew --prefix libxml2)/lib/pkgconfig:$(brew --prefix openssl)/lib/pkgconfig"

export PATH="$(brew --prefix bison)/bin:$PATH"

I had to add openssl and postgresql (for the development headers) to the Homebrew install command because it would fail without it.

Also, I purposely didn't add the export commands to the shell config files so that I preserve my system environment setup.

Running these command (including the additions) fixes it.

Also, I noticed a small caveat involving PHP versions 5 and under involving Bison. Where PHP versions 5 and under uses Bison 2 and PHP 7 uses Bison 3.

I don't know if they added Bison 3 compatibility to PHP versions 5 and under since then. Haven't tested it with versions 5 and under.

Where Bison 2 is for PHP versions 5 and under and PHP version 7 uses Bison 3.
This would mean that this command export PATH="$(brew --prefix bison)/bin:$PATH" should be excluded. I believe Xcode Select supplies Bison 2 (Bison 2.3, I think). Else it can be installed via Homebrew with bison@2.7 and that PATH can be exported with export PATH="$(brew --prefix bison@2.7)/bin:$PATH".


I think we should update the README.md file (and maybe the .github/workflows/workflow.yml file), adding documentation to further clarify the dependencies and installation steps for Mac.

I don't think there is much need to rush, but PR is always welcome.

I don't think there is much need to rush, but PR is always welcome.

Great. Just want to make sure that it’s inline with the project direction. I’ll assign this issue to myself and prepare an update to the README.

Well, ideally they should be handled properly in the install script.

Thanks for this information, I'll add that I also needed to install oniguruma to get it working with 7.4.8

I don't currently use macOS installed machine, so I will give it a try with my MacBook Pro in the back of my closet.

I think it would be wiser to make some changes on the code side.

Added comments as a temporary support measure. I will close this once, but we welcome any PR about improvements on the code side.
21cb6ce

On Mac os 11.3 i still get issues

I ran these commands mentioned in the above post

brew install autoconf automake bison freetype gettext icu4c krb5 libedit libiconv libjpeg libpng libxml2 libzip pkg-config re2c zlib openssl postgresql

export PKG_CONFIG_PATH="$(brew --prefix icu4c)/lib/pkgconfig:$(brew --prefix krb5)/lib/pkgconfig:$(brew --prefix libedit)/lib/pkgconfig:$(brew --prefix libxml2)/lib/pkgconfig:$(brew --prefix openssl)/lib/pkgconfig"

export PATH="$(brew --prefix bison)/bin:$PATH"
> brew list --verbose
==> Formulae
ls /usr/local/Cellar
adns                            dav1d                           git                             jpeg                            libogg                          libxext                         nettle                          proj@7                          tfenv
aom                             diff-so-fancy                   git-flow                        jq                              libomp                          libxml2                         nghttp2                         python                          theora
apr                             docbook                         glib                            json-c                          libpng                          libxrender                      npth                            python3                         tmux
apr-util                        docbook-xsl                     gmp                             krb5                            libpq                           libyaml                         oniguruma                       python@2                        tree
argon2                          docker-completion               gnu-getopt                      lame                            libpthread-stubs                libzip                          openblas                        python@3.8                      unbound
asdf                            docker-compose-completion       gnupg                           leptonica                       librsvg                         little-cms2                     opencore-amr                    python@3.9                      unibilium
atomicparsley                   doxygen                         gnutls                          libarchive                      librttopo                       lua                             openexr                         ranger                          universal-ctags
autoconf                        drone                           go                              libass                          libsamplerate                   lua@5.1                         openjdk                         rav1e                           unixodbc
automake                        eigen                           gobject-introspection           libassuan                       libsndfile                      luajit                          openjpeg                        re2c                            utf8proc
awscli                          entr                            graphite2                       libb2                           libsodium                       luajit-openresty                openldap                        readline                        webp
bash                            exiftool                        graphviz                        libbluray                       libsoxr                         luarocks                        openssl@1.1                     reattach-to-user-namespace      wget
bash-completion                 fdupes                          gts                             libde265                        libspatialite                   luv                             opus                            ripgrep                         wxmac
bdw-gc                          ffmpeg                          guile                           libedit                         libssh2                         lz4                             ossp-uuid                       rlwrap                          x264
berkeley-db                     flac                            harfbuzz                        libev                           libtasn1                        lzlib                           p11-kit                         rmtrash                         x265
bison                           fontconfig                      haskell-stack                   libevent                        libtermkey                      lzo                             pandoc                          rtmpdump                        xmlto
boost                           freetype                        heroku-node                     libffi                          libtiff                         m4                              pandoc-citeproc                 rubberband                      xorgproto
brew-cask-completion            freexl                          highlight                       libgcrypt                       libtool                         macvim                          pango                           ruby                            xvid
brew-rmtree                     frei0r                          htop                            libgeotiff                      libunistring                    makedepend                      pcre                            scons                           xz
brotli                          fribidi                         icu4c                           libgpg-error                    libusb                          markdown                        pcre2                           sdl2                            yarn-completion
c-ares                          fzf                             ilmbase                         libheif                         libuv                           minizip                         perl                            sfcgal                          zeromq
cairo                           gcc                             imagemagick                     libiconv                        libvidstab                      mix-completion                  phantomjs                       shared-mime-info                zimg
cgal                            gd                              imath                           libidn                          libvorbis                       mpdecimal                       pinentry                        snappy                          zlib
cloc                            gdbm                            inetutils                       libidn2                         libvpx                          mpfr                            pip-completion                  speex                           zstd
cmake                           gdk-pixbuf                      isl                             libksba                         libvterm                        msgpack                         pixman                          sphinx-doc
coreutils                       geos                            istioctl                        liblqr                          libx11                          mutagen                         pkg-config                      sqlite
cpulimit                        gettext                         jansson                         liblwgeom                       libxau                          ncurses                         plantuml                        srt
cscope                          ghostscript                     jasper                          libmetalink                     libxcb                          neovim                          postgresql                      tcl-tk
curl                            giflib                          jemalloc                        libmpc                          libxdmcp                        netpbm                          proj                            tesseract
> asdf install php 7.2.34

...

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34/modules/opcache.a(shared_alloc_shm.o) has no symbols
/bin/sh /var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34/libtool --silent --preserve-dup-deps --mode=compile cc -I/usr/local/Cellar/icu4c/69.1/include  -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Iext/intl/ -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34/ext/intl/ -DPHP_ATOM_INC -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34/main -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34 -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34/ext/date/lib -I/usr/local/Cellar/libxml2/2.9.12/include/libxml2 -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/zlib/include -I/usr/local/opt/webp/include -I/usr/local/opt/jpeg/include -I/usr/local/opt/libpng/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/opt/gettext/include -I/usr/local/opt/gmp/include -I/usr/local/opt/libiconv/include -I/usr/local/Cellar/icu4c/69.1/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34/ext/mbstring/oniguruma -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34/ext/mbstring/libmbfl -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34/ext/mbstring/libmbfl/mbfl -I/usr/local/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34/ext/sqlite3/libsqlite -I/usr/local/opt/libedit/include -I/usr/local/opt/libsodium/include -I/usr/local/opt/libzip/include -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34/TSRM -I/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34/Zend  -no-cpp-precomp  -I/usr/local/opt/libiconv/include -g -O2 -fvisibility=hidden -DZEND_SIGNALS   -c /var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34/ext/intl/formatter/formatter_data.c -o ext/intl/formatter/formatter_data.lo
mkdir: ext/intl/formatter/.libs: File exists
/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34/ext/intl/collator/collator_sort.c:349:26: error: use of undeclared identifier 'TRUE'
        collator_sort_internal( TRUE, INTERNAL_FUNCTION_PARAM_PASSTHRU );
                                ^
/var/folders/kx/wsz1xqjj5cncxlwzwh1rh_4c0000gp/T/php-src-php-7.2.34/ext/intl/collator/collator_sort.c:543:26: error: use of undeclared identifier 'FALSE'
        collator_sort_internal( FALSE, INTERNAL_FUNCTION_PARAM_PASSTHRU );
                                ^
2 errors generated.
make: *** [ext/intl/collator/collator_sort.lo] Error 1
make: *** Waiting for unfinished jobs....