Skip to content

Unable to build on macOS with gcc11.5 #1819

@gevorgyaned

Description

@gevorgyaned

Hi, attempting to build cpprestsdk on macOS using gcc11.5 results in build error, originating from macOS system header files.

The main error part:

In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/Availability.h:136, from /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/time.h:68, from /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/pthread.h:57, from /var/folders/c8/bmp12r395b57hq38dcd6gp5c0000rp/T/a3h5k/cpprestsdk-2.10.18/Release/src/pch/stdafx.h:47, from /var/folders/c8/bmp12r395b57hq38dcd6gp5c0000rp/T/a3h5k/cpprestsdk-2.10.18/Release/src/http/client/x509_cert_utilities.cpp:14: /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h: At global scope: /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h:126:70: error: attributes are not allowed on a function-definition 126 | CF_INLINE CFOptionFlags CFUserNotificationCheckBoxChecked(CFIndex i) API_AVAILABLE(macos(10.0)) API_UNAVAILABLE(ios, watchos, tvos) {return ((CFOptionFlags)(1UL << (8 + i)));} | ^~~~~~~~~~~~~ /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h:127:70: error: attributes are not allowed on a function-definition 127 | CF_INLINE CFOptionFlags CFUserNotificationSecureTextField(CFIndex i) API_AVAILABLE(macos(10.0)) API_UNAVAILABLE(ios, watchos, tvos) {return ((CFOptionFlags)(1UL << (16 + i)));} | ^~~~~~~~~~~~~ /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h:128:69: error: attributes are not allowed on a function-definition 128 | CF_INLINE CFOptionFlags CFUserNotificationPopUpSelection(CFIndex n) API_AVAILABLE(macos(10.0)) API_UNAVAILABLE(ios, watchos, tvos) {return ((CFOptionFlags)(n << 24));} |

It seems that GCC does not support function attributes (API_AVAILABLE, API_UNAVAILABLE) being placed after the function definition. Could this be a known limitation or there is a workaround for this problem?

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