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

[fix][doc] Fix M1 JVM Installation Instructions #17669

Merged
merged 2 commits into from
Sep 30, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 43 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ components in the Pulsar ecosystem, including connectors, adapters, and other la

## Build Pulsar

Requirements:
### Requirements

- JDK

Expand All @@ -138,6 +138,47 @@ Requirements:
> Note: this project includes a [Maven Wrapper](https://maven.apache.org/wrapper/) that can be used instead of a system installed Maven.
> Use it by replacing `mvn` by `./mvnw` on Linux and `mvnw.cmd` on Windows in the commands below.

### Install JDK on M1
Copy link
Member

@tisonkun tisonkun Sep 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote:

"how to install JDK on M1" is not suitable to document on the Get Started page. Imagine that you don't tell users how to buy a computer. It's far away from Pulsar topics. Users can resolve it with Google, StackOverflow, etc.

in #17409 (comment). This stands for README.md also. I can imagine users have multiple approaches to do this and we don't have to use forty lines for it. If someone asked, we resolve the discussion or issue. And followers should be able to search or we simply answer by throwing the link.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, I install JDK on M1 simply with sdk install java without all the troubleshooting here and it works well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue happened to me and 5 other engineers I know of just as an example.
Our approach, especially on getting started should be giving you everything you need to get started - in the README case, it's building the product. M1 is notorious to have many quirks. Anything we can do to help will be greatly appreciated.

Just mentioning a few people recently running into those issues @geomagilles @teabot @nahguam just to name a few

Bear in mind, that they can ignore this recommendation. Most newcomers will appreciate it as much as I did.

In the current version, Pulsar uses a BookKeeper version which in turn uses RocksDB. RocksDB is compiled to work on x86 architecture and not ARM. Therefore, Pulsar can only work with x86 JDK. This is planned to be fixed in future versions of Pulsar.
Copy link
Member

@tisonkun tisonkun Sep 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't stand any more on the nightly version. See also #12166 (comment).

I agree that there can be a few troubleshooting to work on a different environment with older version, and I'd prefer a discussion thread (#12166 seems a good place to comment these instructions and closed).

Copy link
Member

@tisonkun tisonkun Sep 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I just notice that it misleads me because it's not about "Install JDK on M1" - it's about "Install X86 JDK on M1" (if you get a RocksDB JNI load exception).

https://www.google.com/search?q=Install+x86+JDK+on+M1 gives you:

That can help.

Copy link
Member

@tisonkun tisonkun Sep 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the meaningful information here is, that if you fail to run Pulsar on M1 due to RocksDB JNI error (with a typical stack trace), the reason is that you need an X86 JDK for older versions. Then mention some methods to achieve it as you like.

I get confused the first time: I'm an M1 user, and this section seems written for me. But it's not. It's for those who running Pulsar <= 2.10 on M1 and get the RocksDB JNI load exception.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And perhaps after we release 2.11.0 and users start to use the new version, it will be less and less useful.

M1 is notorious to have many quirks. Anything we can do to help will be greatly appreciated.

I agree. So +0 on this patch now. FYI - I encounter several other issues, and I prefer to resolve troubleshootings in discussions instead of a manual try to cover most of them:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I agree. It's mostly targeted at users trying to develop Pulsar and since it was solved on master, it's not beneficial anymore.


One of the ways to easily install an x86 JDK is to use [SDKMan](http://sdkman.io) as outlined in the following steps:

1. Install [SDKMan](http://sdkman.io).

Follow the instructions on the SDKMan website.

2. Turn on Rosetta2 compatibility for SDKMan by editing `~/.sdkman/etc/config` and changing the following property from `false` to `true`.

```properties
sdkman_rosetta2_compatible=true
```

3. Close the current shell / terminal window and open a new one.
4. Make sure you don't have any previously installed JVM of the same version by listing existing installed versions.

```shell
sdk list java|grep installed
```

Example output:

```text
| >>> | 17.0.3.6.1 | amzn | installed | 17.0.3.6.1-amzn
```

If you have any Java 17 version installed, uninstall it.

```shell
sdk uinstall java 17.0.3.6.1
```

5. Install any Java versions greater than Java 8.

```shell
sdk install java 17.0.3.6.1-amzn
```

### Build
Compile and install:

```bash
Expand All @@ -150,7 +191,7 @@ Compile and install individual module
$ mvn -pl module-name (e.g: pulsar-broker) install -DskipTests
```

## Minimal build (This skips most of external connectors and tiered storage handlers)
### Minimal build (This skips most of external connectors and tiered storage handlers)

```
mvn install -Pcore-modules,-main -DskipTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@ One of the ways to easily install an x86 JDK is to use [SDKMan](http://sdkman.io

1. Install [SDKMan](http://sdkman.io).

* Method 1: follow instructions on the SDKMan website.

* Method 2: if you have [Homebrew](https://brew.sh) installed, enter the following command.

```shell
brew install sdkman
```
Follow the instructions on the SDKMan website.

2. Turn on Rosetta2 compatibility for SDKMan by editing `~/.sdkman/etc/config` and changing the following property from `false` to `true`.

Expand Down