为什么我收到“ScriptC sym lookup failed”错误?

时间:2013-11-04 22:56:12

标签: renderscript

我试图用RenderScript在RenderScript中实现一个简单的亮度直方图 原子算术函数rsAtomicInc, 但我得到一个运行时错误,似乎说功能不存在: ScriptC sym lookup failed for _Z11rsAtomicIncPVj

(要验证这是正确的符号,您可以使用:

$ echo "unsigned int __attribute__((overloadable)) 
     rsAtomicInc ( volatile unsigned int *addr ) { return 0; }" > rsai.c
$ clang -c rsai.c; nm rsai.o

dumpbin可以代替nm Windows。)我尝试过使用其他原子函数,这会产生类似的错误。无论我是在内核中还是在可调用的函数中使用它,我都会得到错误。

 // histogram.rs:
 #pragma version(1)
 #pragma rs java_package_name(com.example.android.rs.hellocompute)
 #pragma rs_fp_imprecise //relax math- allows NEON and other optimizations

 const static float3 gMonoMult = {0.299f, 0.587f, 0.114f};
 volatile uint32_t *luminanceHistogram;

 void luminance(const uchar4 *img, const void *usrData, uint32_t x, uint32_t y) {
     float4 f4 = rsUnpackColor8888(*img);
     float3 mono = dot(f4.rgb, gMonoMult);
     uchar lum = rsPackColorTo8888(mono).r;
     rsAtomicInc(luminanceHistogram + lum);
 }

 void increment(int lum) {
     rsAtomicInc(luminanceHistogram + lum);
 }
 
 // HelloCompute.java
int[] luminance = new int[256];
Allocation luminanceHistogram = Allocation.createSized(mRS, 
    Element.U32(mRS), luminance.length);
ScriptC_histogram histo = new ScriptC_histogram(mRS); // ERROR

错误日志:

E/bcc     ( 3539): Invalid RS info file /data/data/com.example.android.rs.hellocompute/cache/com.android.renderscript.cache/histogram.o.info! (No such file or directory)
E/RenderScript( 3539): ScriptC sym lookup failed for _Z11rsAtomicIncPVj
E/bcc     ( 3539): Some symbols are found to be undefined during relocation!
E/bcc     ( 3539): Error occurred when performs relocation on /data/data/com.example.android.rs.hellocompute/cache/com.android.renderscript.cache/histogram.o!
E/RenderScript( 3539): bcc: FAILS to prepare executable for 'histogram'
D/AndroidRuntime( 3539): Shutting down VM
W/dalvikvm( 3539): threadid=1: thread exiting with uncaught exception (group=0x415c6700)
E/AndroidRuntime( 3539): FATAL EXCEPTION: main
E/AndroidRuntime( 3539): android.renderscript.RSRuntimeException: Loading of ScriptC script failed.
E/AndroidRuntime( 3539):    at android.renderscript.ScriptC.<init>(ScriptC.java:60)
...

关于histogram.o.info的第一个错误是可能假 - 完全卸载应用程序使其(但没有其他错误)在第一次运行时消失。

1 个答案:

答案 0 :(得分:1)

这看起来像我们的错误(Android RenderScript团队)。看起来这些函数在我们实现的运行时库中不存在(即使它们存在于头文件中)。我将在内部提交一个错误,并在将来的版本中清理它。