Menu

Issues GNU compile for Android

ZSO
2017-04-05
2017-04-05
  • ZSO

    ZSO - 2017-04-05

    When I try to compile the library for Android I find the following bugs and errors (MSVS 2017 ):

    General bugs and corrections:

    a) bug in the code: in SimdInit.h at line 139 there is an extra } in the middle of the line which must be removed.

    b) In SimdView.hpp in functions template <class A=""> SIMD_INLINE bool View<A>::Load(const std::string & path) and template <class A=""> SIMD_INLINE bool View<A>::Save(const std::string & path) const
    the following must be added:

    #ifdef __GNUC__
            std::ifstream ifs(path.c_str(), std::ifstream::binary);
    #else
            std::ifstream ifs(path, std::ifstream::binary); 
    #endif//__GNUC__
    

    c) the "-lm" option must be added to the linker (it does not find the math functions).

    Platform problems

    I am not sure if this is a problem with Simd or MSVS!? Is there an other way to compile a Dynamic Library (.so) for Android?

    Compile for x86:

    Command line parameters: "-fpic "pch.h" -fstack-protector "x86\Release\" -Wall -fno-strict-aliasing -ffunction-sections -I "C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\platforms\android-19\arch-x86\usr\include" -I "C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\sources\cxx-stl\gnu-libstdc++\4.9\include" -I "C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\sources\cxx-stl\gnu-libstdc++\4.9\libs\x86\include" -I "C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\sources\cxx-stl\gnu-libstdc++\4.9\include\backward" -gline-tables-only -O3 -x c++-header -D "NDEBUG" -fno-rtti -fomit-frame-pointer -fdata-sections -fexceptions -o "x86\Release\%(filename).o" -fno-short-enums "

    66 Error messages in SimdConst.h with too many initializer values:
    Severity Code Description Project File Line Suppression State
    Error (active) E0146 too many initializer values SimdConst.h 100

    The project compiles but shows the error messages above.

    Compile for ARM:

    Command line parameters: "-o"Android_Simd.so" -Wl,-rpath-link="C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\platforms\android-19\arch-arm\usr\lib" -Wl,-z,relro -shared -Wl,-z,noexecstack -Wl,--no-undefined -l"gnustl_static" -l"log" -l"android" -Wl,-L"C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\platforms\android-19\arch-arm\usr\lib" -Wl,-L"C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x\armv7-a" -Wl,-L"C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a" -Wl,-z,now "

    1 fatal error: simd/SimdEnable.h(44,10): fatal error : 'sys/auxv.h' file not found
    #include <sys/auxv.h>

    1 error message: Severity Code Description Project File Line Suppression State
    Error (active) E0020 identifier "__fp16" is undefined c:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\3.8.256229\include\arm_neon.h 34

    60 Error messages in SimdConst.h with too many initializer values:
    Severity Code Description Project File Line Suppression State
    Error (active) E0146 too many initializer values SimdConst.h 488

    The project does not compile.

    Compile for ARM64:

    Command line parameters: " -o"Android_Simd.so" -Wl,-rpath-link="C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\platforms\android-21\arch-arm64\usr\lib" -Wl,-z,relro -shared -Wl,-z,noexecstack -Wl,--no-undefined -l"gnustl_static" -l"log" -l"android" -Wl,-L"C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\platforms\android-21\arch-arm64\usr\lib" -Wl,-L"C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\toolchains\aarch64-linux-android-4.9\prebuilt\windows-x86_64\lib\gcc\aarch64-linux-android\4.9.x" -Wl,-L"C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\sources\cxx-stl\gnu-libstdc++\4.9\libs\arm64-v8a" -Wl,-z,now "

    1 error message: Severity Code Description Project File Line Suppression State
    Error (active) E0020 identifier "__int128" is undefined c:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\sources\cxx-stl\gnu-libstdc++\4.9\include\cstdlib 178

    1 error message: Severity Code Description Project File Line Suppression State
    Error (active) E0020 identifier "__int128" is undefined c:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b\sources\cxx-stl\gnu-libstdc++\4.9\include\cstdlib 179

    The above is in the code:

    #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
      inline __int128
      abs(__int128 __x) { return __x >= 0 ? __x : -__x; }
    #endif
    

    The project compiles but shows the error messages above.

     

    Last edit: ZSO 2017-04-05
  • Yermalayeu Ihar

    Yermalayeu Ihar - 2017-04-06

    Thank you for bug report.

    I have added a Visual Studio solution for Android.
    It is placed in prj/vs2017a.

     
    • ZSO

      ZSO - 2017-04-07

      Thank you Ihar!
      The projects compile now without errors in VS2017 but strangely there are still many errors showing up when opening some of the files in the editor as e.g. SimdConst.h (many of the errors I have mentioned above). Do you have any idea why this is happening and if this will influece the working of the software?
      Best regards, Zoltan

       
      • Yermalayeu Ihar

        Yermalayeu Ihar - 2017-04-07

        I think it happens because Visual Studio and GCC(Clang) have different internal representation of SIMD vectors. In my project I use special macros for initialization of global constant vectors which use internal vector representation and don't use SIMD instructions. I do this because global constant vectors are initilaized before checking of supporting SIMD by CPU.

        When you use Visual Studio to create Android application you use Visual Studio editor and Clang(GCC) compiler. And the last one defines platform specific macros which incorrect processed by Visual Studio editor.

         

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.