RainerKuemmerle / g2o

g2o: A General Framework for Graph Optimization
3.08k stars 1.11k forks source link

Not compiling in Android Studio with gcc for ARM architectures #271

Open dooxe opened 6 years ago

dooxe commented 6 years ago

Hello, When I try to compile g2o for android with gcc for ARM architectures, I have the following error :

arm-linux-androideabi-gcc: error: unrecognized command line option '-msse2'
arm-linux-androideabi-gcc: error: unrecognized command line option '-msse3'
arm-linux-androideabi-gcc: error: unrecognized command line option '-msse4.1'
arm-linux-androideabi-gcc: error: unrecognized command line option '-msse4.2'

The solution I found to solve the problem is to remove this options like the following in the CMakeLists.txt : Before correction :

DEFINE_SSE_VAR(SSE2)
DEFINE_SSE_VAR(SSE3)
DEFINE_SSE_VAR(SSE4_1)
DEFINE_SSE_VAR(SSE4_2)
DEFINE_SSE_VAR(SSE4_A)

After correction :

IF(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
    DEFINE_SSE_VAR(SSE2)
    DEFINE_SSE_VAR(SSE3)
    DEFINE_SSE_VAR(SSE4_1)
    DEFINE_SSE_VAR(SSE4_2)
    DEFINE_SSE_VAR(SSE4_A)
ENDIF()
RainerKuemmerle commented 6 years ago

I think you should try setting DO_SSE_AUTODETECT to false in your cmake build config.

jinkailong888 commented 5 years ago

Scanning dependencies of target csparse [ 0%] Building C object EXTERNAL/csparse/CMakeFiles/csparse.dir/cs_add.c.o arm-linux-androideabi-gcc: error: unrecognized command line option '-msse2' arm-linux-androideabi-gcc: error: unrecognized command line option '-msse3' arm-linux-androideabi-gcc: error: unrecognized command line option '-mssse3' arm-linux-androideabi-gcc: error: unrecognized command line option '-msse4.1' arm-linux-androideabi-gcc: error: unrecognized command line option '-msse4.2' arm-linux-androideabi-gcc: error: unrecognized command line option '-msse4a' EXTERNAL/csparse/CMakeFiles/csparse.dir/build.make:62: recipe for target 'EXTERNAL/csparse/CMakeFiles/csparse.dir/cs_add.c.o' failed make[2]: [EXTERNAL/csparse/CMakeFiles/csparse.dir/cs_add.c.o] Error 1 CMakeFiles/Makefile2:103: recipe for target 'EXTERNAL/csparse/CMakeFiles/csparse.dir/all' failed make[1]: [EXTERNAL/csparse/CMakeFiles/csparse.dir/all] Error 2 Makefile:149: recipe for target 'all' failed make: *** [all] Error 2