Forums - Fill the missing information please

2 posts / 0 new
Last post
Fill the missing information please
Squida
Join Date: 2 Mar 21
Posts: 6
Posted: Tue, 2022-01-25 18:09

I need someones help to fill in the missing information on this guide.

This guide is incomplete for beginners and needs to be updated. It has missing steps and too many abbreviations. Please update and have it as beginner friendly as possible.

I understand the error on the bottom shows I am missing APP_BUILD_SCRIPT. Guide says nothing about it. Just one of the many issues with the guide.

Please get onto it QualComm.

We need 2 guides. 1 for a Normal build and another for a Standalone build.

***********************************************************************************************************************************

****************************************************THE WANNABE GUIDE*********************************************************

Using Snapdragon LLVM ARM Compiler 8.0.6 with Android NDK:

The Snapdragon LLVM ARM Compiler 8.0.6 can be used as a drop-in replacement
for LLVM shipped as part of the Android NDK.

1. Snapdragon LLVM ARM Compiler 8.0.6 has been verified to work with Android
NDK versions r18b for Windows (64-bit) and Linux (64-bit)

2. On Windows, it is assumed that the user has Cygwin setup. The examples below
need to be adjusted to follow the Windows path specifications if Cygwin is not
used.

3. On Windows and Linux it is recommended that you extract the Android NDK
under a directory which *does not* contain spaces, like:

C:\android-ndk-r18b
/local/mnt/workspace/android-ndk-r18b

This directory is referred to as <NDK_ROOT> in this README.

On Windows, extract Snapdragon-llvm-8.0.6-windows64.zip under <NDK_ROOT>.

On Linux, extract Snapdragon-llvm-8.0.6-linux64.tar.gz under <NDK_ROOT>.

4. The following toolchains would be used for linking, by default:
 For ARMv8 32-bit --> arm-linux-androideabi-4.9
 For AArch64 --> aarch64-linux-android-4.9

5. On Windows, in order to avoid errors due to missing MSVC Redistributable
DLLs, make sure you set PATH to the Snapdragon LLVM bin directory as follows:
export PATH=<NDK_ROOT>/toolchains/llvm-Snapdragon_LLVM_for_Android_6.0/
prebuilt/windows-x86_64/bin:$PATH

6. The Snapdragon LLVM ARM 8.0.6 toolchain is designed to work with both 32-bit
and 64-bit versions of the NDK as described below:

For generating ARMv8 32-bit code, invoke your compilation line as follows:

ndk-build NDK_TOOLCHAIN_VERSION=snapdragonclang APP_ABI="armeabi-v7a" -C
<some_project>

For generating AArch64 (64-bit) code, invoke your compilation line as follows:

ndk-build NDK_TOOLCHAIN_VERSION=snapdragonclang APP_ABI="arm64-v8a" -C
<some_project>

7. If you want to specify your custom flags to the compiler in order to
override the default flags you can use the flag APP_CFLAGS as follows:

ndk-build NDK_TOOLCHAIN_VERSION=snapdragonclang APP_ABI="armeabi-v7a" \
APP_CFLAGS="-O3" -C <some_project>

Similarly, to specify custom flags for the linker you can use the
flag APP_LDFLAGS.

8. We STRONGLY RECOMMEND the following command line flags, to be set through
APP_CFLAGS, for best performance. These options ensure that all high
performance optimization features in the Snapdragon LLVM compiler are enabled
to deliver maximum performance in 32-bit and 64-bit modes. For this release, if
you continue to use the default Android NDK compatible flags, you may see
performance regression.

  If your project does not require precise math, please set
  APP_CFLAGS="-Ofast -mcpu=cortex-a57"

  If your project requires IEEE 754 floating point compliance, please set
  APP_CFLAGS="-O3 -mcpu=cortex-a57"

9. A standalone toolchain for the Android NDK environment using the Snapdragon
LLVM ARM compiler can be created using the make_standalone_toolchain utility.
Note: For NDK r18b, the default make_standalone_toolchain.py cannot be used
with Snapdragon LLVM toolchain to create a standalone toolchain. So we provide
a custom script called make_standalone_toolchain_snapdragon_llvm.py.

