Why I get “Invalid RS info file”?

人盡茶涼 提交于 2019-12-24 05:30:21

问题


Since I'm targeting my project to SDK 19 (KitKat), I randomly get this Message on a Nexus 7 (2013 | SDK 18):

11-07 17:54:27.502: E/bcc(2033): Invalid RS info file /data/data/<package>/cache/com.android.renderscript.cache/<script-name>.o.info! (No such file or directory)

What does that mean? And why there still isn't any useful documentation of RenderScript?


回答1:


Temporary workaround: I got the same issue with the CarouselExample RS after installing Android Build-Tools version 19 when having Build-Tools 17 installed. After deinstalling Build-Tools version 19, it works again. I don't know what is going on with version 19.




回答2:


  1. Native RS isn't backwards compatible from new versions of RS to old versions of RS (LLVM bitcode differences, things like that). The error you're getting is expected in this case.

  2. RS with the support lib enables API 18 RS to run on API 8 through API 17 using a CPU-only fallback path. On devices with API 18 or above, it'll use bitcode, JIT compilation, GPU acceleration, etc--identical to native.

  3. The option you probably want is an option to llvm-rs-cc, the core RS compiler: -target-api. There might be a way to set this from Eclipse, but in your project.properties you should be able to set

renderscript.target=14

and things may work.




回答3:


The issue was because the script uses the "old" kernel style:

void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {

after updating the kernel to

uchar4 __attribute__((kernel)) kernel(uchar4 in, uint32_t x, uint32_t y) {

it works. However, now I'm facing the problem that older target devices (API 14 for instance) don't work anymore, so this is not a great solution.




回答4:


You mention seeing this log line, but does the code actually run/work? That log is saying that the info file doesn't exist, which is the case whenever you first install the application or when you clear its cache. Info files are an internal implementation detail that allows us to cache/load existing binary code for RS. I don't think there is an actual bug here. Let me know if you still see the code not running at all.




回答5:


I was targetting a x86 device on 4.3 (API 18) using latest RS buildtools (20) with:

renderscript.support.mode=true
renderscript.target = 18

I had also the same error, followed in the stacktrace with many lookup failed errors, in my specific case related to pow and exp functions:

E/RenderScript(5251): ScriptC sym lookup failed for powf
E/RenderScript(5251): ScriptC sym lookup failed for expf

[...]
E/bcc(5251): Some symbols are found to be undefined during relocation!
E/bcc(5251): Error occurred when performs relocation on /data/data/*********/cache/com.android.renderscript.cache/synth.o!
[...]
E/RenderScript(5251): bcc: FAILS to prepare executable for 'synth'
[...]
E/AndroidRuntime(5251): Caused by: android.renderscript.RSRuntimeException: Loading of ScriptC script failed.
[...]
I/Process(5251): Sending signal. PID: 5251 SIG: 9

Thus, to solve this issue, I replaced calls of pow and exp respectively by native_powr (not visible in the documentation but available) and native_exp in the RS source code. Note that it's also important to properly clean your project, otherwise you might end up with a different crash as:

A/libc(5844): Fatal signal 11 (SIGSEGV) at 0x97698030 (code=2), thread 5844 (****)


来源:https://stackoverflow.com/questions/19841952/why-i-get-invalid-rs-info-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!