Coder Social home page Coder Social logo

leleliu008 / ndk-pkg Goto Github PK

View Code? Open in Web Editor NEW
85.0 6.0 14.0 13.33 MB

A package builder/manager for Android NDK to build projects written in C, C++, Rust, Golang, etc.

Home Page: http://blog.fpliu.com/project/ndk-pkg

License: Apache License 2.0

Shell 35.47% CMake 1.91% Dockerfile 0.02% C 62.60%
android-ndk c cxx package-manager cli rust golang

ndk-pkg's Introduction

ndk-pkg

A package builder/manager for Android NDK to build projects written in C, C++, Rust, Golang, etc.

Caveats

Please read these caveats carefully before starting to use this software.

  • This software is being actively developed. It's in beta stage and may not be stable. Some features are subject to change without notice.

  • This software can NOT run on Android, musl-libc based GNU/Linux, FreeBSD, OpenBSD, NetBSD due to lack of Android NDK for these platforms.

  • This software can NOT run on Cygwin and MSYS2 due to CMake: Builds hosted on 'CYGWIN' not supported. Android-Determine.cmake

  • Please do NOT place your own files under ~/.ndk-pkg directory, as ndk-pkg will change files under ~/.ndk-pkg directory without notice.

  • Please do NOT run ndk-pkg command in parallel so as not to generate dirty data.

Supported platforms (platforms that this software can be run on)

HostOS HostArch SubSystem recommended fully tested fully supported
x86_64 Docker ✔︎ ✔︎ ✔︎
GNU/Linux x86_64 glibc ✔︎ ✔︎ ✔︎
Windows x86_64 WSL
macOS x86_64 arm64 ✔︎

Using ndk-pkg via GitHub Actions

This is the recommended way of using this software.

In this way, you don't need to care about other things than:

  • which package would you like to build? lookup package names
  • which minimum Android SDK API level would you like to support?
  • which Android ABI would you like to build for?
  • which build profile would you like to use?

For more details please refer to https://github.com/leleliu008/ndk-pkg-package-manually-build

Using ndk-pkg via Docker

step1. create the ndk-pkg docker container

mkdir -p ~/ndk-pkg-home
mkdir -p ~/.m2

docker create -it --name ndk-pkg -v ~/ndk-pkg-home:/root/.ndk-pkg -v ~/.m2:/root/.m2 fpliu/ndk-pkg

step2. start the ndk-pkg docker container

docker start ndk-pkg

step3. install essential tools

docker exec -it ndk-pkg ndk-pkg setup

step4. update formula repositories

docker exec -it ndk-pkg ndk-pkg update

If all goes well, then next you can start to install packages whatever you want, for example, let's install curl package:

docker exec -it ndk-pkg ndk-pkg install android-34-arm64-v8a/curl

Note: you can use podman instead of docker

Install ndk-pkg via cURL

curl -LO https://raw.githubusercontent.com/leleliu008/ndk-pkg/master/ndk-pkg
chmod a+x ndk-pkg
./ndk-pkg setup

Install ndk-pkg via wget

wget https://cdn.jsdelivr.net/gh/leleliu008/ndk-pkg/ndk-pkg
chmod a+x ndk-pkg
./ndk-pkg setup

Install ndk-pkg via git

git clone --depth 1 https://github.com/leleliu008/ndk-pkg
ndk-pkg/ndk-pkg setup

Install ndk-pkg in WSL

Note :

  • As of Android NDK r25, due to use of BOLT to optimize the Android NDK's linux binaries, Android NDK is incompatible with WSL1. For more details please read android/ndk#1755

/etc/wsl.conf :

[network]
hostname = ubuntu
generateHosts = false

[automount]
enabled = true
root = /mnt/
options = "metadata,umask=22,fmask=11"
mountFsTab = true

installation instructions :

# If you want to store ndk-pkg generated data to D:\ partition to share with your Windows
mkdir  /mnt/d/ndk-pkg
ln -sf /mnt/d/ndk-pkg ~/.ndk-pkg

# If you use Ubuntu or Debian distribution
sudo apt -y update
sudo apt -y install curl xz-utils g++

curl -LO https://raw.githubusercontent.com/leleliu008/ndk-pkg/master/ndk-pkg
chmod a+x ndk-pkg
./ndk-pkg setup

~/.ndk-pkg

Caveats: Please do NOT place your own files under ~/.ndk-pkg directory, as ndk-pkg will change (remove, modify, override) files under ~/.ndk-pkg directory without notice.

a typical hierarchical structure under ~/.ndk-pkg directory looks like below:

~/.ndk-pkg
├── core
│   ├── SourceCodePro-Light.otf
│   ├── cacert.pem
│   ├── fonts.conf
│   ├── init.rc
│   ├── ndk-pkg-core-2024.05.15-linux-x86_64.tar.xz
│   ├── ndk-pkg-core-latest-release-version
│   ├── sed-in-place
│   ├── uppm
│   ├── wrapper-native-cc
│   ├── wrapper-native-c++
│   ├── wrapper-native-objc
│   ├── wrapper-target-cc
│   ├── wrapper-target-c++
│   ├── zig-cc
│   ├── zig-c++
│   ├── zig-ar
│   └── zig-ranlib
├── downloads
│   ├── 8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313.tgz
│   ├── b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30.tgz
│   └── c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4.tgz
├── installed
│   ├── android-34-arm64-v8a
│   │   ├── f39a5f7836ac7ca1e04de14c8103e663d0b375a524a40e537258747e2deb3c0b
│   │   │   ├── include
│   │   │   ├── lib
│   │   │   └── share
│   │   └── zlib -> f39a5f7836ac7ca1e04de14c8103e663d0b375a524a40e537258747e2deb3c0b
│   ├── android-34-armeabi-v7a
│   │   ├── cc9b367d5068ef6b8aaaee38ec2a25691da35e02757c7e0d83aff3775aef3323
│   │   │   ├── include
│   │   │   ├── lib
│   │   │   └── share
│   │   └── zlib -> cc9b367d5068ef6b8aaaee38ec2a25691da35e02757c7e0d83aff3775aef3323
│   ├── android-34-x86
│   │   ├── a0718632fe829426c1d946e6658cc7586da0039e99d5a140d1e402a6b4a4e2f3
│   │   │   ├── include
│   │   │   ├── lib
│   │   │   └── share
│   │   └── zlib -> a0718632fe829426c1d946e6658cc7586da0039e99d5a140d1e402a6b4a4e2f3
│   └── android-34-x86_64
│       ├── c099047714d4ce1402d66346da88d14f25c313b0d4c879520198426ebc2f36fe
│       │   ├── include
│       │   ├── lib
│       │   └── share
│       └── zlib -> c099047714d4ce1402d66346da88d14f25c313b0d4c879520198426ebc2f36fe
├── native
│   └── linux-x86_64
│       ├── 30b5043e2c5513343152506e5b1e14436ddbb654f7edf69167df05f117fcdb16
│       │   ├── bin
│       │   │   ├── aclocal
│       │   │   ├── aclocal-1.16
│       │   │   ├── automake
│       │   │   └── automake-1.16
│       │   ├── share
│       │   └── receipt.txt
│       └── automake -> 30b5043e2c5513343152506e5b1e14436ddbb654f7edf69167df05f117fcdb16
├── uppm
│   ├── downloads
│   │   ├── fe6b6f7db67a20ccca0385ae38c4aafc7b2bfedc98f9d86880dfeb127a56c012.txz
│   │   └── ff66b70c830a38d331d44f6c25a37b582471def9a161c93902bac7bea3098319.tgz
│   ├── installed
│   │   ├── android-ndk-r26d
│   │   │   ├── CHANGELOG.md
│   │   │   ├── NOTICE
│   │   │   ├── NOTICE.toolchain
│   │   │   ├── README.md
│   │   │   ├── build
│   │   │   ├── meta
│   │   │   ├── ndk-build
│   │   │   ├── ndk-gdb
│   │   │   ├── ndk-lldb
│   │   │   ├── ndk-stack
│   │   │   ├── ndk-which
│   │   │   ├── prebuilt
│   │   │   ├── python-packages
│   │   │   ├── shader-tools
│   │   │   ├── simpleperf
│   │   │   ├── source.properties
│   │   │   ├── sources
│   │   │   ├── toolchains
│   │   │   └── wrap.sh
│   │   ├── bash
│   │   │   ├── bin
│   │   │   └── share
│   │   ├── bsdtar
│   │   │   ├── bin
│   │   │   └── share
│   │   ├── coreutils
│   │   │   ├── bin
│   │   │   ├── libexec
│   │   │   └── share
│   │   ├── curl
│   │   │   ├── bin
│   │   │   └── share
│   │   ├── d2
│   │   │   ├── bin
│   │   │   └── share
│   │   ├── dot_static
│   │   │   └── bin
│   │   ├── findutils
│   │   │   ├── bin
│   │   │   ├── libexec
│   │   │   ├── share
│   │   │   └── var
│   │   ├── gawk
│   │   │   ├── bin
│   │   │   ├── etc
│   │   │   ├── libexec
│   │   │   └── share
│   │   ├── git
│   │   │   ├── bin
│   │   │   ├── libexec
│   │   │   └── share
│   │   ├── grep
│   │   │   ├── bin
│   │   │   └── share
│   │   ├── gsed
│   │   │   ├── bin
│   │   │   └── share
│   │   ├── jq
│   │   │   ├── bin
│   │   │   └── share
│   │   ├── patchelf
│   │   │   ├── bin
│   │   │   └── share
│   │   ├── pkg-config
│   │   │   ├── bin
│   │   │   └── share
│   │   ├── sysinfo
│   │   │   └── bin
│   │   ├── tree
│   │   │   ├── bin
│   │   │   └── share
│   │   ├── xxd
│   │   │   └── bin
│   │   ├── yq
│   │   │   └── bin
│   │   └── zip
│   │       ├── bin
│   │       └── share
│   └── repos.d
│       └── official-core
│           ├── LICENSE
│           ├── README.md
│           └── formula
├── repos.d
│   └── official-core
│       ├── formula
│       │   ├── zlib.yml
│       │   ├── libbz2.yml
│       │   ├── liblzma.yml
│       │   └── libzstd.yml
│       └── README.md
└── run
    ├── 3409784
    ├── 3447656
    └── 3457395

