Navigation Menu

Skip to content
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

cmake builds with gcc-11 on macOS now permafail #10356

Closed
bagder opened this issue Jan 28, 2023 · 7 comments
Closed

cmake builds with gcc-11 on macOS now permafail #10356

bagder opened this issue Jan 28, 2023 · 7 comments
Labels
CI Continuous Integration cmake help wanted

Comments

@bagder
Copy link
Member

bagder commented Jan 28, 2023

These builds seem to have started to fail on Jan 21, 2023. Before that the cmake builds failed because of homebrew problems but on the 21st the problem changed to seemingly only not work for gcc-11 on mac. Before the homebrew problems (Jan 8), those builds worked fine in the CI.

The three builds are known as

  • macOS / cmake gcc-11 OpenSSL
  • macOS / cmake gcc-11 LibreSSL
  • macOS / cmake gcc-11 libssh2

Example build failure (from here):

[ 28%] Building C object lib/CMakeFiles/libcurl.dir/hmac.c.o
[ 28%] Building C object lib/CMakeFiles/libcurl.dir/hostasyn.c.o
[ 28%] Building C object lib/CMakeFiles/libcurl.dir/hostip.c.o
In file included from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/dispatch.h:28,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:17,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:66,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h:30,
                 from /Users/runner/work/curl/curl/lib/hostip.c:70:
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/object.h:275:1: error: expected ';' before 'extern'
  275 | OS_EXPORT OS_SWIFT_UNAVAILABLE("Can't be used with ARC")
      | ^~~~~~~~~
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/clock.h:14:1: error: expected ';' before 'typedef'
   14 | OS_ENUM(os_clockid, uint32_t,
      | ^~~~~~~
In file included from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/workgroup.h:29,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/dispatch.h:64,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:17,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:66,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h:30,
                 from /Users/runner/work/curl/curl/lib/hostip.c:70:
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/workgroup_base.h:67:1: error: expected ';' before 'struct'
   67 | struct OS_REFINED_FOR_SWIFT os_workgroup_attr_opaque_s {
      | ^~~~~~
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/workgroup_base.h:83:1: error: unknown type name 'OS_ASSUME_PTR_ABI_SINGLE_END'; did you mean 'OS_OBJECT_ASSUME_ABI_SINGLE_END'?
   83 | OS_WORKGROUP_ASSUME_ABI_SINGLE_END
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/dispatch.h:63,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:17,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:66,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h:30,
                 from /Users/runner/work/curl/curl/lib/hostip.c:70:
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/workgroup_object.h:49:1: error: expected ';' before 'typedef'
   49 | OS_WORKGROUP_DECL(os_workgroup, WorkGroup);
      | ^~~~~~~~~~~~~~~~~
In file included from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/workgroup.h:30,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/dispatch.h:64,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:17,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:66,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h:30,
                 from /Users/runner/work/curl/curl/lib/hostip.c:70:
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/workgroup_object.h:118:83: error: expected ';', ',' or ')' before 'name'
  118 | os_workgroup_create_with_port(const char *OS_WORKGROUP_UNSAFE_INDEXABLE _Nullable name, mach_port_t mach_port);
      |                                                                                   ^~~~
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/workgroup_object.h:139:89: error: expected ';', ',' or ')' before 'name'
  139 | os_workgroup_create_with_workgroup(const char * OS_WORKGROUP_UNSAFE_INDEXABLE _Nullable name, os_workgroup_t wg);
      |                                                                                         ^~~~
In file included from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/workgroup.h:29,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/dispatch.h:64,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:17,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:66,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h:30,
                 from /Users/runner/work/curl/curl/lib/hostip.c:70:
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/workgroup_object.h:354:1: error: unknown type name 'OS_ASSUME_PTR_ABI_SINGLE_END'; did you mean 'OS_OBJECT_ASSUME_ABI_SINGLE_END'?
  354 | OS_WORKGROUP_ASSUME_ABI_SINGLE_END
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/workgroup_interval.h:152:1: error: unknown type name 'OS_ASSUME_PTR_ABI_SINGLE_END'; did you mean 'OS_OBJECT_ASSUME_ABI_SINGLE_END'?
  152 | OS_WORKGROUP_ASSUME_ABI_SINGLE_END
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/workgroup.h:32,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/dispatch.h:64,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:17,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:66,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h:30,
                 from /Users/runner/work/curl/curl/lib/hostip.c:70:
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/workgroup_parallel.h:68:82: error: expected ';', ',' or ')' before 'name'
   68 | os_workgroup_parallel_create(const char *OS_WORKGROUP_UNSAFE_INDEXABLE _Nullable name,
      |                                                                                  ^~~~
In file included from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/dispatch.h:65,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:17,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:66,
                 from /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h:30,
                 from /Users/runner/work/curl/curl/lib/hostip.c:70:
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/base.h:347:1: error: expected ';' before 'typedef'
  347 | typedef void (*dispatch_function_t)(void *_Nullable);
      | ^~~~~~~
make[2]: *** [lib/CMakeFiles/libcurl.dir/hostip.c.o] Error 1
make[1]: *** [lib/CMakeFiles/libcurl.dir/all] Error 2
make: *** [all] Error 2
@bagder bagder added cmake CI Continuous Integration labels Jan 28, 2023
@bagder bagder changed the title cmake builds with gcc-11 on macOS now permail cmake builds with gcc-11 on macOS now permafail Jan 28, 2023
@bagder
Copy link
Member Author

bagder commented Jan 29, 2023

I honestly have no clue what this is.

@pheiduck
Copy link
Contributor

pheiduck commented Jan 31, 2023

Xcode 14.0.1 does not reproduce this errors. So it happen on 14.1 and 14.2. Not sure if this is fixed in 14.3.

@bagder
Copy link
Member Author

bagder commented Jan 31, 2023

ah!

@pheiduck
Copy link
Contributor

@bagder bagder closed this as completed in 92d4053 Feb 1, 2023
bch pushed a commit to bch/curl that referenced this issue Jul 19, 2023
vszakats added a commit to curl/curl-for-win that referenced this issue Oct 15, 2023
Specifically gcc provided via Homebrew. This package doesn't ship with
binutils, so for now this build mode relies on Xcode tools. This means
they suffer from the same reproducibility bugs as Apple clang builds.

Must supply this to enable:
export CW_CCSUFFIX='-13'

Optional:
export CW_CONFIG='-gcc'

Follow-up to 5add616

Build is broken with the latest Xcode and CommandLineTools,
due to this:
  curl/curl#10356

```
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/dispatch/dispatch.h:28,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:17,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:66,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h:30,
                 from .../curl/lib/macos.c:33,
                 from .../curl/bld-cmake-gcc-x64-sys/lib/CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c:241:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/os/object.h:275:1: error: expected ';' before 'extern'
  275 | OS_EXPORT OS_SWIFT_UNAVAILABLE("Can't be used with ARC")
      | ^~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/os/clock.h:14:1: error: expected ';' before 'typedef'
   14 | OS_ENUM(os_clockid, uint32_t,
      | ^~~~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/os/workgroup.h:29,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/dispatch/dispatch.h:64:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/os/workgroup_base.h:67:1: error: expected ';' before 'struct'
   67 | struct OS_REFINED_FOR_SWIFT os_workgroup_attr_opaque_s {
      | ^~~~~~
[...]
```

The root cause is not Xcode itself but the default SDK it's pointing to.
With SDK 12 it compiles without error. The failure above is with SDK 13,
the default SDK since Xcode 14.
vszakats added a commit to curl/curl-for-win that referenced this issue Oct 15, 2023
@vszakats
Copy link
Member

vszakats commented Oct 15, 2023

The issue is not with Xcode 14.1 per se, but with the macOS SDK 13,
which became the default with 14.1.

I could fix this error by building against SDK 12.

With CMake, this can be done with:

cmake -DCMAKE_OSX_SYSROOT=$(xcrun -sdk macosx --show-sdk-path | sed 's/\.sdk/12.sdk/') [...]

See: curl/curl-for-win@e2db3c4

It means we could upgrade to the latest Xcode and set the above
for gcc tests.

@pheiduck
Copy link
Contributor

The issue is not with Xcode 14.1 per se, but with the macOS SDK 13, which became the default with 14.1.

I could fix this error by building against SDK 12.

With CMake, this can be done with:

cmake -DCMAKE_OSX_SYSROOT=$(xcrun -sdk macosx --show-sdk-path | sed 's/\.sdk/12.sdk/') [...]

See: curl/curl-for-win@e2db3c4

It means we could upgrade to the latest Xcode and set the above for gcc tests.

I was testing it againist 14.2 which is now the default on macOS CI but it still fails

@vszakats
Copy link
Member

vszakats commented Dec 25, 2023

Sorry if my post was unclear, but I didn't say that Xcode 14.2 would fix this. This could only be true if Apple fixed their latest default SDKs to be gcc-compatible. Till this happens, the workaround is to force building against an older SDK that is compatible with gcc, e.g. SDK 12. This needs that SDK to be present, then CMake needs to be told to use it instead of the default.

Here's the code doing that in curl-for-win:
https://github.com/curl/curl-for-win/blob/6b9d6d25bbd1f6db5e1344a8c52b5a875f18d284/_build.sh#L1188-L1210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration cmake help wanted
Development

Successfully merging a pull request may close this issue.

3 participants