Skip to content

Develop branch failed when cross-compiling for Android #6375

@Xreki

Description

@Xreki

My cmake command:

    ANDROID_ABI=armeabi-v7a
    cmake -DCMAKE_INSTALL_PREFIX=$DEST_ROOT \
          -DTHIRD_PARTY_PATH=$THIRD_PARTY_PATH/$ANDROID_ABI \
          -DCMAKE_SYSTEM_NAME=Android \
          -DANDROID_STANDALONE_TOOLCHAIN=$ANDROID_ARM_STANDALONE_TOOLCHAIN \
          -DANDROID_ABI=$ANDROID_ABI \
          -DANDROID_ARM_NEON=ON \
          -DANDROID_ARM_MODE=ON \
          -DANDROID_TOOLCHAIN=gcc \
          -DCMAKE_BUILD_TYPE=Release \
          -DWITH_C_API=ON \
          -DUSE_EIGEN_FOR_BLAS=ON \
          -DWITH_SWIG_PY=OFF \
          -DWITH_GOLANG=OFF \
          -DWITH_STYLE_CHECK=OFF \
          $SOURCES_ROOT

There are some warning of cmake:

-- Configuring done
CMake Error at cmake/generic.cmake:231 (add_dependencies):
  The dependency target "paddle_gtest_main" of target "test_float16" does not
  exist.
Call Stack (most recent call first):
  paddle/math/tests/CMakeLists.txt:37 (cc_test)


CMake Error at cmake/generic.cmake:231 (add_dependencies):
  The dependency target "paddle_memory" of target "test_float16" does not
  exist.
Call Stack (most recent call first):
  paddle/math/tests/CMakeLists.txt:37 (cc_test)


-- Generating done
-- Build files have been written to: /home/work/liuyiqun/PaddlePaddle/Paddle/build_paddle/build_android

When I use make to build the codes, it was aborted with following error:

[ 75%] Building CXX object paddle/math/tests/CMakeFiles/test_float16.dir/test_float16.cpp.o
In file included from /home/work/liuyiqun/PaddlePaddle/Paddle/paddle/math/tests/test_float16.cpp:12:0:
/home/work/liuyiqun/PaddlePaddle/Paddle/paddle/math/float16.h: In constructor 'paddle::float16::float16(float)':
/home/work/liuyiqun/PaddlePaddle/Paddle/paddle/math/float16.h:106:5: error: 'float16_t' was not declared in this scope
     float16_t res = vget_lane_f16(vcvt_f16_f32(tmp), 0);
     ^
/home/work/liuyiqun/PaddlePaddle/Paddle/paddle/math/float16.h:107:39: error: 'res' was not declared in this scope
     x = *reinterpret_cast<uint16_t*>(&res);
                                       ^
/home/work/liuyiqun/PaddlePaddle/Paddle/paddle/math/float16.h:105:17: error: unused variable 'tmp' [-Werror=unused-variable]
     float32x4_t tmp = vld1q_dup_f32(&val);
                 ^
In file included from /home/work/liuyiqun/PaddlePaddle/Paddle/paddle/math/tests/test_float16.cpp:12:0:
/home/work/liuyiqun/PaddlePaddle/Paddle/paddle/math/float16.h: In member function 'paddle::float16::operator float() const':
/home/work/liuyiqun/PaddlePaddle/Paddle/paddle/math/float16.h:256:59: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
     float16x4_t res = vld1_dup_f16(reinterpret_cast<const float16_t*>(this));
                                                           ^
/home/work/liuyiqun/PaddlePaddle/Paddle/paddle/math/float16.h:256:59: error: expected '>' before 'float16_t'
/home/work/liuyiqun/PaddlePaddle/Paddle/paddle/math/float16.h:256:59: error: expected '(' before 'float16_t'
/home/work/liuyiqun/PaddlePaddle/Paddle/paddle/math/float16.h:256:59: error: 'float16_t' was not declared in this scope
/home/work/liuyiqun/PaddlePaddle/Paddle/paddle/math/float16.h:256:69: error: expected primary-expression before '>' token
     float16x4_t res = vld1_dup_f16(reinterpret_cast<const float16_t*>(this));
                                                                     ^
/home/work/liuyiqun/PaddlePaddle/Paddle/paddle/math/float16.h:257:43: error: 'vcvt_f32_f16' was not declared in this scope
     return vgetq_lane_f32(vcvt_f32_f16(res), 0);
                                           ^
In file included from /home/work/liuyiqun/PaddlePaddle/Paddle/paddle/math/tests/test_float16.cpp:12:0:
/home/work/liuyiqun/PaddlePaddle/Paddle/paddle/math/float16.h:282:3: error: control reaches end of non-void function [-Werror=return-type]
   }
   ^
cc1plus: all warnings being treated as errors
make[2]: *** [paddle/math/tests/CMakeFiles/test_float16.dir/test_float16.cpp.o] Error 1
make[1]: *** [paddle/math/tests/CMakeFiles/test_float16.dir/all] Error 2
make: *** [all] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions