tpoechtrager / osxcross

Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android (Termux)
GNU General Public License v2.0
2.92k stars 329 forks source link

SDK 12.3 not supported #345

Open divVerent opened 2 years ago

divVerent commented 2 years ago

I tried adding SDK 12.3 support like this:

diff --git a/build.sh b/build.sh
index e8d21ec..b373200 100755
--- a/build.sh
+++ b/build.sh
@@ -46,6 +46,7 @@ case $SDK_VERSION in
   11.3*)  TARGET=darwin20.4; X86_64H_SUPPORTED=1; I386_SUPPORTED=0; ARM_SUPPORTED=1; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.9;  ;;
   12.0*)  TARGET=darwin21.1; X86_64H_SUPPORTED=1; I386_SUPPORTED=0; ARM_SUPPORTED=1; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.9;  ;;
   12.1*)  TARGET=darwin21.2; X86_64H_SUPPORTED=1; I386_SUPPORTED=0; ARM_SUPPORTED=1; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.9;  ;;
+  12.3*)  TARGET=darwin21.4; X86_64H_SUPPORTED=1; I386_SUPPORTED=0; ARM_SUPPORTED=1; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.9;  ;;
  *) echo "Unsupported SDK"; exit 1 ;;
 esac

This compiles and installs fine, but compiling stuff fails with errors like:

/home/rpolzer/homedir/src/osxcross-sdk/bin/../SDK/MacOSX12.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:91:143: error: function does not return NSString
- (NSAttributedString *)localizedAttributedStringForKey:(NSString *)key value:(nullable NSString *)value table:(nullable NSString *)tableName NS_FORMAT_ARGUMENT(1) NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
                                                         ~~~~~~~~~~~~~~                                                                       ^                  ~
/home/rpolzer/homedir/src/osxcross-sdk/bin/../SDK/MacOSX12.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:103:48: note: expanded from macro 'NS_FORMAT_ARGUMENT'
        #define NS_FORMAT_ARGUMENT(A) __attribute__ ((format_arg(A)))
                                                      ^          ~
In file included from ../../go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20220514210836-eae9d2d3f5b7/native_darwin.go:7:
In file included from ./glfw/include/GLFW/glfw3native.h:95:
In file included from /home/rpolzer/homedir/src/osxcross-sdk/bin/../SDK/MacOSX12.3.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /home/rpolzer/homedir/src/osxcross-sdk/bin/../SDK/MacOSX12.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:130:
/home/rpolzer/homedir/src/osxcross-sdk/bin/../SDK/MacOSX12.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLSession.h:500:168: error: expected ')'
- (void)readDataOfMinLength:(NSUInteger)minBytes maxLength:(NSUInteger)maxBytes timeout:(NSTimeInterval)timeout completionHandler:(void (^) (NSData * _Nullable_result data, BOOL atEOF, NSError * _Nullable error))completionHandler;
                                                                                                                                                                       ^
/home/rpolzer/homedir/src/osxcross-sdk/bin/../SDK/MacOSX12.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLSession.h:500:141: note: to match this '('
- (void)readDataOfMinLength:(NSUInteger)minBytes maxLength:(NSUInteger)maxBytes timeout:(NSTimeInterval)timeout completionHandler:(void (^) (NSData * _Nullable_result data, BOOL atEOF, NSError * _Nullable error))completionHandler;
                                                                                                                                            ^
2 errors generated.
divVerent commented 2 years ago

Also, would be nice to document how to even get the supported SDK versions - "just download the latest Xcode" does not work. Like, which Xcode has which SDK versions included?

akien-mga commented 2 years ago

The missing support for 12.3 was fixed in #344. It works fine for me in my use cases.

So I think the compile errors you're having might be due to actual incompatibility between your code and what MacOSX12.3 expects.

Bluebugs commented 2 years ago

The problem seems to be that MacOS X expectation of clang and the clang used to compile are not aligned. A work around is to override NS_FORMAT_ARGUMENT(A) ( -DNS_FORMAT_ARGUMENT(A)= or #define NS_FORMAT_ARGUMENT(A) ) to do nothing and this solve the problem. A better permanent fix would be better, but I do not have any understanding of how osxcross actually work.

Bluebugs commented 2 years ago

To solve the problem, updating LLVM from v12 to v14 fixed it.

akien-mga commented 9 months ago

@tpoechtrager This can be closed as fixed by https://github.com/tpoechtrager/osxcross/pull/344.