For example, to create a standalone toolchain for Linux 64-bit environment, the
following commands can be used:

For ARMv8 32-bit:

<NDK_ROOT>/build/tools/make_standalone_toolchain_snapdragon_llvm.py \
--arch arm --api 28 --install-dir <some_dir>

The above command line specifies that you are targeting Android API level 28. If
you do not specify the API level, the default will be set to the minimum
supported level for the given architecture (currently 14 for 32-bit
architectures).

For AArch64:

<NDK_ROOT>/build/tools/make_standalone_toolchain_snapdragon_llvm.py \
--arch arm64 --api 28 --install-dir <some_dir>

The above command line specifies that you are targeting Android API level 28. If
you do not specify the API level, the default will be set to the minimum
supported level for the given architecture (currently 21 for 64-bit
architectures).

10. By default, the ndk-build tool will build an application for all the valid
targets (viz. ARMv8 32-bit, AARCH64, X86). This will result in compilation
errors for X86 targets since the Snapdragon LLVM ARM Compiler 8.0.6 cannot
generate code for these targets. The errors can be avoided if the user
explicitly passes APP_ABI="armeabi-v7a" or APP_ABI="arm64-v8a" when using the
Snapdragon LLVM ARM Compiler 8.0.6. However, in situations where the build
system cannot be changed, and hence these flags cannot be set, we provide the
following wrappers for x86 in order to avoid compilation errors:

x86-snapdragonclang
x86_64-snapdragonclang

These wrappers are exact copies of their Clang versions which are
distributed as part of the Android NDK. These wrappers would simply invoke
the LLVM compiler that comes with NDK (for X86 targets only), thus
avoiding compilation errors when using the Snapdragon LLVM ARM Compiler 8.0.6.

Note: The Snapdragon LLVM ARM Compiler 8.0.6 would be invoked for ARMv8 32-bit and
AARCH64 targets.

Contacts & Bug Reporting
http://developer.qualcomm.com/llvm-forum

***********************************************************************************************************************************
***********************************************************************************************************************************
Following this guide with added help from sources outside of this guide. I get this error.

~/adev/snapdragontool/android-ndk-r18b$ ./ndk-build NDK_TOOLCHAIN_VERSION=snapdragonclang APP_ABI="arm64-v8a" -C kernel
Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-16.    
Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: /home/droid/adev/snapdragontool/android-ndk-r18b/kernel/jni/Android.mk    
make: Entering directory `/home/droid/adev/snapdragontool/android-ndk-r18b/kernel'
/home/droid/adev/snapdragontool/android-ndk-r18b/build/core/add-application.mk:88: *** Android NDK: Aborting...    .  Stop.
make: Leaving directory `/home/droid/adev/snapdragontool/android-ndk-r18b/kernel

***********************************************************************************************************************************

  • Up0
  • Down0
mengdiz
Join Date: 6 Dec 21
Posts: 27
Posted: Tue, 2022-02-08 23:47

Hi,

Please modify your ndk build path, it will define APP_BUILD_SCRIPT.

and APP_PLATFORM := android-24 define in application.mk 

make_android_bin.sh
#!/bin/bash

#NDK_BUILD_PATH="/net/pacamara-linux/local/mnt/workspace/wkimberl/android_ndks/android-ndk-r11c/ndk-build"
NDK_BUILD_PATH="/home/devil/android-ndk-r11c-linux-x86_64/android-ndk-r11c/ndk-build"
if [ -e $NDK_BUILD_PATH ]
then
$NDK_BUILD_PATH NDK_APPLICATION_MK="Android_standalone.mk" APP_BUILD_SCRIPT="Android_standalone.mk" NDK_LIBS_OUT="./libs/LA" NDK_PROJECT_PATH="./" NDK_DEBUG=0
else
echo "********************************************************************************"
echo "ERROR: NDK Build path not set correctly. Update NDK path in $0 to build android binaries"
echo "********************************************************************************"
fi

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.