Giter VIP home page Giter VIP logo

termux-ndk's People

Contributors

lzhiyong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

termux-ndk's Issues

extractAfatDebugNativeDebugMetadata

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

Possible to build JDK on Ubuntu?

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?

clang not found

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.


Can't replace aapt2-*-linux.jar

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?

Not working!

I've downloaded the openjdk-11.0.1 from your repo's releases section. But it seems not working:

IMG_20210703_121227

Any solution?

ARM

Would it be possible for ARM? (I have armv8l)

Android sdk

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

aapt2 source-path error

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

Host API Level

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

libz.a for armv7a missing symbols

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

Gradle cache error

Hello, I have a problem with gradle and I don't understand :/
Screenshot_20210208-130758_Termux
It's a screenshot of my error. Can you help me please :)
Thanks in advance !

Flutter

Please make working flutter sdk for aarch64.
Thanks.

New Issue Arrived

Screenshot_2021-06-24-09-31-27-943_com termux
New issue. New AAPT2 daemon startup failing with syntax error. Google updated their tools also their build system?

Missing files

You mentioned her

copy "patches/crypt.h" to "llvm-toolchain/prebuilts/clang/host/linux-x86/clang-bootstrap/sysroot/usr/include"

copy "patches/sFile.h" to "llvm-toolchain/toolchain/llvm-project/lldb/include/lldb/Utility"

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

Screenshot_2021-05-20-21-22-40-432_com termux
Screenshot_2021-05-20-21-17-11-223_com termux

Clang is not working

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.

编译openjdk12失败

编译openjdk12失败
设备:android11
Screenshot_2021-07-18-23-08-03-632_com termux
Screenshot_2021-07-18-23-06-09-551_com termux

如图初步判断jdk11嗝屁了
我没有安卓10设备

About linux-arm64 build

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.

Can Be used in Chrooted Linux??

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

Unexpected ndk22' Clang Error.

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.
Screenshot_20210213-131205~2
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).
Screenshot_20210212-133112~2

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.🥰

Simplifying installation

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!

ndk static compilation error

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

cross compile python3??

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

need help building NDK-21e for linux arm64

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.