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

Revert docker image, implement workarounds for arm64 machines and java #4377

Merged
merged 1 commit into from
Jun 9, 2022

Conversation

Christewart
Copy link
Contributor

@Christewart Christewart commented Jun 9, 2022

This is a workaround for #4369

When introducing jlink in #4322 we broke arm64 related builds that are produced on github actions. This is because jlink builds a jre that is OS and architecture specific to the host machine.

As documented in #4369, jlink expects an x86 linker to be available when attempting to run java. Since this is not available on arm64 platforms, java fails to start.

This PR implements a work around by modifying the bitcoin-s-server and bitcoin-s-oracle-server bash startup scripts.

If we detect the user is running on arm64 or aarch64, we define a new bash function called get_java_no_jlink. This function is equivalent to the bash script that sbt native packager generates with one exception, it removes the jlink check.

This is the function that is generated by sbt native packagers startup script by default:

# Detect if we should use JAVA_HOME or just try PATH.
get_java_cmd() {
  # High-priority override for Jlink images
  if [[ -n "$bundled_jvm" ]];  then
    echo "$bundled_jvm/bin/java"
  elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]];  then
    echo "$JAVA_HOME/bin/java"
  else
    echo "java"
  fi
}

My PR removes these two lines in the new get_java_no_jlink function

  # High-priority override for Jlink images
  if [[ -n "$bundled_jvm" ]];  then
    echo "$bundled_jvm/bin/java"

As a by product, this PR also reverts #4367 and reverts our base docker image to be openjdk:17-slim. This way our docker containers can just work ™️ out of the box. This is because the docker container provides java, so we don't need to rely on our jre built by jlink.

The only thing that still isn't working on this PR is users that have an m1 mac and do not have a pre-existing java installed on their system. They will fail to run servers. The best we can do at this time is to ask them to install java out of band. As discussed with @rorp , in this case i think the only thing we can do is install an arm64 java manually on CI and package with our bitcoin-s-server-mac zips that we ship. We would need to now make a bitcoin-s-server-mac-x86 build and bitcoin-s-server-mac-arm64 build and equivalents for the bitcoin-s-oracle-server.

…ser has another java installed on their machine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
1.9.2
Done
Development

Successfully merging this pull request may close these issues.

None yet

1 participant