awslabs / aws-crt-cpp

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.
Apache License 2.0
73 stars 64 forks source link

Build Issue with M1 MacOS and GCC #605

Closed muboheng closed 5 months ago

muboheng commented 5 months ago

Describe the bug

I am trying to compile on my MacOS 14.3.1 with GCC 13.2.0 but ran into errors.

Expected Behavior

build successfully

Current Behavior

I get the Issue:

/ghRepos/aws-crt-cpp/crt/aws-c-cal/source/darwin/commoncrypto_aes.c: In function 's_cc_crypto_gcm_finalize':
/ghRepos/aws-crt-cpp/crt/aws-c-cal/source/darwin/commoncrypto_aes.c:371:9: warning: implicit declaration of function '__builtin_available'; did you mean '__builtin_scalbl'? [-Wimplicit-function-declaration]
  371 |     if (__builtin_available(macOS 10.13, iOS 11.0, *)) {
      |         ^~~~~~~~~~~~~~~~~~~
      |         __builtin_scalbl
/ghRepos/aws-crt-cpp/crt/aws-c-cal/source/darwin/commoncrypto_aes.c:371:29: error: 'macOS' undeclared (first use in this function)
  371 |     if (__builtin_available(macOS 10.13, iOS 11.0, *)) {
      |                             ^~~~~
/ghRepos/aws-crt-cpp/crt/aws-c-cal/source/darwin/commoncrypto_aes.c:371:29: note: each undeclared identifier is reported only once for each function it appears in
/ghRepos/aws-crt-cpp/crt/aws-c-cal/source/darwin/commoncrypto_aes.c:371:34: error: expected ')' before numeric constant
  371 |     if (__builtin_available(macOS 10.13, iOS 11.0, *)) {
      |                            ~     ^~~~~~
      |                                  )

Reproduction Steps

steps performed:

git clone --recursive https://github.com/awslabs/aws-crt-cpp.git 
mkdir build && cd build
cmake -DCMAKE_C_COMPILER=/opt/homebrew/bin/gcc-13 -DCMAKE_CXX_COMPILER=/opt/homebrew/bin/g++-13 -DCMAKE_OSX_ARCHITECTURES=arm64 ..
make

Possible Solution

No response

Additional Information/Context

I was able to build with apple clang 15.0.0, but I need to work with gcc

aws-crt-cpp version used

latest: https://github.com/awslabs/aws-crt-cpp/commit/4d9e36d561079506272cff59b52d998b6ae81e85

Compiler and version used

gcc version 13.2.0 (Homebrew GCC 13.2.0)

Operating System and version

macOS Sonoma 14.3.1

DmitriyMusatkin commented 5 months ago

Any particular reason why you want to use GCC over clang? CRT relies on specific clang extensions to check for api availability. Besides that GCC would struggle on some Apple headers that CRT includes that rely on Apple Clang extensions.

github-actions[bot] commented 5 months ago

Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.