There are some questions about this issue. But the answers are not helpful. I try to generate D8 for android. The v8 guide says that gyp is deprecated. My steps are here :
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH='pwd'/depot_tools:"$PATH"
Download ndk-r14b
fetch v8
cd v8
echo "target_os = ['android']" >> ../.gclient && gclient sync --nohooks
tools/dev/v8gen.py arm.release
gn gen out.gn/arm.release --args='android_ndk_root="/path/android-ndk-r14b" android_ndk_version="r14" v8_static_library=true android_sdk_root="/path/android-sdk-r25" target_os = "android" target_cpu = "arm" v8_target_cpu = "arm" is_component_build = false'
ninja -C out.gn/arm.release d8
Compilation throws some errors.
In file included from ../../third_party/icu/source/common/unicode/unistr.h:33:0,
from ../../third_party/icu/source/common/unicode/locid.h:36,
from ../../third_party/icu/source/i18n/unicode/dcfmtsym.h:36,
from ../../third_party/icu/source/i18n/unicode/decimfmt.h:38,
from ../../third_party/icu/source/i18n/digitlst.h:32,
from ../../third_party/icu/source/i18n/visibledigits.cpp:18:
../../third_party/icu/source/common/unicode/std_string.h:35:18: fatal error: string: No such file or directory
#include <string>
^
compilation terminated.
[6/939] CC obj/third_party/icu/icui18n/utmscale.o
ninja: build stopped: subcommand failed.
How can I fix?
You forgot
android_ndk_major_version=14
Related
I'm trying to build my own SDK add-on from scratch, and attempt to comply with the sample in device/sample. Complying to the instructions in README.txt, I got following failure while building:
[100% 1/1] analyzing Android.bp files and generating ninja file at out/soong/build.ninja
FAILED: out/soong/build.ninja
cd "$(dirname "out/host/linux-x86/bin/soong_build")" && BUILDER="$PWD/$(basename "out/host/linux-x86/bin/soong_build")" && cd / && env -i "$BUILDER" --top "$TOP" --soong_o
ut "out/soong" --out "out" -o out/soong/build.ninja --globListDir build --globFile out/soong/globs-build.ninja -t -l out/.module_paths/Android.bp.list --available_env out/s
oong/soong.environment.available --used_env out/soong/soong.environment.used.build Android.bp
error: prebuilts/module_sdk/conscrypt/current/Android.bp:20:1: dependency "art-bootclasspath-fragment" of "conscrypt-module-sdk_com.android.conscrypt-bootclasspath-fragment#current
" missing variant:
apex:com.android.art
available variants:
os:android,arch:common
error: prebuilts/module_sdk/conscrypt/current/Android.bp:20:1: dependency "prebuilt_art-bootclasspath-fragment" of "conscrypt-module-sdk_com.android.conscrypt-bootclasspath-fragmen
t#current" missing variant:
apex:com.android.art
available variants:
os:android,arch:common
10:34:20 soong bootstrap failed with: exit status 1
Does anyone encounter the same issue? It would be appriciated if there's any workaround on this. Thanks.
Edit build/make/target/product/sdk_phone_x86_64.mk (or your device target file) and add following line at the end:
MODULE_BUILD_FROM_SOURCE := true
For me, that solved the error and the build now starts.
You can view my product repository (you can drop it in your source tree and use lunch aosp_sdk_phone_x86_64-eng) to have this change as well:
https://git.halogenos.org/halogenOS/android_product_halogenOS/
I am trying to compile a rust project into an Android target (aarch64-linux-android).
From the comments in the lmdb code, it seems to need to run the compilation
"aarch64-linux-android-gcc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-Wall" "-Wextra" "-o" "/Users/username/grin-wallet/target/aarch64-linux-android/release/build/liblmdb-sys-7a2d430dc3c9f3e3/out/mdb/libraries/liblmdb/mdb.o" "-c" "mdb/libraries/liblmdb/mdb.c"
with an additional -DMDB_USE_ROBUST=0 flag. Is this configurable from either the cargo build command or adding something to Cargo.toml?
The error I am getting is:
error: failed to run custom build command for `liblmdb-sys v0.2.2`
Caused by:
process didn't exit successfully: `/Users/username/grin-wallet/target/release/build/liblmdb-sys-b6bfc7b665736f9b/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("aarch64-linux-android")
TARGET = Some("aarch64-linux-android")
HOST = Some("x86_64-apple-darwin")
TARGET = Some("aarch64-linux-android")
TARGET = Some("aarch64-linux-android")
HOST = Some("x86_64-apple-darwin")
CC_aarch64-linux-android = None
CC_aarch64_linux_android = None
TARGET_CC = None
CC = None
TARGET = Some("aarch64-linux-android")
HOST = Some("x86_64-apple-darwin")
CFLAGS_aarch64-linux-android = None
CFLAGS_aarch64_linux_android = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
running: "aarch64-linux-android-gcc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-Wall" "-Wextra" "-o" "/Users/username/grin-wallet/target/aarch64-linux-android/release/build/liblmdb-sys-7a2d430dc3c9f3e3/out/mdb/libraries/liblmdb/mdb.o" "-c" "mdb/libraries/liblmdb/mdb.c"
cargo:warning=mdb/libraries/liblmdb/mdb.c:4625:13: warning: implicit declaration of function 'pthread_mutexattr_setrobust' is invalid in C99 [-Wimplicit-function-declaration]
cargo:warning= || (rc = pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST))
cargo:warning= ^
cargo:warning=mdb/libraries/liblmdb/mdb.c:4625:49: error: use of undeclared identifier 'PTHREAD_MUTEX_ROBUST'
cargo:warning= || (rc = pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST))
cargo:warning= ^
cargo:warning=mdb/libraries/liblmdb/mdb.c:9821:33: warning: unused parameter 'env' [-Wunused-parameter]
cargo:warning=mdb_env_get_maxkeysize(MDB_env *env)
cargo:warning= ^
cargo:warning=mdb/libraries/liblmdb/mdb.c:10002:10: warning: implicit declaration of function 'pthread_mutex_consistent' is invalid in C99 [-Wimplicit-function-declaration]
cargo:warning= rc2 = mdb_mutex_consistent(mutex);
cargo:warning= ^
cargo:warning=mdb/libraries/liblmdb/mdb.c:351:37: note: expanded from macro 'mdb_mutex_consistent'
cargo:warning=#define mdb_mutex_consistent(mutex) pthread_mutex_consistent(mutex)
cargo:warning= ^
cargo:warning=3 warnings and 1 error generated.
exit code: 1
First, make sure you have all the android build targets installed:
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android
Then install cargo-ndk
cargo install cargo-ndk
Now you need to export a number of variables in the terminal that will be used by the build.
If you are using pkg-config then
export PKG_CONFIG_ALLOW_CROSS=1
The root directory of the NDK
export NDK_HOME=the_path_to_the_ndk
The platform version
export NDK_API_LEVEL=the_api_level
Note that the compilers must be specified as clang for newer versions of the NDK since GCC was deprecated in the android toolchain and is no longer present (some projects try to reference GCC by default)
export CC=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android$NDK_API_LEVEL-clang
export CXX=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android$NDK_API_LEVEL-clang++
Then the rest of the variables
export AR=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ar
export AS=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-as
export LD=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ld
export RANLIB=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ranlib
export STRIP=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-strip
You were on the right track in thinking -DMDB_USE_ROBUST=0, it just needed to be passed to the compiler flags
export CFLAGS=-DMDB_USE_ROBUST=0
Then in your rust project, you will need to create a .config directory in the same directory as your .toml file. Within the .config directory, you will need to create a config file.
In the config file you will need to specify the relevant build targets for each target you need built (replace NDK_HOME and NDK_API_LEVEL with their respective values)
[target.aarch64-linux-android]
ar = "<NDK_HOME>/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ar"
linker = "<NDK_HOME>/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android<NDK_API_LEVEL>-clang"
You should then be able to build successfully with
cargo ndk --target aarch64-linux-android --android-platform $NDK_API_LEVEL -- build --release
You can't just build and targeting to linex-android, another way to do this is develop your app via Android Studio or with Flutter
I want to build tensorflow for my android smartphone. So I´ve installed bazel and get the sources for tensorflow.
git clone https://github.com/tensorflow/tensorflow
I modify the WORKSPACE file with my paths for the NDK and the SDK
android_sdk_repository(
name = "androidsdk",
api_level = 27,
build_tools_version = "27.0.3",
# Replace with path to Android SDK on your system
path = ".../AppData/Local/Android/Sdk",
)
android_ndk_repository(
name = "androidndk",
path = .../AppData/Local/Android/Sdk/ndk-bundle",
api_level = 27
)
And now I run bazel
bazel build -c opt //tensorflow/contrib/android:libtensorflow_inference.so \
--crosstool_top=//external:android/crosstool \
--host_crosstool_top=#bazel_tools//tools/cpp:toolchain \
--cpu=armeabi-v7a
And got this error
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Target //tensorflow/contrib/android:libtensorflow_inference.so failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 72,096s, Critical Path: 14,55s
INFO: 213 processes, local.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully
How can I compile tensorflow for android with windows (or maybe ubuntu)?
I'm trying to compile CyanogenMod from scratch with the help of this guide. I've done most of the steps without any errors, but at the brunch angler step, I keep getting this error:
Building with Jack: /home/hexafluoride/android/system/out/target/common/obj/JAVA_LIBRARIES/android-support-v13-ics-mr1_intermediates/classes.jack
host Executable: llvm-rs-cc (/home/hexafluoride/android/system/out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/llvm-rs-cc)
Building with Jack: /home/hexafluoride/android/system/out/target/common/obj/JAVA_LIBRARIES/com.android.gallery3d.common2_intermediates/classes.jack
target Symbolic: libssl (/home/hexafluoride/android/system/out/target/product/angler/symbols/system/lib64/libssl.so)
target StaticLib: libLLVMAArch64CodeGen (/home/hexafluoride/android/system/out/target/product/angler/obj/STATIC_LIBRARIES/libLLVMAArch64CodeGen_intermediates/libLLVMAArch64CodeGen.a)
Launching background server java -Dfile.encoding=UTF-8 -Xms2560m -XX:+TieredCompilation -jar /home/hexafluoride/android/system/out/host/linux-x86/framework/jack-launcher.jar -cp /home/hexafluoride/android/system/out/host/linux-x86/framework/jack.jar com.android.jack.server.JackSimpleServer
target StaticLib: libLLVMAArch64Info (/home/hexafluoride/android/system/out/target/product/angler/obj/STATIC_LIBRARIES/libLLVMAArch64Info_intermediates/libLLVMAArch64Info.a)
Launching background server java -Dfile.encoding=UTF-8 -Xms2560m -XX:+TieredCompilation -jar /home/hexafluoride/android/system/out/host/linux-x86/framework/jack-launcher.jar -cp /home/hexafluoride/android/system/out/host/linux-x86/framework/jack.jar com.android.jack.server.JackSimpleServer
target StaticLib: libLLVMAArch64Desc (/home/hexafluoride/android/system/out/target/product/angler/obj/STATIC_LIBRARIES/libLLVMAArch64Desc_intermediates/libLLVMAArch64Desc.a)
target StaticLib: libLLVMAArch64AsmParser (/home/hexafluoride/android/system/out/target/product/angler/obj/STATIC_LIBRARIES/libLLVMAArch64AsmParser_intermediates/libLLVMAArch64AsmParser.a)
target StaticLib: libLLVMAArch64AsmPrinter (/home/hexafluoride/android/system/out/target/product/angler/obj/STATIC_LIBRARIES/libLLVMAArch64AsmPrinter_intermediates/libLLVMAArch64AsmPrinter.a)
ERROR: /home/hexafluoride/android/system/packages/apps/Gallery2/gallerycommon/src/com/android/gallery3d/exif/ExifData.java:1: The type java.lang.Object cannot be found in source files, imported jack libs or the classpath
ERROR: /home/hexafluoride/android/system/packages/apps/Gallery2/gallerycommon/src/com/android/gallery3d/exif/ExifData.java:19: The import android cannot be resolved
* lots of errors saying that basic types can't be resolved after this *
And then make fails. I've tried doing make showcommands, and this is the output:
if [ -s /home/hexafluoride/android/system/out/target/common/obj/JAVA_LIBRARIES/android-support-v4-jellybean_intermediates/jack-rsc/java-source-list-uniq ] ; then export tmpEcjArg="#/home/hexafluoride/android/system/out/target/common/obj/JAVA_LIBRARIES/android-support-v4-jellybean_intermediates/jack-rsc/java-source-list-uniq"; else export tmpEcjArg=""; fi; JACK_VM_COMMAND="java -Dfile.encoding=UTF-8 -Xms2560m -XX:+TieredCompilation -jar /home/hexafluoride/android/system/out/host/linux-x86/framework/jack-launcher.jar " JACK_JAR="/home/hexafluoride/android/system/out/host/linux-x86/framework/jack.jar" /home/hexafluoride/android/system/out/host/linux-x86/bin/jack #build/core/jack-default.args --verbose error -g --classpath /home/hexafluoride/android/system/out/target/common/obj/JAVA_LIBRARIES/sdk_v16_intermediates/classes.jack:/home/hexafluoride/android/system/out/target/common/obj/JAVA_LIBRARIES/sdk_v16_intermediates/classes.jack:/home/hexafluoride/android/system/out/target/common/obj/JAVA_LIBRARIES/android-support-v4-ics-mr1_intermediates/classes.jack --import /home/hexafluoride/android/system/out/target/common/obj/JAVA_LIBRARIES/android-support-v4-ics-mr1_intermediates/classes.jack -D jack.import.resource.policy=keep-first -D jack.import.type.policy=keep-first -D jack.java.source.version=1.7 --output-jack /home/hexafluoride/android/system/out/target/common/obj/JAVA_LIBRARIES/android-support-v4-jellybean_intermediates/classes.jack $tmpEcjArg || ( rm -f /home/hexafluoride/android/system/out/target/common/obj/JAVA_LIBRARIES/android-support-v4-jellybean_intermediates/classes.jack ; exit 41 )
ERROR: /home/hexafluoride/android/system/frameworks/support/v4/jellybean/android/support/v4/app/NavUtilsJB.java:0: The type android.app.Notification cannot be found in source files, imported jack libs or the classpath
build/core/java.mk:636: recipe for target '/home/hexafluoride/android/system/out/target/common/obj/JAVA_LIBRARIES/android-support-v4-jellybean_intermediates/classes.jack' failed
make: *** [/home/hexafluoride/android/system/out/target/common/obj/JAVA_LIBRARIES/android-support-v4-jellybean_intermediates/classes.jack] Error 41
What am I doing wrong? I'm on Ubuntu Server 16.04.
Alright, the problem probably was because I abruptly interrupted the build process because of a hang, and then tried to continue building from there.
I did a make clobber && brunch angler and it built successfully.
I am compiling linphone for android.i have set ndk and sdk paths.and installed pre-requisites.i also have 32-bit libs in my ubuntu12.04-64-bits.But when i 'make' the source code.it gives me 'sqlite.3h' file not found.
it is my log
In file included from
jni/..//submodules/linphone/build/android/../../coreapi/account_creator.c:21:0:
jni/..//submodules/linphone/build/android/../../coreapi/private.h:55:21: fatal error: sqlite3.h: No such file or directory
#include "sqlite3.h"
^
compilation terminated.
make[1]: *** [obj/local/armeabi-v7a/objs/linphone/account_creator.o] Error 1
I successfully able to compile linphone-android on ubuntu 12.04lts 64-bits.Problem solved by downloading arm-2009q3(consists of arm libraries and executables)and export its bin path in bash file(i.e. export PATH=$PATH:/usr/local/arm-2009q3/bin).