Getting “cannot locate '_Z10rsIsObject13rs_allocation'…” with RenderScript support library

StackOverflow https://stackoverflow.com//questions/20018456

  •  21-12-2019
  •  | 
  •  

Question

I've followed all the steps to build my RenderScript/FilterScript for several targets. I included the support-library for RenderScript as well. My target-api is 18.

When I run my RenderScript on this target, everything works fine. When I try to run it on an API-14 device, I see the following log output

11-16 13:12:34.791: D/dalvikvm(9226): Trying to load lib /data/data/<package>/lib/libRSSupport.so 0x41635250
11-16 13:12:34.811: D/dalvikvm(9226): Added shared lib /data/data/<package>/lib/libRSSupport.so 0x41635250
11-16 13:12:34.821: D/dalvikvm(9226): No JNI_OnLoad found in /data/data/<package>/lib/libRSSupport.so 0x41635250, skipping init
11-16 13:12:34.821: D/dalvikvm(9226): Trying to load lib /data/data/<package>/lib/librsjni.so 0x41635250
11-16 13:12:34.821: D/dalvikvm(9226): Added shared lib /data/data/<package>/lib/librsjni.so 0x41635250
11-16 13:12:34.821: V/RenderScript_jni(9226): RS compat mode
11-16 13:12:34.831: V/RenderScript(9226): 0x5bf60e10 Launching thread(s), CPUs 4
11-16 13:12:34.851: E/RenderScript(9226): Unable to open shared library (/data/data/<package>/lib/librs.<script>.so): Cannot load library: reloc_library[1306]:   119 cannot locate '_Z10rsIsObject13rs_allocation'...
11-16 13:12:34.851: E/RenderScript(9226): Unable to open system shared library (/system/lib/librs.<script>.so): Cannot load library: find_library[1201]:   119 'librs.<script>.so' failed to load previously
11-16 13:12:34.851: W/System.err(9226): android.support.v8.renderscript.RSRuntimeException: Loading of ScriptC script failed.

I'm using the function "rsIsObject" in my script which seems to cause the error. I tried to use

#include "rs_object.rsh"

in my script, but it doesn't make a difference if I include it or not.

Was it helpful?

Solution

We accidentally missed some of the rsIsObject() implementations in the support library. The good news is that this is pretty easy to fix (and will just require an SDK update once it is fixed). In the meantime, you can use a horrible workaround: Cast the parameter to rs_element and it should work.

OTHER TIPS

Finally did a workaround based on the tip from Stephen:

static bool isObject(rs_allocation a){
    return rsIsObject(rsAllocationGetElement(a));
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top