ndk-pkg command usage

  • show help of this command

    ndk-pkg -h
    ndk-pkg --help
  • show version of this command

    ndk-pkg -V
    ndk-pkg --version
  • show basic information about this software

    ndk-pkg about
  • show basic information about your current running operation system

    ndk-pkg sysinfo
  • show basic information about the specified location of Android NDK

    ndk-pkg ndkinfo /usr/local/share/android-ndk
  • generate url-transform sample

    ndk-pkg gen-url-transform-sample
  • install essential tools used by this shell script

    ndk-pkg setup

    This command is actually to do two things:

  • integrate zsh-completion script

    ndk-pkg integrate zsh
    ndk-pkg integrate zsh --output-dir=/usr/local/share/zsh/site-functions
    ndk-pkg integrate zsh -v

    This software provides a zsh-completion script for ndk-pkg. when you've typed ndk-pkg then type TAB key, the rest of the arguments will be automatically complete for you.

    Note: to apply this feature, you may need to run the command autoload -U compinit && compinit in your terminal (your current running shell must be zsh).

    Caveat: to use this feature, you should put ndk-pkg command in PATH

  • update all available formula repositories

    ndk-pkg update
  • search all available packages whose name matches the given regular expression pattern

    ndk-pkg search curl
    ndk-pkg search lib
  • show information of the given available package

    ndk-pkg info-available curl
    ndk-pkg info-available curl --yaml
    ndk-pkg info-available curl --json
    ndk-pkg info-available curl version
    ndk-pkg info-available curl license
    ndk-pkg info-available curl summary
    ndk-pkg info-available curl web-url
    ndk-pkg info-available curl git-url
    ndk-pkg info-available curl git-sha
    ndk-pkg info-available curl git-ref
    ndk-pkg info-available curl src-url
    ndk-pkg info-available curl src-sha
    ndk-pkg info-available curl src-ft
    ndk-pkg info-available curl src-fp
  • show information of the given installed package

    ndk-pkg info-installed android-34-arm64-v8a/curl --prefix
    ndk-pkg info-installed android-34-arm64-v8a/curl --files
    ndk-pkg info-installed android-34-arm64-v8a/curl builtat
    ndk-pkg info-installed android-34-arm64-v8a/curl builtat-iso-8601
    ndk-pkg info-installed android-34-arm64-v8a/curl builtat-rfc-3339
    ndk-pkg info-installed android-34-arm64-v8a/curl builtat-iso-8601-utc
    ndk-pkg info-installed android-34-arm64-v8a/curl builtat-rfc-3339-utc
  • show packages that are depended by the given package

    ndk-pkg depends curl
    
    ndk-pkg depends curl -t d2
    ndk-pkg depends curl -t dot
    ndk-pkg depends curl -t box
    ndk-pkg depends curl -t png
    ndk-pkg depends curl -t svg
    
    ndk-pkg depends curl -t d2  -o dependencies/
    ndk-pkg depends curl -t dot -o dependencies/
    ndk-pkg depends curl -t box -o dependencies/
    ndk-pkg depends curl -t png -o dependencies/
    ndk-pkg depends curl -t svg -o dependencies/
    
    ndk-pkg depends curl -o curl-dependencies.d2
    ndk-pkg depends curl -o curl-dependencies.dot
    ndk-pkg depends curl -o curl-dependencies.box
    ndk-pkg depends curl -o curl-dependencies.png
    ndk-pkg depends curl -o curl-dependencies.svg
  • download resources of the given package to the local cache

    ndk-pkg fetch curl
    ndk-pkg fetch curl -v
  • install packages

    ndk-pkg install curl
    ndk-pkg install android-34-arm64-v8a/curl
    ndk-pkg install android-34-arm64-v8a/curl --static
  • reinstall packages

    ndk-pkg reinstall curl
    ndk-pkg reinstall android-34-arm64-v8a/curl --static
  • uninstall packages

    ndk-pkg uninstall curl
    ndk-pkg uninstall android-34-arm64-v8a/curl
  • upgrade the outdated packages

    ndk-pkg upgrade curl
    ndk-pkg upgrade android-34-arm64-v8a/curl --static
  • upgrade this software

    ndk-pkg upgrade-self
    ndk-pkg upgrade-self -v
  • list all available formula repositories

    ndk-pkg formula-repo-list
  • add a new formula repository

    ndk-pkg formula-repo-add my_repo https://github.com/leleliu008/ndk-pkg-formula-repository-my_repo
    ndk-pkg formula-repo-add my_repo https://github.com/leleliu008/ndk-pkg-formula-repository-my_repo master
    ndk-pkg formula-repo-add my_repo https://github.com/leleliu008/ndk-pkg-formula-repository-my_repo main
  • delete a existing formula repository

    ndk-pkg formula-repo-del my_repo
  • list all available packages

    ndk-pkg ls-available
  • list all installed packages

    ndk-pkg ls-installed
  • list all outdated packages

    ndk-pkg ls-outdated
  • check if the given package is available

    ndk-pkg is-available curl
  • check if the given package is installed

    ndk-pkg is-installed curl
    ndk-pkg is-installed android-34-arm64-v8a/curl
  • check if the given package is outdated

    ndk-pkg is-outdated  curl
    ndk-pkg is-outdated  android-34-arm64-v8a/curl
  • list installed files of the given installed package in a tree-like format

    ndk-pkg tree curl
    ndk-pkg tree android-34-arm64-v8a/curl -L 3
  • show logs of the given installed package

    ndk-pkg logs curl
    ndk-pkg logs android-34-arm64-v8a/curl
  • pack the given installed package

    ndk-pkg pack curl
    ndk-pkg pack android-34-arm64-v8a/curl
    ndk-pkg pack android-34-arm64-v8a/curl -t tar.xz
    ndk-pkg pack android-34-arm64-v8a/curl -t tar.gz
    ndk-pkg pack android-34-arm64-v8a/curl -t tar.lz
    ndk-pkg pack android-34-arm64-v8a/curl -t tar.bz2
    ndk-pkg pack android-34-arm64-v8a/curl -t zip
    ndk-pkg pack android-34-arm64-v8a/curl -t zip -o a/
    ndk-pkg pack android-34-arm64-v8a/curl -o a/x.zip
  • export the given installed package as the google prefab aar

    ndk-pkg export android-34-arm64-v8a,x86_64/curl -o .
    ndk-pkg export android-34-arm64-v8a,x86_64/curl -o curl-8.1.2.aar
  • export the given installed package as the google prefab aar then deploy it to Maven Local Repository

    ndk-pkg depoly android-34-arm64-v8a,x86_64/curl
    ndk-pkg depoly android-34-arm64-v8a,x86_64/curl --debug
    ndk-pkg depoly android-34-arm64-v8a,x86_64/curl --local=/somewhere
  • export the given installed package as the google prefab aar then deploy it to Sonatype OSSRH

    ndk-pkg depoly android-34-arm64-v8a,x86_64/curl --remote < ~/OSSRH-config
    ndk-pkg depoly android-34-arm64-v8a,x86_64/curl --remote <<EOF
    SERVER_ID=OSSRH
    SERVER_URL=https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
    SERVER_USERNAME=your-sonatype-account-username
    SERVER_PASSWORD=your-sonatype-account-password
    GPG_PASSPHRASE=your-gpg-store-passphase
    EOF
  • delete the unused cached files

    ndk-pkg cleanup

environment variables

  • HOME

    This environment variable already have been set on the most operating systems, if not set or set a empty string, you may receive an error message.

  • PATH

    This environment variable already have been set on the most operating systems, if not set or set a empty string, you may receive an error message.

  • SSL_CERT_FILE

    curl -LO https://curl.se/ca/cacert.pem
    export SSL_CERT_FILE="$PWD/cacert.pem"

    In general, you don't need to set this environment variable, but, if you encounter the reporting the SSL certificate is invalid, trying to run above commands in your terminal will do the trick.

  • GOPROXY

    export GOPROXY='https://goproxy.cn'
  • NDKPKG_URL_TRANSFORM

    export NDKPKG_URL_TRANSFORM=/path/of/url-transform

    /path/of/url-transform command would be invoked as /path/of/url-transform <URL>

    /path/of/url-transform command must output a <URL>

    you can generate a url-transform sample via ndk-pkg gen-url-transform-sample

    If you want to change the request url, you can set this environment variable. It is very useful for chinese users.

  • NDKPKG_XTRACE

    For debugging purposes.

    enable set -x:

    export NDKPKG_XTRACE=1
  • NDKPKG_HOME

    If this environment variable is not set or set a empty string, ~/.ndk-pkg will be used as the default value.

    export NDKPKG_HOME=/path/of/ndk-pkg-home
  • NDKPKG_DEFAULT_TARGET

    Some ACTIONs of ndk-pkg are associated with an installed package which need PACKAGE-SPEC to be specified.

    PACKAGE-SPEC : a formatted string that has form: <TARGET>/<PACKAGE-NAME>, represents an installed package.

    PACKAGE-NAME : should match the regular expression pattern ^[A-Za-z0-9+-_.@]{1,50}$

    TARGET : a formatted string that has form: android-<ANDROID-API>-<ANDROID-ABI>

    ANDROID-API : indicates which minimum Android SDK API Level was built with.

    ANDROID-ABI : indicates which Android ABI was built for.

    To simplify the usage, you are allowed to omit <TARGET>/. If <TARGET>/ is omitted, environment variable NDKPKG_DEFAULT_TARGET would be checked, if this environment variable is not set, then android-21-arm64-v8a will be used as the default.

    Example:

    export NDKPKG_DEFAULT_TARGET='android-34-arm64-v8a'

