lzhiyong / termux-ndk Goto Github PK
View Code? Open in Web Editor NEWandroid-ndk for termux
License: Other
android-ndk for termux
License: Other
This task crashed with error:
org.gradle.process.internal.ExecExeption: A problem occured starting process 'command '/home/user/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-objcopy'
arm64-v8a, Qualcomm Snapdragon 888. I don't use C-code in project, I use compiled so-library but this task crashes if NDK is not installed. I install this ndk and this task crashes with another problem now... May be I can skip this task? Help
Hey,
Is it possible to build the JDK for Android on Ubuntu? Actually, Ubuntu on Termux.
I tried to build the JDK in Ubuntu Terminal (installed in Termux). It was successful. But the problem is, it was built for Linux OS and not for Android.
I know we can perform cross compilation to compile it for Android. But I really don't know how to do it. Could you guide me?
I'm trying to compile a Telegram project, I did everything according to the instructions, but I get the following error
The C compiler
"/home/podocodenick/Android/Ndk/android-ndk-r22b/toolchains/llvm/prebuilt/linux-aarch64/bin/clang"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/podocodenick/StudioProjects/X-Android/Y/.cxx/cmake/arm64Release/arm64-v8a/CMakeFiles/CMakeTmp
Run Build Command(s):/home/podocodenick/Android/cmake/bin/ninja cmTC_f6ee9 && [1/2] Building C object CMakeFiles/cmTC_f6ee9.dir/testCCompiler.c.o
FAILED: CMakeFiles/cmTC_f6ee9.dir/testCCompiler.c.o
/home/podocodenick/Android/Ndk/android-ndk-r22b/toolchains/llvm/prebuilt/linux-aarch64/bin/clang -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -o CMakeFiles/cmTC_f6ee9.dir/testCCompiler.c.o -c testCCompiler.c
/bin/sh: 1: /home/podocodenick/Android/Ndk/android-ndk-r22b/toolchains/llvm/prebuilt/linux-aarch64/bin/clang: not found
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt
/home/podocodenick/StudioProjects/X-Android/Y/jni/CMakeLists.txt : C/C++ arm64Release|arm64-v8a : Configuration failed.
executing external native build for cmake /home/podocodenick/StudioProjects/X-Android/Y/jni/CMakeLists.txt
/home/podocodenick/StudioProjects/X-Android/Y/jni/CMakeLists.txt : C/C++ arm64Release|arm64-v8a : CMake Deprecation Warning:
The 'cmake-server(7)' is deprecated. Please port clients to use the
'cmake-file-api(7)' instead.
Seems like Google has updated their system. Last week I found the aapt2 jar for 4.1.2 then replaced it with yours but today I'm not able to find aapt2 jar for 4.2.0 AGP. I again tried with 4.1.2 but same, not found. Now what I need to replace?
Would it be possible for ARM? (I have armv8l)
error for libsamp.so?
Please can you guide How you compile sdk for arm64/termux
I want to update platform-tools and build-tools
i try sdkmanager --update
but it download linux x86_64 binaries
When compiling the Android app with AGP-7.0.x, you will encounter an --source-path
error from aapt2
AAPT unknown option '--source-path'
This option is currently doing nothing in builder-7.0.x.jar
, so I added this option in base/tools/aapt2/cmd/Compile.h
...
bool legacy_mode = false;
// --source-path option
bool source_path = false;
// See comments on aapt::ResourceParserOptions.
bool preserve_visibility_of_styleables = false;
bool verbose = false;
...
AddOptionalSwitch("--legacy", "Treat errors that used to be valid in AAPT as warnings",
&options_.legacy_mode);
// --source-path do nothing
AddOptionalSwitch("--source-path", "Currently this option do nothing",
&options_.source_path);
...
download the aapt2 form sdk-tools
there is no such option in the aapt2 source code, but in builder-7.0.x.jar
does have this option, see https://android.googlesource.com/platform/tools/base/+/refs/heads/mirror-goog-studio-master-dev/build-system/builder/src/main/java/com/android/builder/internal/aapt/v2/AaptV2CommandBuilder.kt
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
Hey please can you try AGDK for termux ?
If you have time
Here is link
https://android.googlesource.com/platform/frameworks/opt/gamesdk/
我自己用sdkmanager下载的build-tools 30.0.0的aapt与aapt2 都不能使用,根据百度搜索是不支持arm64
while compiling static binary with armv7a clang, facing some linker error regarding libz.a
cause of missing symbol
More details and probable fix can be found in this issue by topjohnwu: android/ndk#1391
in my case output:
root@kali:~/dump_source/simg2img# make
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -c backed_block.cpp -o backed_block.o /root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -c output_file.cpp -o output_file.o
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -c sparse.cpp -o sparse.o
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -c sparse_crc32.cpp -o sparse_crc32.o
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -c sparse_err.cpp -o sparse_err.o
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -c sparse_read.cpp -o sparse_read.o
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -c android-base/stringprintf.cpp -o android-base/stringprintf.o
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar rc libsparse.a backed_block.o output_file.o sparse.o sparse_crc32.o sparse_err.o sparse_read.o android-base/stringprintf.o
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ranlib libsparse.a
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -o simg2img simg2img.cpp -L. -lsparse -lm -lz -Wl,--gc-sections -s -static
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: /root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/arm-linux-androideabi/30/libz.a(deflate.o): in function `deflateInit2_':
external/zlib/deflate.c:(.text.deflateInit2_+0x200): undefined reference to `arm_cpu_enable_crc32'
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: external/zlib/deflate.c:(.text.deflateInit2_+0x204): undefined reference to `x86_cpu_enable_simd'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:85: simg2img] Error 1
how did you compile openjdk 11?
Using Github releases, can you package this up please as I cannot get this to compile/link properly on my devices or a simulator.
I managed to install the unmodified NDK from google in this way without errors, I advise you to take a closer look, there is not a single error in the compilation, it works without failures and errors, only much slower.))
Please make working flutter sdk for aarch64.
Thanks.
有没有直接在termux里面运行的go语言工具,go语言官方的arm64的包无法在termux里面直接运行,使用起来太麻烦了
You mentioned her
But already available
"llvm-toolchain/prebuilts/clang/host/linux-x86/clang-bootstrap/sysroot/usr/include/crypt.h"
But I can't find
"patches/crypt.h file"
Can't find Under "patches/crypt.h"
And also same I can't find
"Patches/sFile.h" file
Please follow my screen shot
so i downloaded the latest release (android-ndk-r22b), and extracted it using "tar -xf android-ndk-r22b.tar.xz", everything worked out and it extracted successfully, i then "cd" to "android-ndk-r22b/toolchains/llvm/prebuilt/linux-aarch64/bin", trying to to run "./aarch64-linux-android30-clang++" outputs "./aarch64-linux-android30-clang++: line 3: ./clang++: No such file or directory", but "clang++" exists in the folder, but also, trying to run "./clang++" outputs "bash: ./clang++: Bad address", i don't know what i could be doing wrong so if you know what i have to do to fix this i would appreciate that.
Linux deploy 安装的debian 我试了但是好像不可以
在Android11上官方的gradle无法运行,你编译的jdk可以运行,你可不可以编译一个gradle啊?
I tried many things but still can't build ndk for linux-arm64 secussfully,can you build one?that would be grateful.I believed that there must be others need it like me.
note: not android,just linux-arm64,prooted archlinux on android for example.
I use chrooted kali-linux from kali-nethunter.Can your ndk toolchain from release be used in chrooted linux??Actually i tried to built app with your tools,but ran into some api related problem.
and Can you make the app built section in readme with some extra details?? Kinda confused
# setting the buildToolsVersion
# update buildToolsVersion you need download the sdk-tools, then copy it to android-sdk/build-tools platform-tools
# sdk-tools from https://github.com/Lzhiyong/sdk-tools
buildToolsVersion "30.0.1"
can you explain this part??
and was building termux,don't know possible or not
faced this
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:generateJsonModelDebug'.
> Build command failed.
Error while executing process /root/android-ndk-r22/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/root/termux-app/app/src/main/cpp/Android.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-24 NDK_OUT=/root/termux-app/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/root/termux-app/app/build/intermediates/ndkBuild/debug/lib APP_CFLAGS+=-std=c11 APP_CFLAGS+=-Wall APP_CFLAGS+=-Wextra APP_CFLAGS+=-Werror APP_CFLAGS+=-Os APP_CFLAGS+=-fno-stack-protector APP_CFLAGS+=-Wl,--gc-sections APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
ERROR: Unknown host CPU architecture: aarch64
unkown aarch
Please help me
This problem is now sloved
it's too big......
download whole android code just for build tools.
I am trying to build Chess Engine "Cfish" written in C.
But newer ndk22' gives unexpected result. During compilation there is no error but the executable is not working.
This was not in the previous ndk21b so I switched back to that version again.
😅There is another problem in both Termux's and ndk' clang both gives segmentation fault when compiling some C++ projects for armv7a (32 bit).
Please can you add GCC-10 toolchains in ndk or even a guide how to build GCC toolchains for ndk will be really appreciated.🙏
REGARDS.🥰
Great project but building it all from scratch seems extremely time consuming. Aarch64 Linux system on android can be achieved by installing Kali Nethunter or use Atilo in termux. They both create chroot on Android system and have access to native aarch64 apt packages (what you normally get if you're on a raspberry pi for example).
Already have Android SDK packages, full llvm, and cmake.
I was wondering if I could get around all the building process and have android-ndk installed in a simpler way.
Possibly to Kali chroot instead of termux.
Thanks a lot!
there are some problems with static compilation for Android api level < 29
executable's TLS segment is underaligned: alignment is 8, needs to be at least 64 for ARM64 Bionic
Aborted
How to fix (there are two ways)
use align_fix.py(only arm/arm64), execute the command align_fix.py your executable file
use ndk-r21e sysroot, specify --sysroot=/path/to/ndk-r21e/sysroot
, this way is recommended, don't directly replace the sysroot of r23 with the sysroot of r21e
the python3 in android-ndk-r22/toolchains/llvm/prebuilt/linux-aarch64/python3 is prebuilt?? or compiled from source by you??if compiled, how you did with ndk(?having some issues when compiling for android standalone
could you help build NDK-21e for linux arm64 (not for android), I use Kali nethunter in chroot, it works much faster, I think this release will be useful not only for me
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.