fyne-io / fyne-cross

Cross compiler tool for Fyne apps
BSD 3-Clause "New" or "Revised" License
249 stars 51 forks source link

darwin-amd64 Command Line Tools for Xcode 15 fails to compile on linux-amd64 #212

Open Antiarchitect opened 1 year ago

Antiarchitect commented 1 year ago

Describe the bug:

darwin target won't compile on linux host

To Reproduce:

Steps to reproduce the behaviour:

  1. Download Command Line Tools: https://download.developer.apple.com/Developer_Tools/Command_Line_Tools_for_Xcode_15/Command_Line_Tools_for_Xcode_15.dmg
  2. Import it with darwin-sdk-extract
  3. fyne-cross darwin -macosx-sdk-path /path/to/extractd/SDKs/MacOSX14.0.sdk/ -name some.app ./cmd/someapp/

Device and debug info (please complete the following information):

Device info
In file included from /go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20231102141658-eca20e8abded/native_darwin.go:7:
In file included from ./glfw/include/GLFW/glfw3native.h:108:
In file included from /sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:13:
In file included from /sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:6:
/sdk/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:402:114: error: function does not return string type
- (nullable instancetype)initWithCString:(const char *)nullTerminatedCString encoding:(NSStringEncoding)encoding NS_FORMAT_ARGUMENT(1);
                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                     ^                  ~
/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-20231102141658-eca20e8abded/native_darwin.go:7:
In file included from ./glfw/include/GLFW/glfw3native.h:108:
In file included from /sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:13:
In file included from /sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:6:
/sdk/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:403:97: error: function does not return string type
+ (nullable instancetype)stringWithCString:(const char *)cString encoding:(NSStringEncoding)enc NS_FORMAT_ARGUMENT(1);
                                                  ~~~~~~~~~~~~~~                                ^                  ~
/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-20231102141658-eca20e8abded/native_darwin.go:7:
In file included from ./glfw/include/GLFW/glfw3native.h:108:
In file included from /sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:93:
In file included from /sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:15:
In file included from /sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:23:
In file included from /sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:20:
In file included from /sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:87:
In file included from /sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Components.h:26:
In file included from /sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Files.h:56:
In file included from /sdk/System/Library/Frameworks/DiskArbitration.framework/Headers/DADisk.h:28:
In file included from /sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:49:
/sdk/System/Library/Frameworks/IOKit.framework/Headers/IOTypes.h:81:49: error: expected ';' after top level declarator
typedef mach_vm_address_t       IOVirtualAddress __kernel_ptr_semantics;
                                                ^
In file included from /go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20231102141658-eca20e8abded/native_darwin.go:7:
In file included from ./glfw/include/GLFW/glfw3native.h:108:
In file included from /sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:93:
In file included from /sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:15:
In file included from /sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:23:
In file included from /sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:20:
In file included from /sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:87:
In file included from /sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Components.h:26:
In file included from /sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Files.h:56:
In file included from /sdk/System/Library/Frameworks/DiskArbitration.framework/Headers/DADisk.h:28:
In file included from /sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:52:
/sdk/System/Library/Frameworks/IOKit.framework/Headers/OSMessageNotification.h:120:53: error: expected ';' after top level declarator
typedef natural_t OSAsyncReference[kOSAsyncRefCount] __kernel_ptr_semantics;
                                                    ^
In file included from /go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20231102141658-eca20e8abded/native_darwin.go:7:
In file included from ./glfw/include/GLFW/glfw3native.h:108:
In file included from /sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13:
In file included from /sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:56:
In file included from /sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCIImageRep.h:11:
In file included from /sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h:15:
In file included from /sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CoreVideo.h:29:
/sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:238:167: error: expected ','
CV_EXPORT const CFStringRef CV_NONNULL kCVPixelBufferOpenGLESCompatibilityKey API_AVAILABLE(ios(6.0), tvos(9.0)) API_UNAVAILABLE(macosx) API_UNAVAILABLE(macCatalyst) API_UNAVAILABLE(visionos) __WATCHOS_PROHIBITED;       // CFBoolean
                                                                                                                                                                      ^