Note: some commonly used environment variables are override by this software, these are CC, CXX, CPP, AS, AR, LD, CFLAGS, CPPFLAGS, LDFLAGS, PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH, ACLOCAL_PATH

ndk-pkg formula scheme

a ndk-pkg formula is a YAML format file which is used to config a ndk-pkg package's meta-information including one sentence description, package version, installation instructions, etc.

a ndk-pkg formula's filename suffix must be .yml

a ndk-pkg formula'a filename prefix would be treated as the package name.

a ndk-pkg formula'a filename prefix must match regular expression pattern ^[A-Za-z0-9+-._@]{1,50}$

a ndk-pkg formula's file content only has one level mapping and shall has following KEY:

KEY required? overview
pkgtype optional indicates what type of this package. value shall be any one of exe, pie, lib, exe+lib.
To exe type package, ndk-pkg would add --static -static options to LDFLAGS if --static install option is given.
To pie type package, it means that it doesn't support fully statically linking, it is supposed to be dynamically linked.
If this mapping is not present, ndk-pkg will determine the package type by package name, if a package name starts/ends with lib, it would be recognized as type lib, otherwise, it would be recognized as type exe
summary required describe this package in one sentence.
license optional a space-separated list of SPDX license short identifiers
version optional the version of this package.
If this mapping is not present, it will be calculated from src-url, if src-url is also not present, it will be calculated from running time as format date +%Y.%m.%d
web-url optional the home webpage of this package.
If this mapping is not present, git-url must be present.
git-url optional the source code git repository.
If src-url is not present, this mapping must be present.
git-ref optional reference: https://git-scm.com/book/en/v2/Git-Internals-Git-References
example values: HEAD refs/heads/master refs/heads/main refs/tags/v1, default value is HEAD
git-sha optional the full git commit id, 40-byte hexadecimal string, if git-ref and git-sha both are present, git-sha takes precedence over git-ref
git-nth optional tell ndk-pkg that how many depth commits would you like to be fetched. default is 1, this would save your time and storage. If you want to fetch all commits, set this to 0
src-url optional the source code download url of this package.
If value of this mapping ends with one of .zip .tar.xz .tar.gz .tar.lz .tar.bz2 .tgz .txz .tlz .tbz2 .crate, it will be uncompressed to $PACKAGE_WORKING_DIR/src when this package is installing, otherwise, it will be copied to $PACKAGE_WORKING_DIR/src
also support format like dir://DIR
src-uri optional the mirror of src-url.
src-sha optional the sha256sum of source code.
src-sha and src-url must appear together.
fix-url optional the patch file download url of this package.
If value of this mapping ends with one of .zip .tar.xz .tar.gz .tar.lz .tar.bz2 .tgz .txz .tlz .tbz2 .crate, it will be uncompressed to $PACKAGE_WORKING_DIR/fix when this package is installing, otherwise, it will be copied to $PACKAGE_WORKING_DIR/fix.
fix-uri optional the mirror of fix-url.
fix-sha optional the sha256sum of patch file.
fix-sha and fix-url must appear together.
fix-opt optional options to be passed to patch command. default value is -p1.
patches optional multiple lines of <fix-sha>|<fix-url>[|fix-uri][|fix-opt].
res-url optional other resource download url of this package.
If value of this mapping ends with one of .zip .tar.xz .tar.gz .tar.lz .tar.bz2 .tgz .txz .tlz .tbz2 .crate, it will be uncompressed to $PACKAGE_WORKING_DIR/res when this package is installing, otherwise, it will be copied to $PACKAGE_WORKING_DIR/res.
res-uri optional the mirror of res-url.
res-sha optional the sha256sum of resource file.
res-sha and res-url must appear together.
reslist optional multiple lines of <res-sha>|<res-url>[|res-uri][|unpack-dir][|N]. unpack-dir is relative to $PACKAGE_WORKING_DIR/res, default value is empty. N is --strip-components=N
dep-pkg optional a space-separated list of ndk-pkg packages that are depended by this package when installing and/or runtime, which will be installed via ndk-pkg.
dep-upp optional a space-separated list of uppm packages that are depended by this package when installing and/or runtime, which will be installed via uppm.
dep-pym optional a space-separated list of python packages that are depended by this package when installing and/or runtime, which will be installed via pip3.
dep-plm optional a space-separated list of perl modules that are depended by this package when installing and/or runtime, which will be installed via cpan.
ccflags optional append to CFLAGS
xxflags optional append to CXXFLAGS
ppflags optional append to CPPFLAGS
ldflags optional append to LDFLAGS
bsystem optional build system name.
values can be one or a combination of autogen autotools configure cmake cmake+gmake cmake+ninja meson xmake gmake ninja cargo go rake ndk-build
bscript optional the directory where the build script is located in, relative to PACKAGE_WORKING_DIR. build script such as configure, Makefile, CMakeLists.txt, meson.build, Cargo.toml, etc.
binbstd optional whether to build in the directory where the build script is located in, otherwise build in other directory.
value shall be 0 or 1. default value is 0.
movable optional whether can be moved/copied to other locations.
value shall be 0 or 1. default value is 1.
parallel optional whether to allow build system running jobs in parallel.
value shall be 0 or 1. default value is 1.
api-min optional specify which minimum Android SDK API level is supported for this package.
onstart optional POSIX shell code to be run when this package's formula is loaded.
PWD is $PACKAGE_WORKING_DIR
onready optional POSIX shell code to be run when this package's needed resources all are ready.
PWD is $PACKAGE_BSCRIPT_DIR
onfinal optional POSIX shell code to be run when this package is successfully installed.
PWD is $PACKAGE_INSTALL_DIR
do12345 optional POSIX shell code to be run for native build.
It is only meaningful when requesting for cross building.
It is running in a separated process.
dopatch optional POSIX shell code to be run to apply patches manually.
PWD is $PACKAGE_BSCRIPT_DIR
prepare optional POSIX shell code to be run to do some additional preparation.
PWD is $PACKAGE_BSCRIPT_DIR
install optional POSIX shell code to be run when user run ndk-pkg install <PKG>. If this mapping is not present, ndk-pkg will run default install code according to bsystem.
PWD is $PACKAGE_BSCRIPT_DIR if binbstd is 0, otherwise it is $PACKAGE_BCACHED_DIR
dotweak optional POSIX shell code to be run to do some tweaks immediately after installing.
PWD is $PACKAGE_INSTALL_DIR
caveats optional multiple lines of plain text to be displayed after installation.
phases of a package's installation
phases
build system name build script file name
meson meson.build
cmake CMakeLists.txt
gmake GNUMakefile or Makefile
ninja build.ninja
xmake xmake.lua
cargo Cargo.toml
go go.mod
rake Rakefile
autogen autogen.sh
autotools configure.ac
configure configure
ndk-build Android.mk

commands that can be used out of the box:

command usage-example
bash Reference
CoreUtils Reference
xargs Reference
find Reference
gawk Reference
gsed Reference
grep Reference
tree Reference
jq Reference
yq Reference
d2 Reference
bat Reference
xxd Reference
git Reference
curl Reference
bsdtar Reference
pkg-config Reference
patchelf Reference
sysinfo Reference
echo echo 'your message.'
info info 'your information.'
warn warn "no package manager found."
error error 'error message.'
abort abort 1 "please specify a package name."
success success "build success."
isInteger isInteger $x || abort 1 "should be an integer."
isCrossBuild isCrossBuild && abort 1 "This package is not supposed to be cross built."
sedInPlace sedInPlace 's/-mandroid//g' Configure
wfetch wfetch <URL> [--uri=<URL-MIRROR>] [--sha256=<SHA256>] [-o <PATH> [-q]
configure configure --enable-pic
mesonw mesonw -Dneon=disabled -Darm-simd=disabled
cmakew cmakew -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON
gmakew gmakew
xmakew xmakew
cargow cargow
gow gow

shell variables can be used directly:

variable overview
NDKPKG_ARG0 the 1st arguments of ndk-pkg that you've supplied.
NDKPKG_ARG1 the 2nd arguments of ndk-pkg that you've supplied.
NDKPKG_ARGV the all arguments of ndk-pkg that you've supplied.
NDKPKG_PATH the full path of ndk-pkg that you're running.
NDKPKG_HOME the home directory of ndk-pkg that you're running.
NDKPKG_VERSION the version of ndk-pkg that you're running.
UPPM the executable filepath of uppm
TIMESTAMP_UNIX the unix timestamp of this action.
NATIVE_OS_KIND current running os kind. value might be linux or darwin
NATIVE_OS_TYPE current running os type. value might be linux or macos
NATIVE_OS_NAME current running os name. value might be Ubuntu, macOS, etc
NATIVE_OS_VERS current running os version.
NATIVE_OS_ARCH current running os arch. value might be any one of x86_64, arm64, etc
NATIVE_OS_NCPU current running os's cpu core count.
NATIVE_OS_EUID current running os's effective user ID.
NATIVE_OS_EGID current running os's effective group ID.
TARGET_PLATFORM_VERS android sdk api-level table
TARGET_PLATFORM_NBIT value shall be any one of 32 64
TARGET_PLATFORM_ARCH value shall be any one of armv7a aarch64 i686 x86_64
TARGET_PLATFORM_ABI value shall be any one of armeabi-v7a arm64-v8a x86 x86_64
TARGET_TRIPLE value shall be any one of armv7a-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android
ANDROID_NDK_HOME the home directory of Android NDK.
ANDROID_NDK_ROOT the home directory of Android NDK.
ANDROID_NDK_VERSION the version of Android NDK.
ANDROID_NDK_VERSION_MAJOR the major part of version of Android NDK.
ANDROID_NDK_TOOLCHAIN_BIND the bin directory of Android NDK.
ANDROID_NDK_SYSROOT the sysroot directory of Android NDK.
CC_FOR_BUILD the C Compiler for native build.
CFLAGS_FOR_BUILD the flags of CC_FOR_BUILD.
CXX_FOR_BUILD the C++ Compiler for native build.
CXXFLAGS_FOR_BUILD the flags of CXX_FOR_BUILD.
CPP_FOR_BUILD the C/C++ PreProcessor for native build.
CPPFLAGS_FOR_BUILD the flags of CPP_FOR_BUILD.
AS_FOR_BUILD the assembler for native build.
AR_FOR_BUILD the archiver for native build.
RANLIB_FOR_BUILD the archiver extra tool for native build.
LD_FOR_BUILD the linker for native build.
LDFLAGS_FOR_BUILD the flags of LD_FOR_BUILD.
NM_FOR_BUILD a command line tool to list symbols from object files for native build.
STRIP_FOR_BUILD a command line tool to discard symbols and other data from object files for native build.
CC the C Compiler.
CFLAGS the flags of CC.
CXX the C++ Compiler.
CXXFLAGS the flags of CXX.
CPP the C/C++ PreProcessor.
CPPFLAGS the flags of CPP.
AS the assembler.
AR the archiver.
RANLIB the archiver extra tool.
LD the linker.
LDFLAGS the flags of LD.
NM a command line tool to list symbols from object files.
STRIP a command line tool to discard symbols and other data from object files.
PACKAGE_WORKING_DIR the working directory when installing.
PACKAGE_BSCRIPT_DIR the directory where the build script (e.g. Makefile, configure, CMakeLists.txt, meson.build, Cargo.toml, etc) is located in.
PACKAGE_BCACHED_DIR the directory where the temporary files are stored in when building.
PACKAGE_INSTALL_DIR the directory where the final files will be installed to.
x_INSTALL_DIR the installation directory of x package.
x_INCLUDE_DIR $x_INSTALL_DIR/include
x_LIBRARY_DIR $x_INSTALL_DIR/lib

ndk-pkg formula repository

a typical hierarchical structure of a ndk-pkg formula repository looks like below:

NDKPKGFormulaRepoName
├── formula
│   ├── packageA.yml
│   └── packageB.yml
├── LICENSE
└── README.md

ndk-pkg formula repository local location

${NDKPKG_HOME}/repos.d/${NDKPKGFormulaRepoName}

ndk-pkg formula repository local config

a ndk-pkg formula repository's config file is located at ${NDKPKG_HOME}/repos.d/${NDKPKGFormulaRepoName}/.ndk-pkg-formula-repo.yml

a typical ndk-pkg formula repository's config file content looks like below:

url: https://github.com/leleliu008/ndk-pkg-formula-repository-official-core
branch: master
pinned: 0
enabled: 1
created: 1673684639
updated: 1673684767

If a ndk-pkg formula repository is pinned, which means it would not be updated.

If a ndk-pkg formula repository is disabled, which means ndk-pkg would not search formulas in this formula repository.

ndk-pkg formula repository management

run ndk-pkg formula-repo-add command to create a new formula repository locally from an exsting remote git repository.

run ndk-pkg formula-repo-init command to create a new formula repository locally without taking any further action.

ndk-pkg official formula repository

ndk-pkg official formula repository is hosted at https://github.com/leleliu008/ndk-pkg-formula-repository-official-core

It would be automatically fetched to your local repository as name official-core when you run ndk-pkg update command.

Note: If you find that a package is not in ndk-pkg official formula repository yet, PR is welcomed.

Using my prefab aars that have been published to GitHub-Hosted Maven Repository alongside with Android Gradle Plugin

I have published some commonly used packages as google prefab aar to https://github.com/leleliu008/ndk-pkg-prefab-aar-maven-repo

Using my prefab aars that have been published to Maven Central Repository alongside with Android Gradle Plugin

I have published some commonly used packages as google prefab aar to Maven Central Repository.

To get the full list of my published packages, please visit the following websites:

In the next two sections, I will show you how to configure with Android Gradle Plugin in Kotlin DSL and Groovy DSL respectively.

configure with Android Gradle Plugin Kotlin DSL

step1. enable prefab feature for Android Gradle Plugin

android {
    buildFeatures {
        prefab = true
    }
}

step2. enable Maven Central Repository for Gradle

allprojects {
    repositories {
        maven {
            mavenCentral()
        }
    }
}

**大陆的用户可使用如下配置:

allprojects {
    repositories {
        maven {
            maven { url = uri("https://maven.aliyun.com/repository/public") }
        }
    }
}

step3. add dependencies in build.gradle.kts

Every package's coordinate for Gradle is com.fpliu.ndk.pkg.prefab.android.21:<PACKAGE-NAME>:<PACKAGE-VERSION>, for example, libpng package has a version 1.6.37, we could use it as follows:

dependencies {
    implementation ("com.fpliu.ndk.pkg.prefab.android.21:libpng:1.6.37")
}

step4. invoke find_package(PACKAGE-NAME [REQUIRED] CONFIG) command in your Android project's CMakeLists.txt

Every package provides several cmake imported targets:

TARGET-NAME example summary
<PACKAGE-NAME>::headers libpng::headers C/C++ header files only
<PACKAGE-NAME>::lib*.a libpng::libpng16.a static library
<PACKAGE-NAME>::lib*.so libpng::libpng16.so shared library
<PACKAGE-NAME>::* libpng::libpng base on .pc files

Following is a piece of codes show you how to link libpng.a which is provided by libpng package:

find_package(libpng REQUIRED CONFIG)
target_link_libraries(app libpng::libpng.a)

or

find_package(libpng CONFIG)
if (libpng_FOUND)
    target_link_libraries(app libpng::libpng.a)
endif()

step5. configure C++ standard and STL in build.gradle.kts

android {
    defaultConfig {
        externalNativeBuild {
            cmake {
                arguments += "-DANDROID_STL=c++_shared"
                cppFlags  += "-std=c++17"
            }
        }
    }
}

Note:

  • This step is only required for packages that use libc++.
  • If you link a shared library that depends on libc++_shared.so, then your Android app should use libc++_shared.so too.

configure with Android Gradle Plugin Groovy DSL

step1. enable prefab feature for Android Gradle Plugin

android {
    buildFeatures {
        prefab true
    }
}

step2. enable Maven Central Repository for Gradle

allprojects {
    repositories {
        maven {
            mavenCentral()
        }
    }
}

**大陆的用户可使用如下配置:

allprojects {
    repositories {
        maven {
            url 'https://maven.aliyun.com/repository/public'
        }
    }
}

step3. add dependencies in build.gradle

Every package's coordinate for Gradle is com.fpliu.ndk.pkg.prefab.android.21:<PACKAGE-NAME>:<PACKAGE-VERSION>, for example, libpng package has a version 1.6.37, we could use it as follows:

dependencies {
    implementation 'com.fpliu.ndk.pkg.prefab.android.21:libpng:1.6.37'
}

step4. invoke find_package(PACKAGE-NAME [REQUIRED] CONFIG) command in your Android project's CMakeLists.txt

Every package provides several cmake imported targets:

TARGET-NAME example summary
<PACKAGE-NAME>::headers libpng::headers C/C++ header files only
<PACKAGE-NAME>::lib*.a libpng::libpng16.a static library
<PACKAGE-NAME>::lib*.so libpng::libpng16.so shared library
<PACKAGE-NAME>::* libpng::libpng base on .pc files

Following is a piece of codes show you how to link libpng.a which is provided by libpng package:

find_package(libpng REQUIRED CONFIG)
target_link_libraries(app libpng::libpng.a)

or

find_package(libpng CONFIG)
if (libpng_FOUND)
    target_link_libraries(app libpng::libpng.a)
endif()

step5. configure C++ standard and STL in build.gradle

android {
    defaultConfig {
        externalNativeBuild {
            cmake {
                arguments '-DANDROID_STL=c++_shared'
                cppFlags  '-std=c++17'
            }
        }
    }
}

Note:

  • This step is only required for packages that use libc++.
  • If you link a shared library that depends on libc++_shared.so, then your Android app should use libc++_shared.so too.

References:

Examples:

Create the google prefab aar then deploy it to Maven Local Repository and use it alongside with Android Gradle Plugin

If my published packages don't meet your needs, you can use this software to install packages then deploy them to Maven Local Repository.

In the next two sections, I will show you how to configure with Android Gradle Plugin in Kotlin DSL and Groovy DSL respectively.

configure with Android Gradle Plugin Kotlin DSL

step1. build and install libpng

Suppose you want to build and install libpng, the following command will build libpng with android-34 API and build for arm64-v8a and armeabi-v7a ABI respectively.

ndk-pkg install android-34-arm64-v8a,armeabi-v7a/libpng

step2. export the installed libpng package as the google prefab aar and deploy it to your Maven Local Repository

ndk-pkg deploy  android-34-arm64-v8a,armeabi-v7a/libpng

step3. enable prefab feature for Android Gradle Plugin

android {
    buildFeatures {
        prefab = true
    }
}

step4. enable Maven Local Repository for Gradle

allprojects {
    repositories {
        maven {
            mavenLocal()
        }
    }
}

step5. add dependencies in build.gradle.kts

Every package's coordinate for Gradle is com.fpliu.ndk.pkg.prefab.android.21:<PACKAGE-NAME>:<PACKAGE-VERSION>, for example, libpng package has a version 1.6.37, we could use it as follows:

dependencies {
    implementation ("com.fpliu.ndk.pkg.prefab.android.21:libpng:1.6.37")
}

step6. invoke find_package(PACKAGE-NAME [REQUIRED] CONFIG) command in your Android project's CMakeLists.txt

Every package provides several cmake imported targets:

TARGET-NAME example summary
<PACKAGE-NAME>::headers libpng::headers C/C++ header files only
<PACKAGE-NAME>::lib*.a libpng::libpng16.a static library
<PACKAGE-NAME>::lib*.so libpng::libpng16.so shared library
<PACKAGE-NAME>::* libpng::libpng base on .pc files

Following is a piece of codes show you how to link libpng.a which is provided by libpng package:

find_package(libpng REQUIRED CONFIG)
target_link_libraries(app libpng::libpng.a)

or

find_package(libpng CONFIG)
if (libpng_FOUND)
    target_link_libraries(app libpng::libpng.a)
endif()

step7. configure C++ standard and STL in build.gradle.kts

android {
    defaultConfig {
        externalNativeBuild {
            cmake {
                arguments += "-DANDROID_STL=c++_shared"
                cppFlags  += "-std=c++17"
            }
        }
    }
}

Note:

  • This step is only required for packages that use libc++.
  • If you link a shared library that depends on libc++_shared.so, then your Android app should use libc++_shared.so too.

configure with Android Gradle Plugin Groovy DSL

step1. build and install libpng

Suppose you want to build and install libpng, the following command will build libpng with android-34 API and build for arm64-v8a and armeabi-v7a ABI respectively.

ndk-pkg install android-34-arm64-v8a,armeabi-v7a/libpng

step2. export the installed libpng package as the google prefab aar and deploy it to your Maven Local Repository

ndk-pkg deploy  android-34-arm64-v8a,armeabi-v7a/libpng

step3. enable prefab feature for Android Gradle Plugin

android {
    buildFeatures {
        prefab true
    }
}

step4. enable Maven Local Repository for Gradle

allprojects {
    repositories {
        maven {
            mavenLocal()
        }
    }
}

step5. add dependencies in build.gradle

Every package's coordinate for Gradle is com.fpliu.ndk.pkg.prefab.android.21:<PACKAGE-NAME>:<PACKAGE-VERSION>, for example, libpng package has a version 1.6.37, we could use it as follows:

dependencies {
    implementation 'com.fpliu.ndk.pkg.prefab.android.21:libpng:1.6.37'
}

step6. invoke find_package(PACKAGE-NAME [REQUIRED] CONFIG) command in your Android project's CMakeLists.txt

Every package provides several cmake imported targets:

TARGET-NAME example summary
<PACKAGE-NAME>::headers libpng::headers C/C++ header files only
<PACKAGE-NAME>::lib*.a libpng::libpng16.a static library
<PACKAGE-NAME>::lib*.so libpng::libpng16.so shared library
<PACKAGE-NAME>::* libpng::libpng base on .pc files

Following is a piece of codes show you how to link libpng.a which is provided by libpng package:

find_package(libpng REQUIRED CONFIG)
target_link_libraries(app libpng::libpng.a)

or

find_package(libpng CONFIG)
if (libpng_FOUND)
    target_link_libraries(app libpng::libpng.a)
endif()

step7. configure C++ standard and STL in build.gradle

android {
    defaultConfig {
        externalNativeBuild {
            cmake {
                arguments '-DANDROID_STL=c++_shared'
                cppFlags  '-std=c++17'
            }
        }
    }
}

Note:

  • This step is only required for packages that use libc++.
  • If you link a shared library that depends on libc++_shared.so, then your Android app should use libc++_shared.so too.

References:

Examples:

ndk-pkg's People

Contributors

leleliu008 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ndk-pkg's Issues

single abseil static library

ndk-pkg abseil produces large number of static libraries (*.a files). Is there some way to produce a single combined library, e.g. libabsl.a?

How to generate debug symbols for release builds?

Hi,

Thank you so much for the wonderful project, everything works really fine on my case. I was wondering if there is any input arguments that enables the debug symbols generating? For interpreting the crashing stack traces?

Thank you

Trying to build htop: `ld: error: undefined symbol: backtrace`

/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang -Wall -Wcast-align -Wcast-qual -Wextra -Wfloat-equal -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wpointer-arith -Wshadow -Wstrict-prototypes -Wundef -Wunused -Wwrite-strings -Wextra-semi-stmt -Wimplicit-int-conversion -Wnull-dereference -pedantic -std=c99 -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR="\"/home/benpro/.ndk-pkg/install.d/android/21/htop/armeabi-v7a/etc\"" -I"/home/benpro/.ndk-pkg/installing.d/android/21/htop/src/linux" -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 --sysroot /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Qunused-arguments -fPIC -Wl,--as-needed -Wl,--strip-debug -Os -DNDEBUG -rdynamic  -L/home/benpro/.ndk-pkg/installing.d/android/21/htop/armeabi-v7a/lib -L/home/benpro/.ndk-pkg/installing.d/android/21/htop -L/home/benpro/.ndk-pkg/install.d/android/21/ncurses/armeabi-v7a/lib -L/home/benpro/.ndk-pkg/install.d/android/21/libstrchrnul/armeabi-v7a/lib -L/home/benpro/.ndk-pkg/install.d/android/21/liblanginfo/armeabi-v7a/lib --sysroot /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot -L/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/21 -Wl,--as-needed -Wl,--strip-debug -l:libstrchrnul.a -l:liblanginfo.a -o htop htop.o   Action.o Affinity.o AffinityPanel.o AvailableColumnsPanel.o AvailableMetersPanel.o BatteryMeter.o CategoriesPanel.o ClockMeter.o ColorsPanel.o ColumnsPanel.o CommandLine.o CommandScreen.o Compat.o CPUMeter.o CRT.o DateMeter.o DateTimeMeter.o DiskIOMeter.o DisplayOptionsPanel.o DynamicColumn.o DynamicMeter.o EnvScreen.o FunctionBar.o Hashtable.o Header.o HeaderOptionsPanel.o HostnameMeter.o IncSet.o InfoScreen.o ListItem.o LoadAverageMeter.o MainPanel.o MemoryMeter.o MemorySwapMeter.o Meter.o MetersPanel.o NetworkIOMeter.o Object.o OpenFilesScreen.o OptionItem.o Panel.o Process.o ProcessList.o ProcessLocksScreen.o RichString.o ScreenManager.o ScreensPanel.o Settings.o SignalsPanel.o SwapMeter.o SysArchMeter.o TasksMeter.o TraceScreen.o UptimeMeter.o UsersTable.o Vector.o XUtils.o generic/gettime.o generic/hostname.o generic/uname.o linux/CGroupUtils.o linux/HugePageMeter.o linux/IOPriorityPanel.o linux/LibSensors.o linux/LinuxProcess.o linux/LinuxProcessList.o linux/Platform.o linux/PressureStallMeter.o linux/SELinuxMeter.o linux/SystemdMeter.o linux/ZramMeter.o zfs/ZfsArcMeter.o zfs/ZfsCompressedArcMeter.o   -lncursesw -lm /home/benpro/.ndk-pkg/install.d/android/21/ncurses/armeabi-v7a/lib/libncursesw.a 
ld: error: undefined symbol: backtrace
>>> referenced by CRT.c
>>>               CRT.o:(CRT_handleSIGSEGV)

ld: error: undefined symbol: backtrace_symbols_fd
>>> referenced by CRT.c
>>>               CRT.o:(CRT_handleSIGSEGV)
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Makefile:1341: htop] Error 1
make[1]: Leaving directory '/home/benpro/.ndk-pkg/installing.d/android/21/htop/armeabi-v7a/build'
make: *** [Makefile:1065: all] Error 2
make: Leaving directory '/home/benpro/.ndk-pkg/installing.d/android/21/htop/armeabi-v7a/build'
💔  target [htop/armeabi-v7a] install failed! you can go to directory[/home/benpro/.ndk-pkg/installing.d/android/21/htop] to look at the details.

