Skip to content

Commit

Permalink
Updating cross-compile for both aarch64 and x86_64 on ARM
Browse files Browse the repository at this point in the history
  • Loading branch information
NickDunklee committed Sep 30, 2024
1 parent 8fd0a31 commit 16b5f17
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sovrn/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ RUN wget https://downloads.lightbend.com/scala/2.12.17/scala-2.12.17.tgz -P /tmp
ln -s /usr/local/scala-2.12.17 /usr/local/scala && \
rm /tmp/scala-2.12.17.tgz

# Set environment variables for Java, Python, Maven, and Scala
ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto.aarch64
# Set a default value for TARGET_PLATFORM
# This is chosen at build time using the --build-arg flag
# Example: docker build --build-arg TARGET_PLATFORM=aarch64 -t xgboost .
ARG TARGET_PLATFORM=aarch64
#ARG TARGET_PLATFORM=x86_64

# Set environment variables for Java and Scala
ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto.${TARGET_PLATFORM}
ENV PATH=${PATH}:${JAVA_HOME}/bin:/usr/local/scala/bin

# Set Java 8 as the default Java version
Expand Down
9 changes: 9 additions & 0 deletions sovrn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ docker run -v $(pwd)/..:/xgboost --rm -it xgboost-build

Now you should have a Docker ready to build your jar for aarch64/ARM64.

## Cross-Compile XGBoost for x86_64 on ARM64

```bash
docker buildx create --name xgboost-builder --use
docker buildx inspect --bootstrap
docker buildx build --platform linux/amd64 -t xgboost-build . --load --build-arg TARGET_PLATFORM=amd64
docker run -v $(pwd)/..:/xgboost --rm -it --platform linux/amd64 xgboost-build
```

# Inside the Docker

```bash
Expand Down

0 comments on commit 16b5f17

Please sign in to comment.