/usr/local/zig/lib/libc/include/any-macos-any/os/availability.h:102:190: note: expanded from macro 'API_UNAVAILABLE'
    #define API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE7,__API_UNAVAILABLE6, __API_UNAVAILABLE5, __API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__)
                                                                                                                                                                                             ^
In file included from /go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20231102141658-eca20e8abded/native_darwin.go:7:
In file included from ./glfw/include/GLFW/glfw3native.h:108:
In file included from /sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13:
In file included from /sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:56:
In file included from /sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCIImageRep.h:11:
In file included from /sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h:15:
In file included from /sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CoreVideo.h:29:
/sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:241:179: error: expected ','
CV_EXPORT const CFStringRef CV_NONNULL kCVPixelBufferOpenGLESTextureCacheCompatibilityKey API_AVAILABLE(ios(9.0), tvos(9.0)) API_UNAVAILABLE(macosx) API_UNAVAILABLE(macCatalyst) API_UNAVAILABLE(visionos) __WATCHOS_PROHIBITED;
                                                                                                                                                                                  ^
/usr/local/zig/lib/libc/include/any-macos-any/os/availability.h:102:190: note: expanded from macro 'API_UNAVAILABLE'
    #define API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE7,__API_UNAVAILABLE6, __API_UNAVAILABLE5, __API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__)
                                                                                                                                                                                             ^
In file included from /go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20231102141658-eca20e8abded/native_darwin.go:7:
In file included from ./glfw/include/GLFW/glfw3native.h:108:
In file included from /sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13:
In file included from /sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:56:
In file included from /sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCIImageRep.h:11:
In file included from /sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h:15:
In file included from /sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CoreVideo.h:29:
In file included from /sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:629:
/sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBufferIOSurface.h:43:121: error: expected ','
CV_EXPORT const CFStringRef CV_NONNULL kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey API_AVAILABLE(macosx(10.6)) API_UNAVAILABLE(visionos) __IOS_PROHIBITED __TVOS_PROHIBITED __WATCHOS_PROHIBITED;      // CFBoolean
                                                                                                                        ^
/usr/local/zig/lib/libc/include/any-macos-any/os/availability.h:102:190: note: expanded from macro 'API_UNAVAILABLE'
    #define API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE7,__API_UNAVAILABLE6, __API_UNAVAILABLE5, __API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__)
                                                                                                                                                                                             ^
In file included from /go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20231102141658-eca20e8abded/native_darwin.go:7:
In file included from ./glfw/include/GLFW/glfw3native.h:108:
In file included from /sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13:
In file included from /sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:56:
In file included from /sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCIImageRep.h:11:
In file included from /sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h:15:
In file included from /sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CoreVideo.h:29:
In file included from /sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:629:
/sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBufferIOSurface.h:45:117: error: expected ','
CV_EXPORT const CFStringRef CV_NONNULL kCVPixelBufferIOSurfaceOpenGLFBOCompatibilityKey API_AVAILABLE(macosx(10.6)) API_UNAVAILABLE(visionos) __IOS_PROHIBITED __TVOS_PROHIBITED __WATCHOS_PROHIBITED;  // CFBoolean
                                                                                                                    ^
/usr/local/zig/lib/libc/include/any-macos-any/os/availability.h:102:190: note: expanded from macro 'API_UNAVAILABLE'
    #define API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE7,__API_UNAVAILABLE6, __API_UNAVAILABLE5, __API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__)
                                                                                                                                                                                             ^
