Closed19

M1 macにphpを入れていく

snaosnao

とりあえず、いつもの

anyenv install phpenv
snaosnao

綺麗にビルドが失敗

-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
configure: error: Package requirements (openssl >= 1.0.2) were not met:

No package 'openssl' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables OPENSSL_CFLAGS
and OPENSSL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
-----------------------------------------

snaosnao
brew install openssl

を実行して表示される。
このLDFAGSとCPPLAGSを使う感じかなと推測

If you need to have openssl@3 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/openssl@3/bin:$PATH"' >> ~/.zshrc

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

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

一旦コンソール上で以下を実行し、再度インストール

  export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
snaosnao

grepもなんかエラー出てる・・?

-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
grep: invalid option -- P
usage: grep [-abcdDEFGHhIiJLlMmnOopqRSsUVvwXxZz] [-A num] [-B num] [-C[num]]
	[-e pattern] [-f file] [--binary-files=value] [--color=when]
	[--context[=num]] [--directories=action] [--label] [--line-buffered]
	[--null] [pattern] [file ...]
configure: WARNING: unrecognized options: --with-png-dir
configure: error: Please reinstall the BZip2 distribution
-----------------------------------------
snaosnao
vi .zshrc

zshrcを開いて以下を追加する

export PATH="/opt/homebrew/opt/grep/libexec/gnubin:$PATH"
snaosnao

次のエラー

---
--------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
configure: error: Please reinstall the BZip2 distribution
-----------------------------------------

snaosnao
brew install bzip2

をして、パスの設定をしても変わらず・・

snaosnao

.zshrcの抜粋

export PATH="/opt/homebrew/opt/bzip2/bin:$PATH"

export LDFLAGS="-L/opt/homebrew/opt/bzip2/lib:$LDFLAGS"
export CPPFLAGS="-I/opt/homebrew/opt/bzip2/include:$CPPFLAGS"
snaosnao

一応os情報

・(ventora) macOS13.0(22A380)
・phpenv v0.9.0-rc.1

snaosnao

次のエラー

-----------------------------------------
configure: error: Package requirements (libpng) were not met:

No package 'libpng' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables PNG_CFLAGS
and PNG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
-----------------------------------------
brew install libpng libjpeg zlib
export PKG_CONFIG_PATH="/opt/homebrew/opt/jpeg/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig:$PKG_CONFIG_PATH"
snaosnao

-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables ICU_CFLAGS
and ICU_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
-----------------------------------------

The full Log is available at '/tmp/php-build.8.2.1.20230124000033.log'.
[Warn]: Aborting build.

zshrc

export PKG_CONFIG_PATH="/opt/homebrew/opt/icu4c/lib/pkgconfig:$PKG_CONFIG_PATH"
snaosnao

-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
configure: error: Package requirements (oniguruma) were not met:

No package 'oniguruma' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables ONIG_CFLAGS
and ONIG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
-----------------------------------------

The full Log is available at '/tmp/php-build.8.2.1.20230124000234.log'.
[Warn]: Aborting build.
brew install oniguruma
snaosnao
-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
configure: error: Cannot find libtidy
-----------------------------------------

The full Log is available at '/tmp/php-build.8.2.1.20230124000443.log'.
[Warn]: Aborting build.
brew install tidy-html5

.zshrc

export PKG_CONFIG_PATH="/opt/homebrew/opt/tidy-html5/lib/pkgconfig:$PKG_CONFIG_PATH"
snaosnao
-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
No package 'libzip' found
No package 'libzip' found
No package 'libzip' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBZIP_CFLAGS
and LIBZIP_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
-----------------------------------------

The full Log is available at '/tmp/php-build.8.2.1.20230124001304.log'.
[Warn]: Aborting build.
brew install libzip
snaosnao

最終成功コマンド

PHP_RPATHS="$(brew --prefix bzip2)" PHP_BUILD_CONFIGURE_OPTS="--with-bz2=$(brew --prefix bzip2)  --with-iconv=$(brew --prefix libiconv) --with-tidy=$(brew --prefix tidy-html5) --with-libzip=$(brew --prefix libzip)" phpenv install 8.2.1

.zshrc


# PATH
export PATH="/opt/homebrew/opt/bison/bin:$PATH"
export PATH="/opt/homebrew/opt/grep/libexec/gnubin:$PATH"
export PATH="/opt/homebrew/opt/bzip2/bin:$PATH"

# PKG_CONFIG
export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH="/opt/homebrew/opt/jpeg/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH="/opt/homebrew/opt/icu4c/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH="/opt/homebrew/opt/tidy-html5/lib/pkgconfig:$PKG_CONFIG_PATH"

# Compiler option
## bzip2
export LDFLAGS="-L/opt/homebrew/opt/bzip2/lib:$LDFLAGS"
export CPPFLAGS="-I/opt/homebrew/opt/bzip2/include:$CPPFLAGS"
snaosnao

読んだ人へのメモ

  • PKG_CONFIG_PATH
  • CPPFLAGS
  • LDFLAGS

は、だいたいがbrew info パッケージ名でコンソール表示される。

例) bzip2

brew info bzip2

If you need to have bzip2 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/bzip2/bin:$PATH"' >> ~/.zshrc

For compilers to find bzip2 you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/bzip2/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/bzip2/include"

と出てくるので、コピーして使用する

このスクラップは2023/01/24にクローズされました