Skip to content

Unable to build on macOS with gcc11.5 #1819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
gevorgyaned opened this issue Mar 17, 2025 · 1 comment
Open

Unable to build on macOS with gcc11.5 #1819

gevorgyaned opened this issue Mar 17, 2025 · 1 comment

Comments

@gevorgyaned
Copy link

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?

@yuxiang-wen
Copy link

yuxiang-wen commented Mar 17, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants