Comments (2)
I have managed to use termux-ndk(openjdk-11.0.1 ndk-r21 android-sdk(build-tools:29.0.3 platforms:android-29)) to build a project(without gradle).
Here's some problems I encountered. I think the host API level of the prebuilt JDK, NDK and SDK need to be presented.1)Firstly I tried to build my project on a Android 8.1 device. The compilation was fine, but there was an error during linking, saying:
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/home/android-ndk-r21/toolchains/llvm/prebuilt/linux-aarch64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld": cannot locate symbol "glob" referenced by "/data/data/com.termux/files/home/android-ndk-r21/toolchains/aarch64-linux-android-4.9/prebuilt/linux-aarch64/bin/aarch64-linux-android-ld"...
Which I think is caused by lacking "glob" function in libc.so.
I have searched the web and found something saying glob was added to Bionic on API Level 28 (Android 9). Termux now targets API Level 24 (Android 7.0) and includes a compatibility library libandroid-glob.https://github.com/android/ndk/issues/126 https://github.com/termux/termux-packages/tree/master/packages/libandroid-glob
2)Then I switched to a Android 10 device and encountered a error during static library build, saying:
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/home/android-ndk-r21/toolchains/llvm/prebuilt/linux-aarch64/bin/llvm-ar": library "libc++_shared.so" not found
I found android-ndk-r21/toolchains/llvm/prebuilt/linux-aarch64/lib64/libc++.so.1 is the library that references libc++_shared.so. But I checked its import functions and found it doesn't import any functions from libc++_shared.so. I think there may be a problem with its build process. Anyway, I copied libc++_shared.so from <NDK_PATH>\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\libc++_shared.so on my Windows machine and it works.
3)The third problem is trivial and it is in d8 tool, which relies 'java' in PATH environment variable.
/data/data/com.termux/files/home/android-sdk/build-tools/29.0.3/d8: line 89: exec: java: not found
I fixed it by add a symbol link, and I think it's better documented in the readme.
ln -s /data/data/com.termux/files/home/openjdk-11.0.1/bin/java /data/data/com.termux/files/usr/bin/java
I haven't tested the build of the project without gradle,so there may be some problems, thank you for your reply, the next version of r22 may test and fix these problems!
from termux-ndk.
By the way, I have patched aarch64-linux-android-ld and libc++.so.1 with patchelf and it works great without problem on my Android 8.1 and 10.0 devices.
./patchelf --add-needed libandroid-glob.so aarch64-linux-android-ld
./patchelf --remove-needed libc++_shared.so libc++.so.1
from termux-ndk.
Related Issues (20)
- NDK make issue HOT 1
- Can you build it for armeabi v7a?
- termux-ndk/blob/master/build-app/ Difficulty
- Cmake does not support download from http or https but it must
- 考虑绕过llvm_android直接交叉编译 HOT 18
- cmake error HOT 1
- NDK Updating Request HOT 1
- How can I compile the NDK for linux asahi? HOT 1
- Uncertain If This Should Help My Situation HOT 4
- ninja missing error[ to ease out for futurebies] HOT 1
- Build issues
- Jshell not working for jdk21 HOT 2
- WASM support HOT 1
- Update ndk to latest r26c HOT 1
- Build instructions ?
- Ndk for arm (32bit)
- JNI needs libdl.so HOT 1
- Add to Termux User Repo (TUR)? And be a building block for Android Studio in Termux. HOT 7
- chroot容器 HOT 2
- can you update the user guide
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from termux-ndk.