rabbitmq / rabbitmq-objc-client

RabbitMQ client for Objective-C and Swift
https://rabbitmq.com
Other
242 stars 85 forks source link

carthage bootstrap fails with The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.10, but the range of supported deployment target versions is 10.13 to 14.4.99 #231

Open eliaSchenker opened 7 months ago

eliaSchenker commented 7 months ago

Describe the bug

If installed using carthage (as per the installation guide), a build error occurs for the CocoaAsyncSocket dependency:

The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.10, but the range of supported deployment target versions is 10.13 to 14.4.99. (in target 'Mac CocoaAsyncSocket' from project 'CocoaAsyncSocket')

If the build command that carthage executes is run manually for the other dependency (JKVValue) the archive succeeds, could this be an issue with the CocoaAsyncSocket dependency?

Reproduction steps

Follow carthage installation steps in repostiory (https://github.com/rabbitmq/rabbitmq-objc-client?tab=readme-ov-file#installation-with-carthage):

  1. Add to Cartfile
  2. Run carthage bootstrap

Expected behavior

Setup using carthage shouldn't fail

Additional context

package version

v0.12.0 (latest)

macOS

14.2.1 (23C71)

swift version

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0

uname -a:

Darwin MacBook-Pro-3 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:55:06 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6020 arm64
michaelklishin commented 7 months ago

I can confirm but have no idea what is the root cause or how to resolve this. A pull request that updates Carthage (or the way we use it) would be appreciated.

michaelklishin commented 7 months ago

I don't see anything directly relevant in the CocoaAsyncSocket repo (discussions, issues, recent commits).

If this library and CocoaAsyncSocket have different deployment target requirements, we can lower ours (which I bump every so often since I don't test on 5 year old versions and such) to match.

eliaSchenker commented 7 months ago

@michaelklishin I don't think lowering the target of this package would be a good idea as it's no longer supported on newer systems (/newer version of Xcode). The fact that CocoaAsyncSocket's target is lower than the one of this library doesn't seem to matter much, the problem is that CocoaAsyncSocket's target is outdated (and therefore xcodebuild refuses to compile with it)

I did find this pull request in CocoaAsyncSocket, https://github.com/robbiehanson/CocoaAsyncSocket/pull/830, which has unfortunately been marked as stale (do you know if the repo is still being actively maintained?). It seems that they would have to increase their deployment target (to 10.13, which is the lowest supported) for the issue to be resolved.

eliaSchenker commented 7 months ago

We may have a similar problem with the other dependency (JKVValue, where the deployment target is even lower (10.9). Same applies to the iOS target (for both dependencies)

eliaSchenker commented 7 months ago

I tried to create a temporary workaround to this issue locally by first updating carthage without building, overriding the deployment targets of the dependencies and then building:

carthage update --no-build
sed -i -e 's/MACOSX_DEPLOYMENT_TARGET = 10.10/MACOSX_DEPLOYMENT_TARGET = 10.13/g' ./Carthage/Checkouts/CocoaAsyncSocket/CocoaAsyncSocket.xcodeproj/project.pbxproj
sed -i -e 's/MACOSX_DEPLOYMENT_TARGET = 10.9/MACOSX_DEPLOYMENT_TARGET = 10.13/g' ./Carthage/Checkouts/JKVValue/JKVValue.xcodeproj/project.pbxproj
carthage build --platform macOS,iOS

When using carthage without the --use-xcframeworks (as per this repos readme, which is not recommended by carthage https://github.com/Carthage/Carthage?tab=readme-ov-file#building-platform-independent-xcframeworks-xcode-12-and-above) the build fails:

Building universal frameworks with common architectures is not possible. The device and simulator slices for "CocoaAsyncSocket" both build for: arm64
Rebuild with --use-xcframeworks to create an xcframework bundle instead.

I'm assuming this is because I'm on a newer silicon mac which the old method doesn't support. Maybe this repo should migrate to using XCFramework' (https://github.com/Carthage/Carthage?tab=readme-ov-file#migrating-a-project-from-framework-bundles-to-xcframeworks)?