android / ndk

The Android Native Development Kit
1.95k stars 254 forks source link

compiling error with NDK r12b: relocation overflow in R_ARM_THM_CALL #152

Closed minggo closed 8 years ago

minggo commented 8 years ago

steps to reproduce it

My environment:

DanAlbert commented 8 years ago
$ cocos compile -p android
Building mode: debug
Using Eclipse project : /work/src/cocos2d-x-3.12/tests/cpp-tests/proj.android
Android platform not specified, searching a default one...
running: '/usr/local/google/home/danalbert/android-sdk-linux/tools/android update project -t android-10 -p /work/src/cocos2d-x-3.12/tests/cpp-tests/proj.android'

Updated project.properties
Updated local.properties
Updated file /work/src/cocos2d-x-3.12/tests/cpp-tests/proj.android/proguard-project.txt
Android platform not specified, searching a default one...
running: '/usr/local/google/home/danalbert/android-sdk-linux/tools/android update lib-project -p /work/src/cocos2d-x-3.12/cocos/platform/android/java -t android-19'

Updated project.properties
Updated local.properties
Updated file /work/src/cocos2d-x-3.12/cocos/platform/android/java/proguard-project.txt
Building native...
NDK build mode: debug
running: '/work/src/android-ndk-r12b/ndk-build -C /work/src/cocos2d-x-3.12/tests/cpp-tests/proj.android -j48 NDK_MODULE_PATH=/work/src/cocos2d-x-3.12/tests/cpp-tests/proj.android/../../..:/work/src/cocos2d-x-3.12/tests/cpp-tests/proj.android/../../../cocos:/work/src/cocos2d-x-3.12/tests/cpp-tests/proj.android/../../../external NDK_TOOLCHAIN_VERSION=clang NDK_DEBUG=1'

Android NDK: ERROR:/work/src/cocos2d-x-3.12/tests/cpp-tests/proj.android/../../../external/freetype2/prebuilt/android/Android.mk:cocos_freetype2_static: LOCAL_SRC_FILES points to a missing file
Android NDK: Check that /work/src/cocos2d-x-3.12/tests/cpp-tests/proj.android/../../../external/freetype2/prebuilt/android/arm64-v8a/libfreetype.a exists  or that its path is correct
make: Entering directory `/work/src/cocos2d-x-3.12/tests/cpp-tests/proj.android'
/work/src/android-ndk-r12b/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting    .  Stop.
make: Leaving directory `/work/src/cocos2d-x-3.12/tests/cpp-tests/proj.android'
DanAlbert commented 8 years ago

That error usually means that one of the binaries being linked is simply too large and that jump/relocation address simply can't fit in the instruction.

minggo commented 8 years ago

@DanAlbert thanks for testing, it is strange, all developers and me don't meet the compiling error. Now i added LOCAL_ARM_MODE := arm in all Android.mk to fix the issue. But i am not sure if it is the right way to fix it.

minggo commented 8 years ago

@DanAlbert Could you please use cocos compile -p android --app-abi armeabi to compile the codes, i think it will fix the compiling error. Thanks.

minggo commented 8 years ago

fixed in #16223

DanAlbert commented 8 years ago

@shenhanc78: repros for me with both gold and bfd. Is there anything that can be done about this?

@minggo: I don't have this problem when building for armeabi-v7a. This might just be a matter of Thumb-1 being insufficient (in which case I think the LOCAL_ARM_MODE fix you applied is the best you can do for this)

minggo commented 8 years ago

@DanAlbert yep, it seems only has problem with armeabi. So you mean the correct way is to add LOCAL_ARM_EABI=arm?

DanAlbert commented 8 years ago

Yeah, but you might want to do that only for armeabi, not armeabi-v7a. Thumb-2 can encode much larger offsets.

minggo commented 8 years ago

@DanAlbert thanks. But i don't quite understand that Thumb-2 can encode much larger offsets.. What's the side effect of it?

enh commented 8 years ago

arm/thumb/thumb2 are different instruction sets. see "branch" on page 3 of http://infocenter.arm.com/help/topic/com.arm.doc.qrc0001l/QRC0001_UAL.pdf for the ranges of the available branch instructions. (T being thumb and T2 thumb2.)

minggo commented 8 years ago

Yep, i know they are different instructions set. I just want to know what will happen if i use LOCAL_ARM_EABI=arm for armeabi-v7a? Affect package size or low performance or other error?