I am not familiar with compiling, any idea of what could be the issue?

configure: error: Namespace support is required to build ICU.

checking for namespace support... no
configure: error: Namespace support is required to build ICU.
/root/.ndk-pkg/installing.d/android/21/icu4c/src/source/runConfigureICU: ./configure failed
💔  package [icu4c] install failed! you can go to directory[/root/.ndk-pkg/installing.d/android/21/icu4c] to look at the details.

sudo docker exec -it ndk-pkg ndk-pkg install boost failed

sudo docker exec -it ndk-pkg ndk-pkg install boost
I am trying to install boost for android, the error as follows

Compiling '/root/.ndk-pkg/native/python/lib/python3.10/xml/dom/pulldom.py'...
PYTHONPATH=/root/.ndk-pkg/native/python/lib/python3.10  \
	./python -E -Wi /root/.ndk-pkg/native/python/lib/python3.10/compileall.py \
	-j0 -d /root/.ndk-pkg/native/python/lib/python3.10/site-packages -f \
	-x badsyntax /root/.ndk-pkg/native/python/lib/python3.10/site-packages
Listing '/root/.ndk-pkg/native/python/lib/python3.10/site-packages'...
PYTHONPATH=/root/.ndk-pkg/native/python/lib/python3.10  \
	./python -E -Wi -O /root/.ndk-pkg/native/python/lib/python3.10/compileall.py \
	-j0 -d /root/.ndk-pkg/native/python/lib/python3.10/site-packages -f \
	-x badsyntax /root/.ndk-pkg/native/python/lib/python3.10/site-packages
Listing '/root/.ndk-pkg/native/python/lib/python3.10/site-packages'...
PYTHONPATH=/root/.ndk-pkg/native/python/lib/python3.10  \
	./python -E -Wi -OO /root/.ndk-pkg/native/python/lib/python3.10/compileall.py \
	-j0 -d /root/.ndk-pkg/native/python/lib/python3.10/site-packages -f \
	-x badsyntax /root/.ndk-pkg/native/python/lib/python3.10/site-packages
Listing '/root/.ndk-pkg/native/python/lib/python3.10/site-packages'...
PYTHONPATH=/root/.ndk-pkg/native/python/lib/python3.10  \
	./python -E -m lib2to3.pgen2.driver /root/.ndk-pkg/native/python/lib/python3.10/lib2to3/Grammar.txt
Generating grammar tables from /root/.ndk-pkg/native/python/lib/python3.10/lib2to3/Grammar.txt
Writing grammar tables to /root/.ndk-pkg/native/python/lib/python3.10/lib2to3/Grammar3.10.2.final.0.pickle
PYTHONPATH=/root/.ndk-pkg/native/python/lib/python3.10  \
	./python -E -m lib2to3.pgen2.driver /root/.ndk-pkg/native/python/lib/python3.10/lib2to3/PatternGrammar.txt
Generating grammar tables from /root/.ndk-pkg/native/python/lib/python3.10/lib2to3/PatternGrammar.txt
Writing grammar tables to /root/.ndk-pkg/native/python/lib/python3.10/lib2to3/PatternGrammar3.10.2.final.0.pickle
if test "xupgrade" != "xno"  ; then \
	case upgrade in \
		upgrade) ensurepip="--upgrade" ;; \
		install|*) ensurepip="" ;; \
	esac; \
	 ./python -E -m ensurepip \
		$ensurepip --root=/ ; \
fi
Traceback (most recent call last):
  File "<frozen zipimport>", line 570, in _get_decompress_func
ModuleNotFoundError: No module named 'zlib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen zipimport>", line 618, in _get_data
  File "<frozen zipimport>", line 573, in _get_decompress_func
zipimport.ZipImportError: can't decompress data; zlib not available

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 6, in <module>
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/runpy.py", line 205, in run_module
    mod_name, mod_spec, code = _get_module_details(mod_name)
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/runpy.py", line 146, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "<frozen zipimport>", line 196, in get_code
  File "<frozen zipimport>", line 752, in _get_module_code
  File "<frozen zipimport>", line 620, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
