1

When I tried to install Hive through homebrew it throws below error:

homebrew install hive
Error: openjdk@8: no bottle available!

Has anyone solved this issue? I did a bit of research in google and someone said "this is because the M1 chip needs it's own special version of OpenJDK ".

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • I faced the same problem. I install the arm64 OpenJDK from binary dmg, but it is not the decision. – Gleb Yan Dec 29 '21 at 13:59
  • Try installing everything manually, outside of homebrew – OneCricketeer Dec 31 '21 at 08:08
  • Thank you @OneCricketeer for your suggestion. I downloaded from below site "https://downloads.apache.org/hive/stable-2/". After downloading, when I click hive cmd file from bin folder it gave me below text.. Saving session... ...copying shared history... ...saving history...truncating history files... ...completed. [Process completed] – Sainath Bysani Dec 31 '21 at 16:32
  • Not sure what you ran... cmd files are for windows, not Mac, and you don't "click" on any of the executables because most of them accept arguments from the CLI – OneCricketeer Dec 31 '21 at 16:53
  • It is Unix Executable File. Can you help me how to install hive outside of homebrew. I have been trying since a week and I ain't getting any source. Much appreciated in advance. – Sainath Bysani Jan 02 '22 at 02:40
  • @GlebYan - Installing arm64 OpenJDK solved the issue? I mean are you able to install Hive, Sqoop everything? Basically we need a solution to bypass or override "Error: openjdk@8: no bottle available!" error. – Sainath Bysani Jan 02 '22 at 02:43
  • @SainathBysani nope, it's the wrong way. You should install another `homebrew` copy and launch it with `arch -x86_64` as I described in answer to the topic question. – Gleb Yan Jan 12 '22 at 13:46

3 Answers3

3

Apple silicone M1 and similar processors have the ARMv8.4 architecture and rosetta2 to launch native amd64 binaries on the arm64 processor. So apple silicone may launch nearly any app compiled for the Intel platform (there is some exception, for example, the older version of PostgreSQL won't be launched by rosetta2).

By default, homebrew detects the platform that is installed and tries to find the bottle that is appropriate for arm64. In some cases, there is no bottle for some applications (for example, you can't install openjdk@8 on arm64 because there is no bottle). But you can install, for example, oracle JDK because there is the bottle for arm64 (but it will install amd64 binaries). It is a pretty confusing situation, isn't it?

The decision is to install the second copy of homebrew into the /usr/local/homebrew directory and launch it in compatibility mode with the command arch -x86_64. You won't start the original homebrew with this command because it will lid to mix arm64 and amd64 binaries (and what you will do, if you need the same library for both platforms? libpq as an example).

So there is the step-by-step guide:

  1. Download homebrew curl -L https://github.com/Homebrew/brew/tarball/master --output homebrew.tar
  2. Extract tarball to /usr/local/homebrew
  3. chown -R to allow start apps from this folder
  4. Add aliases to your ~/.zshrc file
# If you come from bash you might have to change your $PATH.
# need this for x86_64 brew
export PATH=$HOME/bin:/usr/local/bin:$PATH
# for intel x86_64 brew
alias axbrew='arch -x86_64 /usr/local/homebrew/bin/brew'
  1. Now start new console and launch installation, for example axbrew install openjdk@8

Install other Intel binaries you need the same way. Remember that it will be installed into the /usr/local/homebrew/ directory - fill free to create a symlink if you wanna use it something else. The slight disadvantage - the java_version tool won't see the OpenJDK in /user/local directory, but symlink to /Library/Java/JavaVirtualMachines/ will solve this problem.

Gleb Yan
  • 421
  • 3
  • 5
1

Finally, I found a solution. First, We need to install Homebrew with Rosetta under /usr/local and then we can try installing everything the same way.

0

Combine Gleb Yan's answer and another website's solution https://github.com/Homebrew/discussions/discussions/2723. What I do is

arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then run

arch -x86_64 /usr/local/homebrew/bin/brew install openjdk@8

Then

arch -x86_64 /usr/local/homebrew/bin/brew install hive

Reminder two separate Homebrew hierarchies on your machine, an Intel-only one under /usr/local, and an M1-only one under /opt/homebrew

Youshikyou
  • 365
  • 1
  • 8
  • Thank you for reply, however, am still getting errors. WARN DataNucleus.Query: Query for candidates of org.apache.hadoop.hive.metastore.model.MVersionTable and subclasses resulted in no possible candidates Required table missing : "VERSION" in Catalog "" Schema "". DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enable "datanucleus.schema.autoCreateTables" org.datanucleus.store.rdbms.exceptions.MissingTableException: – Sainath Bysani Mar 22 '22 at 10:27