Issue
Recently I am trying to use SiftGPU in Android. I am using the Linux. So, first I download a ndk and use the following code to get a standalone toolchain:
sudo sh ./build/tools/make-standalone-toolchain.sh --verbose --platform=android-15 --install-dir=/home/YourUserName/Downloads/my-tool --toolchain=arm-linux-androideabi-4.9
Then, I add the some codes to the CmakeLists.txt so it becomes:
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(SIFTGPU C CXX)
set(NDK_STANDALONE_TOOLCHAIN /home/YourUserName/Downloads/my-tool/)
set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_SYSTEM_VERSION 15)
set(CMAKE_C_COMPILER ${NDK_STANDALONE_TOOLCHAIN}/bin/arm-linux-androideabi-gcc)
set(CMAKE_CXX_COMPILER ${NDK_STANDALONE_TOOLCHAIN}/bin/arm-linux-androideabi-g++)
set(CMAKE_ANDROID_ARCH_ABI armeabi-v7a)
set(CMAKE_FIND_ROOT_PATH ${NDK_STANDALONE_TOOLCHAIN})
add_definitions("--sysroot=${NDK_STANDALONE_TOOLCHAIN}/sysroot")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings -Wno-unused-result -Wno-deprecated -fPIC")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-write-strings -Wno-unused-result -Wno-deprecated -fPIC")
ADD_SUBDIRECTORY(src)
After that, I simply go to the directory of SiftGPU, create a new folder, enter it, and run:
cmake ..
Until now, everything seems ok. However, after I run the following command, well, unfortunately, it doesn't work:
make
And here is the error:
[ 9%] Building CXX object src/SiftGPU/CMakeFiles/siftgpu.dir/FrameBufferObject.cpp.o
arm-linux-androideabi-g++: error: unrecognized argument in option '-march=core2'
arm-linux-androideabi-g++: note: valid arguments to '-march=' are: armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6 armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m armv7-r armv7e-m armv7ve armv8-a armv8-a+crc iwmmxt iwmmxt2 native
arm-linux-androideabi-g++: error: unrecognized command line option '-mfpmath=sse'
src/SiftGPU/CMakeFiles/siftgpu.dir/build.make:62: recipe for target 'src/SiftGPU/CMakeFiles/siftgpu.dir/FrameBufferObject.cpp.o' failed
make[2]: *** [src/SiftGPU/CMakeFiles/siftgpu.dir/FrameBufferObject.cpp.o] Error 1
CMakeFiles/Makefile2:103: recipe for target 'src/SiftGPU/CMakeFiles/siftgpu.dir/all' failed
make[1]: *** [src/SiftGPU/CMakeFiles/siftgpu.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
I tried to google it but I didn't get any useful result. It seems that the ndk complier is not compatible with SSE. Does anyone have any idea about this question?
Solution
Looks like their CMake files weren't meant to be cross-compiled.
arm-linux-androideabi-g++: error: unrecognized argument in option '-march=core2'
core2 is only valid for x86.
You'll need to take a look through SiftGPU's CMakeLists.txt to see if there are options for cross-compiling, and if not, just remove that flag.
Answered By - Dan Albert
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.