homebrew-kong icon indicating copy to clipboard operation
homebrew-kong copied to clipboard

kong 3.1.1 installation fails due to kong/kong/openresty

Open orelmaliach opened this issue 2 years ago • 8 comments

I'm trying to run brew install kong/kong/kong (latest version is 3.1.1 at this time). It installs successfully libyaml, coreutils, gmp, pkg-config, rust, [email protected], but fails when installing [email protected].

I'm running on an M1 Mac (arm64 arch), running OS13.1. I asked my colleague to try installing the same (using M1, with Monterey OS), and kong was installed successfully for him.

There's a warning during the installation attempt (I don't think it's related since my colleague had it as well): /opt/homebrew/Library/Taps/kong/homebrew-kong/Formula/[email protected]:58: warning: conflicting chdir during another chdir block

I've already tried:

  1. Reinstalling/removing all dependencies.
  2. Cleaning homebrew cache.
  3. Installing openresty from openresty/brew - it was successful, but later when trying to install kong, it asked me to remove it: Error: [email protected] is already installed from openresty/brew! Please brew uninstall [email protected] first."
  4. Editing the formula to use KONG_BUILD_TOOLS_VERSION 4.40.1 (as looks to be required by https://github.com/Kong/kong/blob/3.1.1/.requirements).
  5. Running with/without VPN.

None of these worked.

In terminal, this is the output: ➜ ~ brew install [email protected] ==> Fetching kong/kong/[email protected] ==> Downloading https://github.com/Kong/kong-build-tools/archive/4.33.22.tar.gz Already downloaded: /Users/oelmaliach/Library/Caches/Homebrew/downloads/8c26686f439ddceab9e9adaebceacf2b41b9a360a9c5d531755d9e9a05506837--kong-build-tools-4.33.22.tar.gz ==> Installing [email protected] from kong/kong /opt/homebrew/Library/Taps/kong/homebrew-kong/Formula/[email protected]:58: warning: conflicting chdir during another chdir block ==> ./kong-ngx-build --prefix /opt/homebrew/Cellar/[email protected]/1.21.4.1 --openresty 1.21.4.1 --openssl 1.1.1q --luarocks 3.9.1 --pcre 8.45 --ssl-provider openssl --atc-router 1.0.1 --resty-events 0.1.3 --resty-lmdb 1.0.0 --resty-websocket 0 Last 15 lines from /Users/oelmaliach/Library/Logs/Homebrew/[email protected]/01.kong-ngx-build: 2023-01-15 16:34:17 +0000

./kong-ngx-build --prefix /opt/homebrew/Cellar/[email protected]/1.21.4.1 --openresty 1.21.4.1 --openssl 1.1.1q --luarocks 3.9.1 --pcre 8.45 --ssl-provider openssl --atc-router 1.0.1 --resty-events 0.1.3 --resty-lmdb 1.0.0 --resty-websocket 0.3.0 -j 10

Do not report this issue to Homebrew/brew or Homebrew/core!

There's no further information in the log file: https://pastebin.com/z4gWxAHq Your assistance would be appreciated.

orelmaliach avatar Jan 15 '23 16:01 orelmaliach

After further investigation, and running brew install [email protected] --debug --verbose, I managed to isolate the issue to this script that fails during invocation of canon_path function, on multiple occasions. One example was with the following line: DOWNLOAD_CACHE=`canon_path $DOWNLOAD_CACHE` It failed due to the directory passed as argument (work) not existing, making both realpath and readlink fail.

Should I move the issue to https://github.com/Kong/kong-build-tools ? Openresty installation was successful when not from the kong/kong cask, so I'm not sure how it's related.

orelmaliach avatar Jan 24 '23 16:01 orelmaliach

Same error

Error: kong/kong/[email protected] 1.21.4.1 did not build Logs: /Users/mike/Library/Logs/Homebrew/[email protected]/00.options.out /Users/mike/Library/Logs/Homebrew/[email protected]/01.kong-ngx-build Do not report this issue to Homebrew/brew or Homebrew/core!

mikehf7 avatar Feb 01 '23 04:02 mikehf7

Solutions:

  • step 1 modify https://github.com/Kong/kong-build-tools refer: https://github.com/carlwangx/kong-build-tools/commit/e839770c231283c0d2537b74d71969323a3064a6

  • step 2 https://github.com/Kong/homebrew-kong remove comment from diff refer: https://github.com/Kong/homebrew-kong/pull/216/files

Looking forward to the official solution!

carlwangx avatar Feb 12 '23 09:02 carlwangx

@carlwangx step 2 (remove comment from diff) is done.

kikito avatar Feb 14 '23 10:02 kikito

@orelmaliach regarding this:

It failed due to the directory passed as argument (work) not existing, making both realpath and readlink fail.

Are you sure this is the problem? realpath -m -- foo/bar/baz never fails for me locally, even when given non-existing files or folders.

@carlwangx regarding step 1 on your list, we cannot add that change to kong-build-tools, it is used for other tasks besides homebrew, in Linux environments. If we are going to make any changes to kbt it must be platform-agnostic.

kikito avatar Mar 07 '23 10:03 kikito

Hi @kikito , thanks for the reply. You can find more updates on this issue in https://github.com/Kong/kong-build-tools/issues/635, where I managed to employ a workaround which seems to work for everyone else who tried it as well. I haven't opened a PR since I suspect it might not work for other platforms + I'm not sure if it works for every directory structure either. Important to note that it seems to only happen in Mac OS 13.1 (Ventura).

Below is my output when running the commands: ➜ ~ sw_vers ProductName: macOS ProductVersion: 13.1 BuildVersion: 22C65 ➜ ~ ls work ls: work: No such file or directory ➜ ~ realpath -m -- work realpath: illegal option -- m usage: realpath [-q] [path ...] ➜ ~ readlink -f -- work ➜ ~ echo $? 1

orelmaliach avatar Mar 07 '23 10:03 orelmaliach

I'm not sure what's the difference, but I found greadlink and grealpath in coreutils, which is a dependency of openresty anyway- they might be useful: ➜ ~ grealpath -m -- work /Users/oelmaliach/work ➜ ~ greadlink -f work /Users/oelmaliach/work

orelmaliach avatar Mar 07 '23 10:03 orelmaliach

https://apple.stackexchange.com/questions/450035/is-the-unix-realpath-command-distributed-with-macos-ventura suggests that previous Mac OS versions did not contain realpath executable to begin with. It looks to be also contained in coreutils, though. So now I understand @carlwangx's fix.

orelmaliach avatar Mar 07 '23 11:03 orelmaliach