termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
12.95k stars 2.98k forks source link

[ARM] OpenJDK throws java.lang.StackOverflowError #7214

Closed ghost closed 3 years ago

ghost commented 3 years ago

Problem description

Package openjdk-17 doesn't work on ARM (32 bit) devices. All tools crash with java.lang.StackOverflowError. This issue does not affect AArch64 and x86_64 devices, i686 has another bug.

Screenshot_20210730-062447

Same issue affects https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch/tree/buildjre16 on which the current build is based.

Additional information

Application version:
0.117
Packages CPU architecture:
arm
Subscribed repositories:
# sources.list
deb https://packages.termux.org/apt/termux-main/ stable main
# game-repo (sources.list.d/game.list)
deb https://packages.termux.org/apt/termux-games games stable
# science-repo (sources.list.d/science.list)
deb https://packages.termux.org/apt/termux-science science stable
Updatable packages:
All packages up to date
Android version:
7.1.2
Kernel build information:
Linux localhost 3.1.10-nougat-gd41f42062c6 #1 SMP PREEMPT Sat Mar 13 20:15:57 UTC 2021 armv7l Android
Device manufacturer:
Asus
Device model:
Nexus 7 3G
Mhowser commented 3 years ago

I can confirm I have the same problem. Edit: used termux-info to generate the following information:

Application version:
0.117
Packages CPU architecture:
arm
Subscribed repositories:
# sources.list
deb https://packages.termux.org/apt/termux-main/ stable main
# game-repo (sources.list.d/game.list)
deb https://packages.termux.org/apt/termux-games games stable
# science-repo (sources.list.d/science.list)
deb https://packages.termux.org/apt/termux-science science stable
# x11-repo (sources.list.d/x11.list)
deb https://packages.termux.org/apt/termux-x11 x11 main
Updatable packages:
All packages up to date
Android version:
10
Kernel build information:
Linux localhost 4.9.206-perf+ #1 SMP PREEMPT Wed Jun 9 05:43:55 CDT 2021 armv7l Android
Device manufacturer:
motorola
Device model:
moto e
ghost commented 3 years ago

Same here with me. 😔

ghost commented 3 years ago

Problem description

Package openjdk-17 doesn't work on ARM (32 bit) devices. All tools crash with java.lang.StackOverflowError. This issue does not affect AArch64 and x86_64 devices, i686 has another bug.

Screenshot_20210730-062447

Same issue affects https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch/tree/buildjre16 on which the current build is based.

Additional information

Application version:
0.117
Packages CPU architecture:
arm
Subscribed repositories:
# sources.list
deb https://packages.termux.org/apt/termux-main/ stable main
# game-repo (sources.list.d/game.list)
deb https://packages.termux.org/apt/termux-games games stable
# science-repo (sources.list.d/science.list)
deb https://packages.termux.org/apt/termux-science science stable
Updatable packages:
All packages up to date
Android version:
7.1.2
Kernel build information:
Linux localhost 3.1.10-nougat-gd41f42062c6 #1 SMP PREEMPT Sat Mar 13 20:15:57 UTC 2021 armv7l Android
Device manufacturer:
Asus
Device model:
Nexus 7 3G

How do you generate these device info?

ghost commented 3 years ago

termux-info

Mhowser commented 3 years ago

I updated my previous comment to use termux-info

giuliolunati commented 3 years ago

I confirm the bug. It's blocking my work, I need a working Java.... Any alternatives?

Application version:
0.108
Packages CPU architecture:
arm
Subscribed repositories:
# sources.list
deb https://deb.kcubeterm.me/termux-main/ stable main
# game-repo (sources.list.d/game.list)
deb https://packages.termux.org/apt/termux-games games stable
# science-repo (sources.list.d/science.list)
deb https://packages.termux.org/apt/termux-science science stable
# unstable-repo (sources.list.d/unstable.list)
deb https://packages.termux.org/apt/termux-unstable unstable main
# root-repo (sources.list.d/root.list)
deb https://packages.termux.org/apt/termux-root root stable
# x11-repo (sources.list.d/x11.list)
deb https://packages.termux.org/apt/termux-x11 x11 main
Updatable packages:
All packages up to date
Android version:
10
Kernel build information:
Linux localhost 3.4.113-lineageos-g36dddde #1 SMP PREEMPT Sun Nov 29 07:32:59 UTC 2020 armv7l Android
Device manufacturer:
samsung
Device model:
SM-G900F
ghost commented 3 years ago

Alternatives currently ecj + dx packages, for compiling .java sources into .dex and then running with dalvikvm.

giuliolunati commented 3 years ago

@xeffyr thanks for the tip! Unfortunately doesn't work for me. 1) I need apksigner in Termux, but it depends on openjdk-17. 2) I also tried https://github.com/fornwall/apksigner 2a) I compiled it on my Linux desktop, then copied the jar in Termux... but obviously can't run it because java is broken 2b) I tried to convert the jar to dex, but it complains because the jar is java 1.8, while dx wants 1.7 2c) I wish to recompile the jar as 1.7, but I don't know how to do.

ghost commented 3 years ago

Try this http://termux.net/dists/stable/main/binary-all/apksigner_0.7-2_all.deb, it's from old Termux.

giuliolunati commented 3 years ago

@xeffyr Thank you very much! It only admits keystores generated by itself, but that's good enough for me :-)

abdogamerpro commented 3 years ago

@xeffyr There is any solution for javac and d8 , because I have same problem

ghost commented 3 years ago

@xeffyr why didn't you add OpenJDK-11 as a package before jumping to OpenJDK-17? 😬

ghost commented 3 years ago

There is any solution for javac and d8

The only solutions I can suggest are:

Otherwise notice that issue has this tag: 1~2

why didn't you add OpenJDK-11 as a package before jumping to OpenJDK-17

Because this is literally a copy of https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch. Using what is available and known to build with no issues.

I has been notified about issues on ARM too late, when package has been already added.

Yisus7u7 commented 3 years ago

@xeffyr And if you try compiling and using an older version of java for arm32?, try using the previous commits of Pojav Launcher.

w4123 commented 3 years ago

Here is a possibility but I haven't tested this yet.

Currently, on ARM, OpenJDK uses explicit register variable to retrieve the value of sp as the current stack location, which is used to detect stack overflow, see https://github.com/termux/openjdk-mobile-termux/blob/master/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp#L87

However, it seems that this feature is not supported by clang. see https://stackoverflow.com/questions/55648274/why-does-clang-behave-weirdly-with-register-variables-compared-to-gcc Thus this may cause wrong stack size detection, leading to a wrong StackOverFlowError.

On bsd aarch64, special code is written for clang in this function, see https://github.com/termux/openjdk-mobile-termux/blob/master/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp#L103

Maybe should change the function in linux_arm and test if it might work.

w4123 commented 3 years ago

Tested and it's now working. PR https://github.com/termux/openjdk-mobile-termux/pull/2

Grimler91 commented 3 years ago

@w4123 Amazing work with investigating both of these java issues!

giuliolunati commented 3 years ago

Thank you so much!!

Il mer 25 ago 2021, 22:03 Leonid Pliushch @.***> ha scritto:

Closed #7214 https://github.com/termux/termux-packages/issues/7214 via 08b1ffd https://github.com/termux/termux-packages/commit/08b1ffd458da70275231902deddd174173cd9471 .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/termux/termux-packages/issues/7214#event-5209059247, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLC4MY3PMTLGN4VV2JIJRLT6VEB5ANCNFSM5BI6IY6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .