Failed to build sample SDK add-on on Android 13 AOSP - android

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/

Related

How to fix ·libtest_x86_64-unknown-linux-gnu" module dependencies?

Im trying to run AOSP and I give an error libtest_x86_64-unknown-linux-gnu dependencies.
Could yo helpme regarding where I can download the module dependencie?
root#german-VirtualBox:/home/german/WORK_DIR/out# cat error.log
FAILED: out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
Outputs: out/soong/build.ninja
Error: exited with code: 1
Command: cd "$(dirname "out/soong/.bootstrap/bin/soong_build")" && BUILDER="$PWD/$(basename "out/soong/.bootstrap/bin/soong_build")" && cd / && env -i "$BUILDER" --top "$TOP" --out "out/soong" -n "out" -d "out/soong/build.ninja.d" -t -l out/.module_paths/Android.bp.list -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja --available_env out/soong/soong.environment.available --used_env out/soong/soong.environment.used Android.bp
Output:
error: external/rust/crates/memchr/Android.bp:41:1: "libmemchr" depends on undefined module "libtest_x86_64-unknown-linux-gnu"
error: external/rust/crates/pin-project-lite/Android.bp:42:1: "libpin_project_lite" depends on undefined module "libtest_x86_64-unknown-linux-gnu"
error: external/rust/crates/proc-macro-hack/Android.bp:41:1: "libproc_macro_hack" depends on undefined module "libtest_x86_64-unknown-linux-gnu"
error: external/rust/crates/rustversion/Android.bp:40:1: "librustversion" depends on undefined module "libtest_x86_64-unknown-linux-gnu"
error: external/rust/crates/proc-macro-nested/Android.bp:49:1: "libproc_macro_nested" depends on undefined module "libtest_x86_64-unknown-linux-gnu"
Thanks in advance for your help
The libtest_x86_64-unknown-linux-gnu lib is available in https://cs.android.com/android/platform/superproject/+/master:prebuilts/rust/linux-x86/1.58.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/
This lib will be downloaded as part of AOSP code in prebuilts/rust.git.
Try syncing this project again
repo sync prebuilts/rust
The sync was failing for me with below error:
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function
After installing gnutls-bin package it synced successfully.
apt install gnutls-bin

getting issue while building android os pie

I have done make clean and after that make -j7 but got this build issue. Please help
[61/62] glob vendor/mediatek/proprietary_mt8168/frameworks/ml/nn/tflite/tensorflow/contrib/lite/tflite_static.bp
[113/113] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
out/soong/.bootstrap/bin/soong_build -t -l out/.module_paths/Android.bp.list -b out/soong -n out -d out/soong/build.ninja.d -o out/soong/build.ninja Android.bp
error: external/doclava/bin/Android.bp:15:1: module "droiddoc-templates-sdk" already defined
external/doclava/Android.bp:15:1 <-- previous definition here
error: external/doclava/bin/Android.bp:20:1: module "doclava" already defined
external/doclava/Android.bp:20:1 <-- previous definition here
ninja: build stopped: subcommand failed.
21:42:48 soong bootstrap failed with: exit status 1```
delete this folder:
external/doclava/bin
and re-run the build

NDK link C++ library .a error, no archive symbol table (run ranlib)

description
We have a C/C++ project wallet-core that is using third party library libsecp256k1, and we install libsecp256k1 into /usr/local/lib and /usr/local/include, all works well in wallet-core Unit Test, till we add it to android, which call wallet-core.
call links:
android project -> wallet-core -> trezor_crypto -> libsecp256k1
When we run tools/android-test, got error in link period:
xxxx -L/usr/local/lib trezor-crypto/libTrezorCrypto.a libprotobuf.a -llog /usr/local/lib/libsecp256k1.a -latomic -lm && :
/Users/bibodeng/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: error: /usr/local/lib/libsecp256k1.a: no archive symbol table (run ranlib)
../../../../../../trezor-crypto/src/ecdsa.c:1211: error: undefined reference to 'secp256k1_context_create'
../../../../../../trezor-crypto/src/ecdsa.c:1213: error: undefined reference to 'secp256k1_schnorr_sign'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Configuring for JNI
two function is undefined and there is no symbols, tell me ranlib. ranlib result:
$ranlib libsecp256k1.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: archive member: libsecp256k1.a(/0) size too large (archive member extends past the end of the file)
I run nm -g libsecp256k1.a also said it's truncated or malformed archive.
Please help me to solve this problem, we have stuck several days. Thanks a lot.
guess reason
I read many answer and guess it's reason:
linker will run ranlib before link, but it fail cause there is no
symbol ranlib failed because libsecp256k1.a
archive file is too big or maybe not in good format
libsecp256k1.a file is not
generated well or ranlib has problems.
codes & config
libsecp256k1: https://github.com/Bitcoin-ABC/secp256k1
./autogen.sh
mkdir build
cd build
../configure --enable-module-schnorr
make
make check
sudo make install
wallet-core: https://github.com/IFWallet/wallet-core/tree/free_cash
git clone git#github.com:IFWallet/wallet-core.git
git checkout free_cash
cd wallet-core
./bootstrap.sh
./tools/android-test
download the codes from github and checkout free_cash branch, run upper cmd will get the same error.
relate answers
I already try this answer, but not work.
ndk-no-archive-symbol-table

"/system/bin/linker: No such file or directory" error trying to compile TensorFlow

I am trying to compile tensorflow-lite for Android running the building script, but the building process stops with this error:
/system/bin/linker: No such file or directory
I can understand how the building process works (compilation + linking) but I can not figure out why this '/system/bin/linker' is needed. This linker is not present in the SDK or NDK folder, and it is not present in the folder tree of the host computer (I am using Linux for the building process).
It looks like part of the Android file structure, but the building process should not depend on the final system structure.
The element I am trying to build is 'schema_fbs', which compiles part of the code using flatbuffers (a 3rd party dependency). The complete sentence I am using is:
bazel build \
--cxxopt='--std=c++11' \
--crosstool_top=//external:android/crosstool \
--host_crosstool_top=#bazel_tools//tools/cpp:toolchain \
--cpu=armeabi-v7a \
--verbose_failures \
--subcommands \
//tensorflow/contrib/lite/schema:schema_fbs
It could be caused by a testing case inside the Bazel building script (I have commented all the tests I found), but why is the linker needed? Is there something I have to do to define this 'system' folder in the compilation process?
Notes:
Target OS: Android
Host OS: Ubuntu 16.04
Used NDK: v16b (tested with v17 but it is not compatible)
Full error messages:
INFO: Analysed target //tensorflow/contrib/lite/schema:schema_fbs_srcs (0 packages loaded).
INFO: Found 1 target...
SUBCOMMAND: # //tensorflow/contrib/lite/schema:schema_fbs_srcs [action 'Generating flatbuffer files for schema_fbs_srcs: //tensorflow/contrib/lite/schema:schema_fbs_srcs']
(cd /home/user/.cache/bazel/_bazel_user/73606864f5ec4cce18dd83a6cbcd2bc2/execroot/org_tensorflow && \
exec env - \
LD_LIBRARY_PATH=/usr/local/lib:/home/user/Libraries/llvm-4.0.0.src/build/lib: \
PATH=/home/user/Software/git-sizer:/home/user/Android/Sdk/platform-tools:/home/user/anaconda3/bin:/home/user/Libraries/llvm-4.0.0.src/build/bin:/home/user/bin:/home/user/repo/caffe/build/install/lib:/home/user/Software/cmake-3.10.3-Linux-x86_64/bin:::::/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \
/bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; for f in tensorflow/contrib/lite/schema/schema.fbs; do bazel-out/armeabi-v7a-opt/bin/external/flatbuffers/flatc --no-union-value-namespacing --gen-object-api -c -o bazel-out/armeabi-v7a-opt/genfiles/tensorflow/contrib/lite/schema $f; done')
ERROR: /home/user/Repositories/git/tensorflow/tensorflow/contrib/lite/schema/BUILD:57:1: Generating flatbuffer files for schema_fbs_srcs: //tensorflow/contrib/lite/schema:schema_fbs_srcs failed (Exit 255): bash failed: error executing command
(cd /home/user/.cache/bazel/_bazel_user/73606864f5ec4cce18dd83a6cbcd2bc2/execroot/org_tensorflow && \
exec env - \
LD_LIBRARY_PATH=/usr/local/lib:/home/user/Libraries/llvm-4.0.0.src/build/lib: \
PATH=/home/user/Software/git-sizer:/home/user/Android/Sdk/platform-tools:/home/user/anaconda3/bin:/home/user/Libraries/llvm-4.0.0.src/build/bin:/home/user/bin:/home/user/repo/caffe/build/install/lib:/home/user/Software/cmake-3.10.3-Linux-x86_64/bin:::::/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \
/bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; for f in tensorflow/contrib/lite/schema/schema.fbs; do bazel-out/armeabi-v7a-opt/bin/external/flatbuffers/flatc --no-union-value-namespacing --gen-object-api -c -o bazel-out/armeabi-v7a-opt/genfiles/tensorflow/contrib/lite/schema $f; done')
/system/bin/linker: No such file or directory
Target //tensorflow/contrib/lite/schema:schema_fbs_srcs failed to build
INFO: Elapsed time: 0.572s, Critical Path: 0.02s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
The TensorFlow Lite AAR can also be built using:
bazel build --cxxopt='--std=c++11' -c opt --fat_apk_cpu=x86,x86_64,arm64-v8a,armeabi-v7a tensorflow/contrib/lite/java:tensorflow-lite
And you must make sure you ran ./configure and let it configure SDK and NDK for your.

Can't compile CyanogenMod 13

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.

Categories

Resources