In file included from /go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20231102141658-eca20e8abded/native_darwin.go:7:
In file included from ./glfw/include/GLFW/glfw3native.h:108:
In file included from /sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13:
In file included from /sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:56:
In file included from /sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCIImageRep.h:11:
In file included from /sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h:15:
In file included from /sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CoreVideo.h:29:
In file included from /sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:629:
/sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBufferIOSurface.h:50:183: error: expected ','
CV_EXPORT const CFStringRef CV_NONNULL kCVPixelBufferIOSurfaceOpenGLESTextureCompatibilityKey API_AVAILABLE(ios(5.0), tvos(9.0)) API_UNAVAILABLE(macosx) API_UNAVAILABLE(macCatalyst) API_UNAVAILABLE(visionos) __WATCHOS_PROHIBITED;   // CFBoolean
                                                                                                                                                                                      ^
/usr/local/zig/lib/libc/include/any-macos-any/os/availability.h:102:190: note: expanded from macro 'API_UNAVAILABLE'
    #define API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE7,__API_UNAVAILABLE6, __API_UNAVAILABLE5, __API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__)
                                                                                                                                                                                             ^
In file included from /go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20231102141658-eca20e8abded/native_darwin.go:7:
In file included from ./glfw/include/GLFW/glfw3native.h:108:
In file included from /sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13:
In file included from /sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:56:
In file included from /sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCIImageRep.h:11:
In file included from /sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h:15:
In file included from /sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CoreVideo.h:29:
In file included from /sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:629:
/sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBufferIOSurface.h:52:179: error: expected ','
CV_EXPORT const CFStringRef CV_NONNULL kCVPixelBufferIOSurfaceOpenGLESFBOCompatibilityKey API_AVAILABLE(ios(5.0), tvos(9.0)) API_UNAVAILABLE(macosx) API_UNAVAILABLE(macCatalyst) API_UNAVAILABLE(visionos) __WATCHOS_PROHIBITED;       // CFBoolean
                                                                                                                                                                                  ^
/usr/local/zig/lib/libc/include/any-macos-any/os/availability.h:102:190: note: expanded from macro 'API_UNAVAILABLE'
    #define API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE7,__API_UNAVAILABLE6, __API_UNAVAILABLE5, __API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__)
                                                                                                                                                                                             ^
In file included from /go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20231102141658-eca20e8abded/native_darwin.go:7:
In file included from ./glfw/include/GLFW/glfw3native.h:108:
In file included from /sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13:
In file included from /sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:56:
In file included from /sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCIImageRep.h:11:
In file included from /sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h:15:
In file included from /sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CoreVideo.h:45:
/sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelFormatDescription.h:117:164: error: expected ','
CV_EXPORT const CFStringRef CV_NONNULL kCVPixelFormatOpenGLESCompatibility API_AVAILABLE(ios(5.0), tvos(9.0)) API_UNAVAILABLE(macosx) API_UNAVAILABLE(macCatalyst) API_UNAVAILABLE(visionos) __WATCHOS_PROHIBITED;
                                                                                                                                                                   ^
/usr/local/zig/lib/libc/include/any-macos-any/os/availability.h:102:190: note: expanded from macro 'API_UNAVAILABLE'
    #define API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE7,__API_UNAVAILABLE6, __API_UNAVAILABLE5, __API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__)
                                                                                                                                                                                             ^
15 errors generated.

error building application: exit status 1
Bluebugs commented 1 year ago

Yes, xcode 15 is causing trouble. This need to be addressed, but in the mean time you can use version 12, if I remember correctly.

Antiarchitect commented 1 year ago

Thank you :) I will try it.

Antiarchitect commented 1 year ago

With CLT for Xcode 12 I've successfully built an app for amd64 and arm64, but it seems like it won't run on the modern MacOSX. Is there any backward compatibility caveats wih old CLT version vs newer OS version?

andydotxyz commented 1 year ago

It should run. Can you be more specific about what way it won't work?

Antiarchitect commented 1 year ago

I've investigated it further and it could be because of the MacOSX quarantine. It seems xattr -d com.apple.quarantine ./path/to/my.app does the trick.