Error: TARGET_CPU_VARIANT not set? - android

I am building a C Code to android using ndk in eclipse. I need to include libc library which requires me to set a TARGET_CPU_VARIANT. This is the error message precisely. I am using armeabi-v7a. What should I do?
TARGET_CPU_VARIANT not set or set to an unknown value.
Possible values are cortex-a7, cortex-a8, cortex-a9, cortex-a15, krait, denver.
Use generic for devices that do not have a CPU similar to any of the supported cpu variants

Related

Can not use Vulkan Subgroup operations in Android Studio

I'm writing a Vulkan compute shader in Android studio and launching it on Android phone. The problem I'm experiencing is next - I can not use any subgroup operations like subgroupAdd and subgroupElect. When I'm trying to use these functions I have an error like this:
reduce_vec.comp:35: error: 'subgroup op' : requires SPIR-V 1.3
I have checked - my Android phone supports subgroups, and my shader accepts such extensions:
#extension GL_KHR_shader_subgroup_arithmetic: enable
#extension GL_KHR_shader_subgroup_basic: enable
The problem is pretty much straightforward, I need to update my SPIR-V. But according to my findings, SPIR-V that comes automatically with Android studio is not something I can update easily.
Did someone experience a similar issue before? What was your solution? Thanks in advance!
Android solution
You can pass arguments to the Android shaderc compiler in your Gradle DSL:
https://developer.android.com/ndk/guides/graphics/shader-compilers
You need glslcArgs to contain --target-env=vulkan1.1
Flexible solution
Build your own compilation pipeline to compile from source into SPIR-V, and then include the SPIR-V binary files directly into your Android project.
There are multiple language front-ends that can generate SPIR-V, for GLSL the Khronos tools are here:
https://github.com/KhronosGroup/glslang

Why does LTO introduce new DT flags TLSDESC_PLT and TLSDESC_GOT in armv8a NDK build

I'm building an armv8a SDK for Android using the NDK and I wanted to build with LTO enabled. I added -flto to the compile and link flags for the C++ toolchain, and all went well, until I tried to run in the emulator, at which point an error like the following was emitted:
WARNING: linker: /data/lib/libservice.so: unused DT entry: type 0x6ffffef6 arg 0x8e30
and
WARNING: linker: /data/lib/libservice.so: unused DT entry: type 0x6ffffef7 arg 0x2fb50
Some research led me to this answer which allowed me to dig out the symbol names for 0x6ffffef6 and 0x6ffffef6, they happen to be TLSDESC_PLT and TLSDESC_GOT respectively, so clearly something to do with dynamic linker and the PLT/GOT, and also with TLS. Fine.
Comparing the non LTO build with the LTO build, these flags definitely only come in for the LTO build:
$ readelf -a /lto/lib/libservice.so | grep TLS
L (link order), O (extra OS processing required), G (group), T (TLS),
TLS 0x000000000001ed70 0x000000000002ed70 0x000000000002ed70
0x000000006ffffef6 (TLSDESC_PLT) 0x8e30
0x000000006ffffef7 (TLSDESC_GOT) 0x2fb50
00000002ffd8 000000000407 R_AARCH64_TLSDESC 0
00000002ffe8 000000000407 R_AARCH64_TLSDESC 8
579: 0000000000000008 8 TLS LOCAL DEFAULT 17 _ZN5xxxxx12_GLOBAL__N_113
788: 0000000000000000 1 TLS LOCAL DEFAULT 17 __tls_guard
$
$ readelf -a /nolto/lib/libservice.so | grep TLS
L (link order), O (extra OS processing required), G (group), T (TLS),
$
So, some questions:
Why does the android armv8a runtime reject these DT flags?
Why does enabling LTO seem to change the TLS implementation or needs? Why do these tags get emitted (along with the other symbols)?
How can I prevent that, or otherwise avoid this issue? Can I request some other TLS model?
I've found at least one other issue like this, where the Android environment rejects the flag DT_ORIGIN which is usually required for $ORIGIN processing, but still honors $ORIGIN even without DT_ORIGIN set. Is the rejection of the TLDESC_ flags potentially a similarly overzealous check, and the code is in fact fine, which would indicate an NDK bug?
Any insights appreciated. Note that this seems to work for other Android targets, specifically the Android x86_64 build worked just fine with -flto, and the resulting binaries do not have any TLSDESC anything in the readelf -a output.
I upgraded to NDK r18 beta2, and I no longer have this problem. It appears that the underlying bug was something to do with not propagating the use of emulated TLS down through the gold linker plugin (see https://github.com/android-ndk/ndk/issues/498), which was fixed in r18.

NDK porting c++ to android runtime fault

i'm new here, i was trying port c++ game server code from windows to android armeabi-v7a but i came across this alert from android ndk, the process should continue to run because it is a server:
C:/Users/Home/Documents/samps/jni/raknet/SingleProducerConsumer.h:138:3: note: when a volatile object spans multiple type-sized locations, the compiler must choose bet
ween using a single mis-aligned access to preserve the volatility, or using multiple aligned accesses to avoid runtime faults; this code may fail at runtime if the har
dware does not allow this access
if (writeAheadPointer->next==readPointer ||
^
and in the android shows segmentation fault:
raksamp on android
Can this be solved? thanks.

Opencl can't find gpu on ARM

I'm trying to run image processing app on android/ARM, using opencv's ocl module. In some case(android4.2.2/Qualcomm snapdragon msm8930/Adreno TM305), it runs well.
But in other cases(android4.4.2/rockchip RK3288/mali-T764; android4.4/sumsung exynos5410/powerVR SGX 544mp),there are problems. CV::ocl::getOpenCLDevice() shows there is no opencl platform or device.
I'm sure all three tested systems support opencl. Could anyone tell me what's the problem here? Thanks!
Well,I fixed the problem already. The problem is some android devices don't have opencl lib file libopencl.so in file system, or the file has a different name(for example, libgles_Mali.so). To use opencl, we should set environment first.
Specifically, add
setenv("OPENCV_OPENCL_BINARY", "libGLES_Mali.so", 0);
Before
cv::ocl::getOpenCLDevices()

How do I stop the IDE from referencing Windows-specific XML units in my non-Windows project?

I want to create a Android program in Delphi XE5 to work with XML files. I use TXMLDocument.
I can't compile and run it, though, because Delphi repeatedly adds Xml.Win.msxmldom in the uses section. The following error occurs:
[DCC Fatal Error] Unit1.pas(11): F1026 File not found:
'C:\Users\HamiD\Documents\RAD Studio\Projects\Xml.Win.msxmldom.dcu'
(unit scope "Xml.Win" indicates Win32, Win64 only)
How do I avoid using that unit in my project?
In the TXMLDocument, change the DOM vendor from MSXML to ADOMXML v4, to stop the need to use the MSXML unit.
This is covered in the documentation for TXMLDocument.DOMVendor. Although it mentions specifically Mac, the same applies to other FireMonkey applications on iOS and Android.
Tip: If you are designing a FireMonkey application that is intended to run on Mac OS X, then you should perform the following steps to ensure that the compilation succeeds:
Change DOMVendor from MSXML to ADOM XML v4.
If the Xml.Win.msxmldom unit is in the uses clause then remove it.
Compile your application for Mac OS X.
The documentation was modified in the XE5 version to read instead:
Tip: To use TXMLDocument in Mac OS X or Mobile applications, in the Object Inspector, set the DOMVendor property to ADOM XML v4 right after dropping this component onto the Form Designer. Otherwise, the TXMLDocument component is no longer usable for iOS/Android/OSX applications.

Categories

Resources