Traceback (most recent call last):
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/ensurepip/__init__.py", line 277, in _main
    return _bootstrap(
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/ensurepip/__init__.py", line 193, in _bootstrap
    return _run_pip([*args, *_PACKAGE_NAMES], additional_paths)
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/ensurepip/__init__.py", line 93, in _run_pip
    return subprocess.run([sys.executable, '-W', 'ignore::DeprecationWarning',
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/root/.ndk-pkg/installing.d/android/21/python/native/python', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmpruwokobx/setuptools-58.1.0-py3-none-any.whl\', \'/tmp/tmpruwokobx/pip-21.2.4-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmpruwokobx\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
gmake: *** [Makefile:1280: install] Error 1
gmake: Leaving directory '/root/.ndk-pkg/installing.d/android/21/python/native'
💔  package [python] install failed! you can go to directory[/root/.ndk-pkg/installing.d/android/21/python] to look at the details.

seems there is no zlib in the container ?

-j | --jobs no longer work like before

Hello,
I noticed that in the recent version (since the last 2 weeks), I can no longer use these:

-j="$(($(nproc)+1))"
--jobs="$(($(nproc)+1))"

Previously they used to work, now only this works:

-j "$(($(nproc)+1))"

Was this an unintentional regression or a deliberate choice to have only one way to specify max number of jobs?

Need Some Help with building boost

I trying building boost with NDK But I got errors.

My command ./ndk-pkg install boost --ndk-home=/home/amr/Android/Sdk/ndk/20.1.5948944/ I use Linux.

I got this error message =>> STEP 42 : adjust ELF files for android-21/arm64-v8a/libiconv 💔 invalid ELF file: /home/amr/.ndk-pkg/installed/android-21/arm64-v8a/libiconv/bin/iconv. Android 5.0 and later requires dynamically linked executable to support PIE (position-independent executables). 💔 package installation failure: android-21/arm64-v8a/libiconv

Thanks for all good work.

Amr

Don't use a 5000 line Shell Script

I like the idea of this project but i gave up after seeing that it is a giant shell script.
The fixable mistakes are:

  • Rewrite it in a good script language, i would prefer ruby.
    One day when it gets widely used you will need a real programming language for better error handling.

  • Break it down into readable files.

You will never get a supporting group until you change this because i wouldn't trust a minute of using it.
Spend time to read the readme and writing this already.

Installing gnutls

Hello,
I'm trying to install gnutls. So i run this command:
./ndk-pkg install gnutls --ndk-home=/some/path/to/ndk/android-ndk-r25c
and I get error :

=>> STEP 2 : load formula 
supported min sdk api level: 24
requested min sdk api level: 21
💔  package installation failure: 'android-21/arm64-v8a/gnutls'
    supported min sdk api level: 24
    requested min sdk api level: 21
💔  package installation failure: android-21/arm64-v8a/gnutls

and when I try to install it with this command:
./ndk-pkg install gnutls --ndk-home=/some/path/to/ndk/android-ndk-r25c --api=24
I get error :
💔 unrecognized option: --api=android-24
P.S.: My os is ubuntu 23.04

install glib failed

[✔] gettext have been installed successfully.
=============== Installing glib ===============

=>> STEP 1 : load formula

=>> STEP 2 : handle required commands
Found 1 package manager : apt
🔥 meson command is required, but it is not found, I will install it via apt
==> apt -y install meson

---- meson is installed already
install.log.txt
meson-log.txt

==> install -d /tmp/tmp.yXR5km2Bwm/1633338570/armeabi-v7a
==> cd /tmp/tmp.yXR5km2Bwm/1633338570/armeabi-v7a
==> /usr/bin/meson setup --prefix=/root/.ndk-pkg/install.d/glib/armeabi-v7a --buildtype=release --backend=ninja --pkg-config-path=/root/.ndk-pkg/install.d/zlib/armeabi-v7a/lib/pkgconfig:/root/.ndk-pkg/install.d/bzip2/armeabi-v7a/lib/pkgconfig:/root/.ndk-pkg/install.d/pcre/armeabi-v7a/lib/pkgconfig:/root/.ndk-pkg/install.d/libffi/armeabi-v7a/lib/pkgconfig:/root/.ndk-pkg/install.d/libiconv/armeabi-v7a/lib/pkgconfig:/root/.ndk-pkg/install.d/ncurses/armeabi-v7a/lib/pkgconfig:/root/.ndk-pkg/install.d/gettext/armeabi-v7a/lib/pkgconfig --build.pkg-config-path= --cross-file=/tmp/tmp.yXR5km2Bwm/1633338570/armeabi-v7a/cross-file -Dnls=disabled -Dman=false -Dgtk_doc=false -Diconv=external -Ddtrace=false -Dinternal_pcre=false -Dinstalled_tests=false -Dbsymbolic_functions=false /tmp/tmp.yXR5km2Bwm/1633338570/armeabi-v7a /tmp/tmp.yXR5km2Bwm
The Meson build system
Version: 0.53.2
Source dir: /tmp/tmp.yXR5km2Bwm
Build dir: /tmp/tmp.yXR5km2Bwm/1633338570/armeabi-v7a
Build type: cross build
Project name: glib
Project version: 2.66.0
Appending CFLAGS from environment: '--sysroot /home/liuhao/Desktop/tools/android-ndk-r21e/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Qunused-arguments -Os -fpic'
Appending LDFLAGS from environment: ['-L/root/.ndk-pkg/install.d/gettext/armeabi-v7a/lib', '-L/root/.ndk-pkg/install.d/ncurses/armeabi-v7a/lib', '-L/root/.ndk-pkg/install.d/libiconv/armeabi-v7a/lib', '-L/root/.ndk-pkg/install.d/libffi/armeabi-v7a/lib', '-L/root/.ndk-pkg/install.d/pcre/armeabi-v7a/lib', '-L/root/.ndk-pkg/install.d/bzip2/armeabi-v7a/lib', '-L/root/.ndk-pkg/install.d/zlib/armeabi-v7a/lib', '--sysroot', '/home/liuhao/Desktop/tools/android-ndk-r21e/toolchains/llvm/prebuilt/linux-x86_64/sysroot', '-L/home/liuhao/Desktop/tools/android-ndk-r21e/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/27', '-lpcre', '-liconv', '-lm', '-lz']
Appending CPPFLAGS from environment: '-I/root/.ndk-pkg/install.d/gettext/armeabi-v7a/include -I/root/.ndk-pkg/install.d/ncurses/armeabi-v7a/include -I/root/.ndk-pkg/install.d/libiconv/armeabi-v7a/include -I/root/.ndk-pkg/install.d/libffi/armeabi-v7a/include -I/root/.ndk-pkg/install.d/pcre/armeabi-v7a/include -I/root/.ndk-pkg/install.d/bzip2/armeabi-v7a/include -I/root/.ndk-pkg/install.d/zlib/armeabi-v7a/include --sysroot /home/liuhao/Desktop/tools/android-ndk-r21e/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Qunused-arguments -I/home/liuhao/Desktop/tools/android-ndk-r21e/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/arm-linux-androideabi -include /root/.ndk-pkg/include.h'

meson.build:1:0: ERROR: Could not invoke sanity test executable: [Errno 8] Exec format error: '/tmp/tmp.yXR5km2Bwm/1633338570/armeabi-v7a/meson-private/sanitycheckc.exe'.

A full log can be found at /tmp/tmp.yXR5km2Bwm/1633338570/armeabi-v7a/meson-logs/meson-log.txt
[✘] install glib/armeabi-v7a failed! you can go to /tmp/tmp.yXR5km2Bwm to see see.

编译静态库

目前静态库的编译方式不太清楚,能否增加参数解决?

install libimobiledevice failure on Mac

step:
ndk-pkg update
ndk-pkg install libimobiledevice

✅️ android-21-arm64-v8a/libplist was successfully installed.

Installation android-21-arm64-v8a/libimobiledevice-glue start
=>> STEP 1 : load formula
💔 ndk-pkg: package installation failure: 'android-21-arm64-v8a/libimobiledevice-glue'
supported min sdk api level: 24
requested min sdk api level: 21
💔 ndk-pkg: package installation failure: android-21-arm64-v8a/libimobiledevice-glue

libimobiledevice.yml: api-min: 24

Attempting to install on Android using Termux

I have been trying to install packages on my android device using termux, but each package fails on step 3 because an android NDK cannot be found and one will not install. Is there a solution to this?

[QUESTIONS] Some Questions about maintenance, compilation, static linking & more

Hi, I recently came across your great repo. It's truly awesome.
I maintain a similar repo for compiling android binaries at: https://github.com/Azathothas/Toolpacks
Though, I dropped support for Android due to these reasons: https://github.com/Azathothas/Toolpacks/tree/main/Docs#why-not-many-android-binaries
After having seen this awesome project and the great formulas

❯ ndk-pkg ls-available | wc -l
712

That are already available for me to use, I wanted to ask some questions.


  • Maintenance/Future

It's great to see that the first commit was all the way on Jun 25, 2020
And since then this repo has received over a thousand commits and is very well maintained. Though, no one can predict the future, and assuming you still have time & passion for this project, will this project (& the related adjacent ones) be continued to be maintained/updated?


  • Compiling

As I stated, I maintain a repo at https://github.com/Azathothas/Toolpacks with the specific aim to compile binaries and make them readily available at: https://bin.ajam.dev

  • Do you already have something similar?
    There would be no point in me using your tool to compile & release binaries if you already release/publish them somewhere.
  • This is a snipped version of how I intend to use your tool to compile & extract only the binaries. Is there a better way, if I am only interested in the /bin?
!# Assuming I already installed/setup ndk-pkg in docker
##https://apilevels.com/
#android-34 --> Android 14
#android-33 --> Android 13
#android-31,32 --> Android 12
#android-30 --> Android 11
#android-29 --> Android 10
#android-28 --> Android 9
#android-26,27 --> Android 8
#android-24,25 --> Android 7
#android-23 --> Android 6
#android-21,22 --> Android 5
export TOOLPACKS_ANDROID_APILEVEL_DYNAMIC="android-29"
export TOOLPACKS_ANDROID_APILEVEL_STATIC="android-34"
export TOOLPACKS_ANDROID_ABI="arm64-v8a"
export TOOLPACKS_ANDROID_BUILD_DYNAMIC="${TOOLPACKS_ANDROID_APILEVEL_DYNAMIC}-${TOOLPACKS_ANDROID_ABI}"
export TOOLPACKS_ANDROID_BUILD_STATIC="${TOOLPACKS_ANDROID_APILEVEL_STATIC}-${TOOLPACKS_ANDROID_ABI}"

!# Build Curl
❯ docker exec -it "ndk-pkg" ndk-pkg install "${TOOLPACKS_ANDROID_BUILD_DYNAMIC}/curl" --profile="release" --jobs="$(($(nproc)+1))"

!# Get Install Dir
❯ TOOLPACKS_ANDROID_BUILDIR="$(docker exec -it "ndk-pkg" ndk-pkg tree "${TOOLPACKS_ANDROID_BUILD_DYNAMIC}/curl" --dirsfirst -L 1 | grep -o '/.*/.*' | tail -n1 | tr -d '[:space:]')" && export TOOLPACKS_ANDROID_BUILDIR="${TOOLPACKS_ANDROID_BUILDIR}"
❯ docker exec -it "ndk-pkg" ls "${TOOLPACKS_ANDROID_BUILDIR}/bin"
curl  curl-config

!#Copy 
❯ docker cp "ndk-pkg:/${TOOLPACKS_ANDROID_BUILDIR}/bin/." "./"
Successfully copied 5.15MB to /tmp/tmp.RhSYTZRvL6/./

!#Meta 
❯ file "./curl" && du -sh "./curl"
./curl: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, stripped
5.0M    ./curl

!#Cleanup
❯ docker exec -it "ndk-pkg" ndk-pkg uninstall "${TOOLPACKS_ANDROID_BUILD_DYNAMIC}/curl"
❯ docker exec -it "ndk-pkg" ndk-pkg cleanup
==> rm -ff /root/.ndk-pkg/installed/android-29-arm64-v8a/curl
==> rm -rf /root/.ndk-pkg/installed/android-29-arm64-v8a/b8179338859a8b8c7494ff61912bb44ce311c75ba576647558f835ee1956ba77
[✔] Done.

  • Static Linking

It's great to see that there's a simple switch to toggle fully static builds --fsle
But if the binary makes heavy use of network/dns, there are some known issues:

  • Does your script/tooling already accounts for these? If not, Should a warning/caution be written in the README.md?
  • What do you think of these?

  • Testing

Do you know of a way I could test these binaries by running them in a container/vm directly on the builder machine (it's GH Actions x86_64 Linux headless) ?


Once again, this is truly amazing work. Thank you so much for making this open source.
Once I have some time, I will probably contribute a lot to the https://github.com/leleliu008/ndk-pkg-formula-repository-official-core repo.

How to configure a package having all dependent libraries statically linked

For instance I've built tectonic (typesetting), but it's execution of android device gives me the error:

CANNOT LINK EXECUTABLE "/data/local/tmp/tectonic": library "libfontconfig.so" not found
Therefore I guess the easiest thing is to produce a fat executable "including" all dependencies.

Can you please point me to where or how I can accomplish that?

Many thanks in advance!

Tool fails to install NDK-tools on Macbook Air M1

Hello there, I've been trying to use your tool to build cpuinfo library for my project. Unfortunately, I am not able to do it, as the tool fails to install, even fails to find any available NDK tools for my laptop Here is the output when I try to install:

=============== Installing cpuinfo ===============

=>> STEP 1 : view formula 
───────┬────────────────────────────────────────────────────────────────────────
       │ File: /Users/lukas/.ndk-pkg/repos.d/offical/formula/cpuinfo.sh
───────┼────────────────────────────────────────────────────────────────────────
   1   │ package set summary "CPU INFOrmation library"
   2   │ package set git.url "https://github.com/pytorch/cpuinfo.git"
   3   │ package set bsystem "cmake"
   4   │ 
   5   │ build() {
   6   │     cmakew \
   7   │         -DCPUINFO_BUILD_UNIT_TESTS=OFF \
   8   │         -DCPUINFO_BUILD_MOCK_TESTS=OFF \
   9   │         -DCPUINFO_BUILD_BENCHMARKS=OFF
  10   │ }
───────┴────────────────────────────────────────────────────────────────────────

=>> STEP 2 : load formula 

=>> STEP 3 : find Android NDK 
🔔  Android NDK Not Found on your build machine, I will install it for you.
💔  ndk-pkg ndkmanager install <Reversion> , for example: ndk-pkg ndkmanager install r23b, you can get <Reversion> via run: ndk-pkg ndkmanager ls-available
💔  install cpuinfo failed!

Do you have any idea why?

I tried to reinstall ndk-pkg, upgrade it and rerun it again, but without success. Also, the autocomplete does not work, even when I follow the steps multiple times.
I have MacOS Monterey 12.1

Accelerate builds with make -j<num_cores>, ccache and quiet stdout.

Making use of make multi-processing -j switch/project specific JOBS=:

As it stands right now the builds are conducted with a single core/thread, which takes a lot of time.

General implementation help:

$(nproc --all) can be used on linux/unix-like platforms to find out the number of cores(threads) the system has;

Advantages:

  • Close to linear time, compile time gains per thread/core.

Disadvantages:

  • Increased ram and cpu usage.
  • Not sure if ones you have, but some libraries are very heavy and can take up couple gigabytes of ram when being linked/compiled with multiple jobs.
  • Decreased log readability(because things are compiled in a non linear fashion, make jobs can partially continue despite one of components failing)
    [That isn't to say that you will get an echo of an ongoing compilation and stderr printed out in an unreadable way. But a lot of users are used to this, make will still return an appropriate exit code].

Pitfalls:

  • Some libraries/binaries will fail to compile when using multiple make jobs.
    for example if headers are generated at runtime on a makefile this can make a multi job/multi processed make fail due to unregenerated header.
  • Some libraries/programs go around it, by having a JOBS/jobs variable within them:
    make jobs=<number of cores/threads> / make JOBS=<number of cores/threads> instead of make -j<number of cores/threads> , this way they complete some part of the job in a linear fashion, and then complete the rest of the cycle with multi-processing.

Time gains:

  • Depending on cpu and what user does in the background during the build, substantial compile time gains, close to (single core time*1/threads) when user leaves the computer be to compile.

Making use of ccache:

General implementation help:

ccache invocation:

  • ccache --config-path <configuration> <compiler/compiler_path> <compilation options>
  • The configuration file allows setting the size the cache will grow to.
  • The cache can be cleared with -C switch

Advantages:

  • Substantially decreases subsequent compilation time of building C files, and decreases time of building new versions of libraries.
  • Substantially increases speed of incremental builds (library updates).

Disadvantages:

  • Cache of ccache might be no longer valid when ndk updates or sysroot changes.
  • Can take a lot of space, user needs to be able to set.
  • ccache is essentially a wrapper for a C/C++ compiler, it creates a sort of database with hashes and resolves hash collisions, naturally this means it has some sort of overhead and user gets increased compile times on cache misses.
  • I would personally make it an optional flag.

Pitfalls:

  • Some projects might not accept ccache easily or recognize the compiler and apply gcc specific compiler flags to clang and vice versa.
  • I am not sure what happens when cache fills up, and whether it will remove files which don't get any/a lot of cache hits.

Time gains:

  • First time +1-5% compile time
  • -99% on cache hits.
  • Linking time might not be accelerated much.

Making use of quiet stdout:

Advantages:

  • Easy to implement, just move stdout/stderr to /dev/null

Disadvantages:

  • Makes reading build logs factually impossible.
  • By no means should it be the default option.
  • Unknown if there are any time improvements.

Time gains:

  • Unknown, it is often recommended for improved boot times to "quiet" the output when using the SSDs.
  • It might be worth adding as a switch, but I suspect time gained might not be substantial.

ndk-pkg install gnutls failed?

I follow this guide to install gnutls, but fail when install nettle. I can't solve

http://blog.fpliu.com/project/ndk-pkg/package?name=gnutls

Ubuntu 20.04
NDK android-ndk-r21e

errors:

=>> STEP 9 : build for native
🔥 no build0 function defined in formula, skipped.

=>> STEP 12 : calculate dependencies
🔥 graphviz is not installed. we do not generate png format dependency image.
┌────────┐
│ nettle │
└────────┘



┌────────┐
│ gmp │
└────────┘

[✘] install nettle/armeabi-v7a failed! you can go to /tmp/tmp.w4KPQ6KaXM to see see.

sudo docker exec -it ndk-pkg ndk-pkg install boost failed

sudo docker exec -it ndk-pkg ndk-pkg install boost
I am trying to install boost for android, the error as follows

Compiling '/root/.ndk-pkg/native/python/lib/python3.10/xml/dom/pulldom.py'...
PYTHONPATH=/root/.ndk-pkg/native/python/lib/python3.10  \
	./python -E -Wi /root/.ndk-pkg/native/python/lib/python3.10/compileall.py \
	-j0 -d /root/.ndk-pkg/native/python/lib/python3.10/site-packages -f \
	-x badsyntax /root/.ndk-pkg/native/python/lib/python3.10/site-packages
Listing '/root/.ndk-pkg/native/python/lib/python3.10/site-packages'...
PYTHONPATH=/root/.ndk-pkg/native/python/lib/python3.10  \
	./python -E -Wi -O /root/.ndk-pkg/native/python/lib/python3.10/compileall.py \
	-j0 -d /root/.ndk-pkg/native/python/lib/python3.10/site-packages -f \
	-x badsyntax /root/.ndk-pkg/native/python/lib/python3.10/site-packages
Listing '/root/.ndk-pkg/native/python/lib/python3.10/site-packages'...
PYTHONPATH=/root/.ndk-pkg/native/python/lib/python3.10  \
	./python -E -Wi -OO /root/.ndk-pkg/native/python/lib/python3.10/compileall.py \
	-j0 -d /root/.ndk-pkg/native/python/lib/python3.10/site-packages -f \
	-x badsyntax /root/.ndk-pkg/native/python/lib/python3.10/site-packages
Listing '/root/.ndk-pkg/native/python/lib/python3.10/site-packages'...
PYTHONPATH=/root/.ndk-pkg/native/python/lib/python3.10  \
	./python -E -m lib2to3.pgen2.driver /root/.ndk-pkg/native/python/lib/python3.10/lib2to3/Grammar.txt
Generating grammar tables from /root/.ndk-pkg/native/python/lib/python3.10/lib2to3/Grammar.txt
Writing grammar tables to /root/.ndk-pkg/native/python/lib/python3.10/lib2to3/Grammar3.10.2.final.0.pickle
PYTHONPATH=/root/.ndk-pkg/native/python/lib/python3.10  \
	./python -E -m lib2to3.pgen2.driver /root/.ndk-pkg/native/python/lib/python3.10/lib2to3/PatternGrammar.txt
Generating grammar tables from /root/.ndk-pkg/native/python/lib/python3.10/lib2to3/PatternGrammar.txt
Writing grammar tables to /root/.ndk-pkg/native/python/lib/python3.10/lib2to3/PatternGrammar3.10.2.final.0.pickle
if test "xupgrade" != "xno"  ; then \
	case upgrade in \
		upgrade) ensurepip="--upgrade" ;; \
		install|*) ensurepip="" ;; \
	esac; \
	 ./python -E -m ensurepip \
		$ensurepip --root=/ ; \
fi
Traceback (most recent call last):
  File "<frozen zipimport>", line 570, in _get_decompress_func
ModuleNotFoundError: No module named 'zlib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen zipimport>", line 618, in _get_data
  File "<frozen zipimport>", line 573, in _get_decompress_func
zipimport.ZipImportError: can't decompress data; zlib not available

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 6, in <module>
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/runpy.py", line 205, in run_module
    mod_name, mod_spec, code = _get_module_details(mod_name)
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/runpy.py", line 146, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "<frozen zipimport>", line 196, in get_code
  File "<frozen zipimport>", line 752, in _get_module_code
  File "<frozen zipimport>", line 620, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
Traceback (most recent call last):
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/ensurepip/__init__.py", line 277, in _main
    return _bootstrap(
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/ensurepip/__init__.py", line 193, in _bootstrap
    return _run_pip([*args, *_PACKAGE_NAMES], additional_paths)
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/ensurepip/__init__.py", line 93, in _run_pip
    return subprocess.run([sys.executable, '-W', 'ignore::DeprecationWarning',
  File "/root/.ndk-pkg/installing.d/android/21/python/src/Lib/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/root/.ndk-pkg/installing.d/android/21/python/native/python', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmpruwokobx/setuptools-58.1.0-py3-none-any.whl\', \'/tmp/tmpruwokobx/pip-21.2.4-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmpruwokobx\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
gmake: *** [Makefile:1280: install] Error 1
gmake: Leaving directory '/root/.ndk-pkg/installing.d/android/21/python/native'
💔  package [python] install failed! you can go to directory[/root/.ndk-pkg/installing.d/android/21/python] to look at the details.

seems there is no zlib in the container ?

[error]locate C/C++ toolchain for native build

myos:wsl1 ubuntu 22.04
i try to use ./ndk-pkg ndkinfo --ndk-home=/home/qi/.uppm/installed/android-ndk-r23c
but compile error
then i set ANDROID_NDK_ROOT
but compile error yet
./ndk-pkg install libpng has the same result

this is my log

qi@DESKTOP-874A9CA:~$ echo ${ANDROID_NDK_ROOT}
/home/qi/.uppm/installed/android-ndk-r23c
qi@DESKTOP-874A9CA:~$ ./ndk-pkg install libpng
=============== Installing android-21/arm64-v8a/zlib ===============

=>> STEP 1 : view formula
==> yq /home/qi/.ndk-pkg/run/17966/zlib.yml
summary: General-purpose lossless data-compression library
git-url: https://github.com/madler/zlib
web-url: https://zlib.net/
src-url: https://zlib.net/zlib-1.2.13.tar.gz
src-sha: b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30
license: Zlib
bsystem: cmake
dopatch: |
  sed_in_place 's|/share/pkgconfig|/lib/pkgconfig|' CMakeLists.txt &&
  sed_in_place 's|zlib)|zlibstatic)|' CMakeLists.txt
developers: |
  Jean-loup+Gailly|[email protected]
  Mark+Adler|[email protected]


=>> STEP 2 : load formula
supported min sdk api level: 21
requested min sdk api level: 21

     TIMESTAMP_UNIX = 1690106454

     NATIVE_OS_KIND = linux
     NATIVE_OS_TYPE = linux
     NATIVE_OS_CODE = ubuntu
     NATIVE_OS_NAME = Ubuntu
     NATIVE_OS_VERS = 22.04
     NATIVE_OS_ARCH = x86_64
     NATIVE_OS_NCPU = 2
     NATIVE_OS_LIBC = glibc
     NATIVE_OS_EUID = 1000
     NATIVE_OS_EGID = 1000

     TARGET_OS_VERS = 21
     TARGET_OS_ARCH = aarch64
     TARGET_OS_ABI  = arm64-v8a

NDKPKG_VERSION      = 0.3.2
NDKPKG_HOME         = /home/qi/.ndk-pkg
NDKPKG              = /home/qi/ndk-pkg
NDKPKG_URL_TRANSFORM=

          LOG_LEVEL = 1
          LINK_TYPE = static-prefered
         BUILD_TYPE = release
        BUILD_NJOBS = 2

             DRYRUN = no
     CCACHE_ENABLED = no
   KEEP_PACKING_DIR = no
EXPORT_COMPILE_COMMANDS_JSON = no


=>> STEP 3 : create and change to working directory
PACKAGE_WORKING_DIR = /home/qi/.ndk-pkg/run/17966/zlib
PACKAGE_BCACHED_DIR = /home/qi/.ndk-pkg/run/17966/zlib/src/_
PACKAGE_INSTALL_DIR = /home/qi/.ndk-pkg/installed/android-21/arm64-v8a/zlib
==> cd /home/qi/.ndk-pkg/run/17966/zlib

=>> STEP 4 : locate C/C++ toolchain for native build
💔  C Compiler for native not found.
💔  package installation failure: android-21/arm64-v8a/zlib

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.