apache / apache/maven-mvnd

Build for Linux on aarch64

Open
#888 9 comments 6 reactions 0 assignees View on GitHub
discussion
Dominant language
Java
Stars
3.5k
Forks
250
Avg merge
16h 22m
Merged PRs (30d)
36

Description

I found some issues and resolved them when building mvnd for Linux on aarch64.

I'm using docker image `ubuntu:22.04` on aarch64 machine.

This is my patch:

```patch
diff --git a/client/pom.xml b/client/pom.xml
index 679cc23d..3a900043 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -228,6 +228,8 @@
-H:-ParseRuntimeOptions
-H:+AddAllCharsets
-H:+ReportExceptionStackTraces
+ -H:+TraceNativeToolUsage
+ -H:PageSize=65536
-ea


diff --git a/client/src/main/resources/glibc/dynamic-libc-start.c b/client/src/main/resources/glibc/dynamic-libc-start.c
index 2272b255..09097cbc 100644
--- a/client/src/main/resources/glibc/dynamic-libc-start.c
+++ b/client/src/main/resources/glibc/dynamic-libc-start.c
@@ -27,8 +27,8 @@
#include
#include

-__asm__(".symver dlsym,dlsym@GLIBC_2.2.5");
-__asm__(".symver dlvsym,dlvsym@GLIBC_2.2.5");
+__asm__(".symver dlsym,dlsym@GLIBC_2.17");
+__asm__(".symver dlvsym,dlvsym@GLIBC_2.17");

/* __libc_csu_init is statically linked into each program, and passed to __libc_start_main
* when the program is running with an old glibc (<2.34).
diff --git a/client/src/main/resources/glibc/glibc.redef b/client/src/main/resources/glibc/glibc.redef
index 10342159..4d330e02 100644
--- a/client/src/main/resources/glibc/glibc.redef
+++ b/client/src/main/resources/glibc/glibc.redef
@@ -15,21 +15,21 @@
# specific language governing permissions and limitations
# under the License.
__libc_start_main __dynamic_libc_start_main
-clock_gettime clock_gettime@GLIBC_2.2.5
-dlopen dlopen@GLIBC_2.2.5
-dlsym dlsym@GLIBC_2.2.5
-memcpy memcpy@GLIBC_2.2.5
-posix_spawn posix_spawn@GLIBC_2.2.5
-pthread_attr_getguardsize pthread_attr_getguardsize@GLIBC_2.2.5
-pthread_attr_getstack pthread_attr_getstack@GLIBC_2.2.5
-pthread_attr_setstacksize pthread_attr_setstacksize@GLIBC_2.2.5
-pthread_condattr_setclock pthread_condattr_setclock@GLIBC_2.3.3
-pthread_create pthread_create@GLIBC_2.2.5
-pthread_getattr_np pthread_getattr_np@GLIBC_2.2.5
-pthread_join pthread_join@GLIBC_2.2.5
-pthread_kill pthread_kill@GLIBC_2.2.5
-pthread_setname_np pthread_setname_np@GLIBC_2.12
-sem_destroy sem_destroy@GLIBC_2.2.5
-sem_init sem_init@GLIBC_2.2.5
-sem_post sem_post@GLIBC_2.2.5
-sem_wait sem_wait@GLIBC_2.2.5
+clock_gettime clock_gettime@GLIBC_2.17
+dlopen dlopen@GLIBC_2.17
+dlsym dlsym@GLIBC_2.17
+memcpy memcpy@GLIBC_2.17
+posix_spawn posix_spawn@GLIBC_2.17
+pthread_attr_getguardsize pthread_attr_getguardsize@GLIBC_2.17
+pthread_attr_getstack pthread_attr_getstack@GLIBC_2.17
+pthread_attr_setstacksize pthread_attr_setstacksize@GLIBC_2.17
+pthread_condattr_setclock pthread_condattr_setclock@GLIBC_2.17
+pthread_create pthread_create@GLIBC_2.17
+pthread_getattr_np pthread_getattr_np@GLIBC_2.17
+pthread_join pthread_join@GLIBC_2.17
+pthread_kill pthread_kill@GLIBC_2.17
+pthread_setname_np pthread_setname_np@GLIBC_2.17
+sem_destroy sem_destroy@GLIBC_2.17
+sem_init sem_init@GLIBC_2.17
+sem_post sem_post@GLIBC_2.17
+sem_wait sem_wait@GLIBC_2.17
```

After the patch, it builds successfully and works fine on my machine.

I'm looking forward to the official release of Linux aarch64 pre-built distribution. But until then, this patch may help some people in need, so I share it.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the build on an aarch64 machine with ubuntu:22.04, then inspect client/pom.xml and the files under client/src/main/resources/glibc/. Compare the supplied patch with the current native build configuration and verify that the resulting Linux aarch64 distribution builds and works on the reported environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, docker, java, linux, ubuntu
Domain
build-system, operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
43/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.