Reputation: 545
I am learning how to write C++ code using OpenCV and I want to run it in Android. I use Android Studio.
I have created a new simple project with C++ support and then I added my test code to the C++ file. My own files compile and link, it seems.
Now something else that I don't think is related to my project is causing many errors. It seems to be something inside NDK. Could it be a bug in the latest version, and if so, what can I do about it?
C:/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin\ld: error: C:/Android/OpenCV-android-sdk/sdk/native/3rdparty/libs/x86/libippicv.a(jmp_icvippiCopyConstBorder_8u_C4IR_L_as.s.o): relocation R_386_GOTOFF against preemptible symbol icv_ippJumpIndexForMergedLibs cannot be used when making a shared object
C:/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin\ld: error: C:/Android/OpenCV-android-sdk/sdk/native/3rdparty/libs/x86/libippicv.a(jmp_icvippiConvert_32s16u_C1RSfs_as.s.o): relocation R_386_GOTOFF against preemptible symbol icv_ippJumpIndexForMergedLibs cannot be used when making a shared object
C:/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin\ld: error: C:/Android/OpenCV-android-sdk/sdk/native/3rdparty/libs/x86/libippicv.a(jmp_icvippiNormRel_L1_32f_C1R_as.s.o): relocation R_386_GOTOFF against preemptible symbol icv_ippJumpIndexForMergedLibs cannot be used when making a shared object
C:/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin\ld: error: C:/Android/OpenCV-android-sdk/sdk/native/3rdparty/libs/x86/libippicv.a(jmp_icvippiFilterBilateralBorderInit_L_as.s.o): relocation R_386_GOTOFF against preemptible symbol icv_ippJumpIndexForMergedLibs cannot be used when making a shared object
C:/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin\ld: error: C:/Android/OpenCV-android-sdk/sdk/native/3rdparty/libs/x86/libippicv.a(jmp_icvippiScaleC_32f8u_C1R_as.s.o): relocation R_386_GOTOFF against preemptible symbol icv_ippJumpIndexForMergedLibs cannot be used when making a shared object
Upvotes: 5
Views: 834
Reputation: 461
Instead of downgrading to NDK14 from NDK16 you can still do with NDK16 by adding following to the CMakeLists.txt
before add_library()
:
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a")
Copied from this discussion on a github issue
Upvotes: 2
Reputation: 545
I reverted to NDK 14.1.3816874 instead of using the currently latest NDK 16.1.4479499, and the errors have disappeared.
The older NDK you can find here: https://developer.android.com/ndk/downloads/older_releases.html
I hope this helps!
Upvotes: 1