开发者

Internal compiler error when compiling native Android code

开发者 https://www.devze.com 2023-01-10 16:01 出处:网络
Currently I am trying to compile native code for Android. The code is from the OpenCV port for Android. I pasted all the code correctly in my project and edited my make files accordingly. When I set a

Currently I am trying to compile native code for Android. The code is from the OpenCV port for Android. I pasted all the code correctly in my project and edited my make files accordingly. When I set android:debuggable to false everything works fine and I get my native library. When I try while android:debuggable is set to true I get an error. Here is a part of the log:

Compile++ thumb: cxcore <= AR_Still_Image/jni/cxcore/src/cxutils.cpp
AR_Still_Image/jni/cxcore/src/cxutils.cpp: In function 'void icvSort16u(ushort*, size_t, int)':
AR_Still_Image/jni/cxcore/src/cxutils.cpp:987: internal compiler error: in reload, at reload1.c:1173
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [AR_Still_Image/obj/local/armeabi/objs/cxcore/cxcore开发者_如何学C/src/cxutils.o] Error 1

From what I have found on the internet this is caused by the optimization level of the compilation. As long as the code isn't compiled so that is is debuggable afterwards everything should be fine.

Now apparently it is possible to avoid this by setting APP-OPTIM := release in the Application.mk or adding -O2 to LOCAL_CFLAGS. I have tried both and still I get this error.

Right now I don't really care that much about debugging my native code, but I would like to have basic debugging enabled. And I don't want to keep switching android:debuggable in my manifest every time I want to compile. I'm not even sure if it is okay at all if I just set android:debuggable to false pre compiling and to true post compiling, but I am sure I will forget it every second run.

Has anyone encountered a similar problem or does anyone know how to fix this? It would be a great help.


A workaround is to pre-build the code causing the compiler error with debug off. Then bring it in as prebuilt. Then you can build the rest with debug. I had this problem (or similar), and posted on the Google Group.

Reference the Prebuilts section of the Dev Guide.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号