0
我想实现的renderScript使用 原子算术函数rsAtomicInc
, 一个简单的亮度直方图,但我得到这似乎是说,功能不存在运行时错误: ScriptC sym lookup failed for _Z11rsAtomicIncPVj
。为什么我会收到“ScriptC sym查找失败”错误?
(为了验证这是否是正确的符号,你可以使用:
$ 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第一个错误是可能 spurious-应用程序的完全卸载使得它(但没有其他错误)第一次跑掉。
你有没有设法重现它?有没有更多的信息可以帮助我?你有任何解决方法的建议吗? – Kietz
唯一的解决方法是不使用这些函数的未签名版本。有签署的变体应该工作。 –
这是怎么发生的? – Kietz