0

When I build as static library, the source code builds well in Android JellyBean 4.1.2 using the mm command. But when I try to build the opencv folder under android/external/opencv as static library, with the following changes in android/external/opencv/Android.mk

+ LOCAL_SHARED_LIBRARIES+= libdl

and

- include $(BUILD_STATIC_LIBRARY)
+ include $(BUILD_SHARED_LIBRARY)

- LOCAL_STATIC_LIBRARIES := libcxcore libcv libcvaux libcvml libcvhighgui
+ LOCAL_SHARED_LIBRARIES := libcxcore libcv libcvaux libcvml libcvhighgui

I get the following error:

android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-linux-androideabi/bin/ld: internal error in thumb_branch_common, at /tmp/android-8532/src/build/../binutils/binutils-2.21/gold/arm.cc:4148
collect2: ld returned 1 exit status
make: *** [out/target/product/mydevice/obj/SHARED_LIBRARIES/libcxcore_intermediates/LINKED/libcxcore.so] Error 1

Any idea on how to fix this error?

Thanks in advance. Regards, Jai

1 Answer 1

2

,,, arm-linux-androideabi/bin/ld: internal error in thumb_branch_common, at /tmp/android-8532/src/build/../binutils/binutils-2.21/gold/arm.cc:4148 collect2: ld returned 1 exit status

Any idea on how to fix this error?

In Binutils, file arm.cc, Line 4148 there was an Internal Error (in Binutils).

Try newer Binutils (or older) or fix the Bug and submit the Patch.

You can also switch to a different Toolchain (using a different Binutils) and try that. Sometimes Compiler switches will alter the operation enough to avoid the Bug.

There is a CHANCE that simply altering the order of the Function in the Source File of the Code you are compiling (NOT gold/arm.cc, that is where the Compiler Bug is, change YOUR Source) and that Binutils will read the newly ordered Code differently and thus avoid the Binutils Bug.

It is also possible that the Code you are linking (the .o Files) was corrupted either on Disk or by a Bug in the Compiler, or that it is for the wrong endian (etc.) and that is not being detected.

PS: Thumb-2 Code (in the Compiler's Toolchain) is not Bug free (as you noticed).

See here for some People working on a fix: http://git.openembedded.org/openembedded-core-contrib/commit/?h=kraj/gold&id=b72f3238ad32ab420306a0226d8c2e57c52ddf45

... and this is what they came up with: http://sourceware.org/bugzilla/attachment.cgi?id=6284&action=diff

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.