Mbed-TLS / mbedtls

An open source, portable, easy to use, readable and flexible TLS library, and reference implementation of the PSA Cryptography API. Releases are on a varying cadence, typically around 3 - 6 months between releases.
https://www.trustedfirmware.org/projects/mbed-tls/
Other
5.54k stars 2.6k forks source link

Android cmake arm64-v8a error: unknown pragma ignored [-Werror,-Wunknown-pragmas] #7511

Open zhoucater opened 1 year ago

zhoucater commented 1 year ago

Summary

mbedtls/library/aesce.c:71:22: error: unknown pragma ignored [-Werror,-Wunknown-pragmas]
  #       pragma clang attribute push (__attribute__((target("crypto"))), apply_to=function)
                       ^
mbedtls/src/main/CPP/charmbedtls/library/aesce.c:431:15: error: unknown pragma ignored [-Werror,-Wunknown-pragmas]

System information

Mbed TLS version (number or commit id): Operating system and version: Configuration (if not default, please attach mbedtls_config.h): Compiler and options (if you used a pre-built binary, please indicate how you obtained it): Additional environment information:

Expected behavior

Actual behavior

Steps to reproduce

Additional information

zhoucater commented 1 year ago

clang.exe version must >=8.0 ,NDK version >= 20.xx

/* Compiler version checks. */
#if defined(__clang__)
#   if __clang_major__ < 4
#       error "Minimum version of Clang for MBEDTLS_AESCE_C is 4.0."
#   endif
#elif defined(__GNUC__)
#   if __GNUC__ < 6
#       error "Minimum version of GCC for MBEDTLS_AESCE_C is 6.0."
#   endif
#elif defined(_MSC_VER)
/* TODO: We haven't verified MSVC from 1920 to 1928. If someone verified that,
 *       please update this and document of `MBEDTLS_AESCE_C` in
 *       `mbedtls_config.h`. */
#   if _MSC_VER < 1929
#       error "Minimum version of MSVC for MBEDTLS_AESCE_C is 2019 version 16.11.2."
#   endif
#endif
yuhaoth commented 1 year ago

@zhoucater thanks your report.

I just update description and your comment. The format looks not friendly for me.

yuhaoth commented 1 year ago

clang.exe version must >=8.0 ,NDK version >= 20.xx

Is it environment that can reproduce the issue?

With Clang 4.0, I can not reproduce the issue

yuhaoth commented 1 year ago

I could not reproduce the issue, @zhoucater Could you share more information?

I tried Android-ndk-r19c-linux. That is first aarch64-clang version on the Android download page.

I test is with below scripts

export PATH=/path/to/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/:$PATH
scripts/config.py full
CC=aarch64-linux-android21-clang AR=aarch64-linux-android-ar make lib -j20
size library/aesce.o