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

Bug: Xcode Previews fail when using macos_*_framework #2915

Open
luispadron opened this issue Feb 23, 2024 · 8 comments
Open

Bug: Xcode Previews fail when using macos_*_framework #2915

luispadron opened this issue Feb 23, 2024 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@luispadron
Copy link
Contributor

luispadron commented Feb 23, 2024

Description

I have a macos_dynamic_framework target we use for distribution, this works fine for normal builds in BwB but when trying to use previews we get the following error:

Previews crash log == DATE:
Friday, February 23, 2024 at 2:37:57 PM Eastern Standard Time

2024-02-23T19:37:57Z

== PREVIEW UPDATE ERROR:

LinkDylibError: Failed to build AnalyticsView.swift

Linking failed: no such file or directory: '/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins/AnalyticsDesktopPlugin.framework/Versions/A/AnalyticsDesktopPlugin'

clang: error: no such file or directory: '/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins/AnalyticsDesktopPlugin.framework/Versions/A/AnalyticsDesktopPlugin'


==================================

|  BuildInvocationError
|  
|  /Users/lpadron/Development/cash-ios/Code/DeveloperTools/EchoPlugins/DesktopPlugins/EchoDesktopPlugins.xcodeproj/rules_xcodeproj/bazel/ld.sh -F /Applications/Xcode-15.1.0.app/Contents/SharedFrameworks -Xlinker -reproducible -target arm64-apple-macos13.0 -isysroot /Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -O0 -L/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Intermediates.noindex/EagerLinkingTBDs/Debug -F/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Intermediates.noindex/EagerLinkingTBDs/Debug -Xlinker -no_deduplicate -fobjc-link-runtime -L/Applications/Xcode-15.1.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -L/usr/lib/swift @/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Intermediates.noindex/EchoDesktopPlugins.build/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins/AnalyticsDesktopPlugin.framework/DerivedSources/link.params /Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins/AnalyticsDesktopPlugin.framework/Versions/A/AnalyticsDesktopPlugin /Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Intermediates.noindex/EchoDesktopPlugins.build/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins/AnalyticsDesktopPlugin.framework/Objects-normal/arm64/AnalyticsView.1.preview-thunk.o -o /Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Intermediates.noindex/EchoDesktopPlugins.build/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins/AnalyticsDesktopPlugin.framework/Objects-normal/arm64/AnalyticsView.1.preview-thunk.dylib -fprofile-instr-generate -client_name AnalyticsDesktopPlugin -bundle -framework SwiftUI

== VERSION INFO:

Tools: 15C65
OS:    23D60
PID:   65387
Model: MacBook Pro
Arch:  arm64e

== ENVIRONMENT:

openFiles = [
    /Users/lpadron/Development/cash-ios/Code/DeveloperTools/EchoPlugins/DesktopPlugins/Sources/AnalyticsDesktopPlugin/AnalyticsView.swift
]
wantsNewBuildSystem = true
newBuildSystemAvailable = true
activeScheme = AnalyticsDesktopPlugin
activeRunDestination = My Mac variant macos arm64
workspaceArena = [x]
buildArena = [x]
buildableEntries = [
    AnalyticsDesktopPlugin.framework
]
runMode = Dynamic Replacement

== SELECTED RUN DESTINATION:

name = My Mac
eligible = true
sdk = Optional(<DVTSDK:0x13a9129f0:'macosx14.2':macOS 14.2:<DVTFilePath:0x6000000b31e0:'/Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk'>>)
variant = Optional("macos")
device = Optional(<DVTLocalComputer: 0x115c232b0 (My Mac | arm64e)>)

== SELECTED RUN DESTINATION:

macOS 14.2 | macos | arm64 | MacBook Pro | no proxy

== PACKAGE RESOLUTION ERRORS:

== REFERENCED SOURCE PACKAGES:

== SESSION GROUP 6631:

workspace identifier: WorkspaceIdentifier(identifier: DBFE860E-5F11-49A3-BD74-1AC88B728E4B)
providers: [
    Preview Provider | Registry-AnalyticsView.swift#1 [Editor(6525)]
]
translation units: [
    /Users/lpadron/Development/cash-ios/Code/DeveloperTools/EchoPlugins/DesktopPlugins/Sources/AnalyticsDesktopPlugin/AnalyticsView.swift
]
attributes: [
    Editor(6525):     []
]
session: 6632
request sessions: [
    Registry[AnalyticsView.swift #1 (line 235)]: not completed
]

== UPDATE SESSION 6632:

Start Date: Friday, February 23, 2024 at 2:37:25 PM Eastern Standard Time
Preview Provider {
    UpdaterStore {
        updaterLimit: none
        updatersByIdentifier: [
            6653 {
                state: unloaned
                RemoteAgentUpdater {
                    workspaceIdentifier: DBFE860E-5F11-49A3-BD74-1AC88B728E4B
                    supportsOnDevice: false
                    processName: XCPreviewAgent.app
                    pid: 66271
                }
            }
        ]
        expectedAbandonedIdentifiers: []
    }
    My Mac {
        dvtDevice: My Mac
        buildNumber: 14.3.1 (23D60)
        arch: arm64e
    }
    pid: 66271
    host bundle: 
    com.apple.dt.PreviewAgent.macOS {
        url: file:///Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Agents/XCPreviewAgent.app
        version: 21.20.11
        attributes: [
            LaunchConfigEnvironmentVariablesPreviewAttributesKey: ["__XPC_DYLD_LIBRARY_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "DYLD_LIBRARY_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "PACKAGE_RESOURCE_BUNDLE_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "CFLOG_FORCE_DISABLE_STDERR": "1", "IDE_DISABLED_OS_ACTIVITY_DT_MODE": "1", "OS_ACTIVITY_TOOLS_OVERSIZE": "YES", "OS_LOG_DT_HOOK_MODE": "0x07", "OS_LOG_TRANSLATE_PRINT_MODE": "0x80", "DYLD_INSERT_LIBRARIES": "/Applications/Xcode-15.1.0.app/Contents/Developer/usr/lib/libLogRedirect.dylib", "DYLD_FRAMEWORK_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "__XPC_DYLD_FRAMEWORK_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "__XCODE_BUILT_PRODUCTS_DIR_PATHS": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "SQLITE_ENABLE_THREAD_ASSERTIONS": "1", "OS_ACTIVITY_TOOLS_PRIVACY": "YES", "OS_LOG_DT_HOOK_PREFIX": "OSLOG-137CE9F1-85F0-4792-9BB1-96AFA59B61FD"],
        ]
    }
    builtTargetDescriptions: empty
}
Preview Preflight {
    UpdaterStore {
        updaterLimit: none
        updatersByIdentifier: [
            6653 {
                state: unloaned
                RemoteAgentUpdater {
                    workspaceIdentifier: DBFE860E-5F11-49A3-BD74-1AC88B728E4B
                    supportsOnDevice: false
                    processName: XCPreviewAgent.app
                    pid: 66271
                }
            }
        ]
        expectedAbandonedIdentifiers: []
    }
    My Mac {
        dvtDevice: My Mac
        buildNumber: 14.3.1 (23D60)
        arch: arm64e
    }
    pid: 66271
    host bundle: 
    com.apple.dt.PreviewAgent.macOS {
        url: file:///Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Agents/XCPreviewAgent.app
        version: 21.20.11
        attributes: [
            LaunchConfigEnvironmentVariablesPreviewAttributesKey: ["__XPC_DYLD_LIBRARY_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "DYLD_LIBRARY_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "PACKAGE_RESOURCE_BUNDLE_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "CFLOG_FORCE_DISABLE_STDERR": "1", "IDE_DISABLED_OS_ACTIVITY_DT_MODE": "1", "OS_ACTIVITY_TOOLS_OVERSIZE": "YES", "OS_LOG_DT_HOOK_MODE": "0x07", "OS_LOG_TRANSLATE_PRINT_MODE": "0x80", "DYLD_INSERT_LIBRARIES": "/Applications/Xcode-15.1.0.app/Contents/Developer/usr/lib/libLogRedirect.dylib", "DYLD_FRAMEWORK_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "__XPC_DYLD_FRAMEWORK_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "__XCODE_BUILT_PRODUCTS_DIR_PATHS": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "SQLITE_ENABLE_THREAD_ASSERTIONS": "1", "OS_ACTIVITY_TOOLS_PRIVACY": "YES", "OS_LOG_DT_HOOK_PREFIX": "OSLOG-137CE9F1-85F0-4792-9BB1-96AFA59B61FD"],
        ]
    }
    builtTargetDescriptions: empty
}
Build Graph {
    target framework AnalyticsDesktopPlugin.framework (#1)
       translationUnit AnalyticsView.swift (#2)
       Preview Preflight | Registry-AnalyticsView.swift#1: from Editor(6525) for local Preview Preflight | Registry-AnalyticsView.swift#1: from Editor(6525) for local (#3)
       Preview Provider | Registry-AnalyticsView.swift#1 [Editor(6525)] Preview Provider | Registry-AnalyticsView.swift#1 [Editor(6525)] (#4)
}
Update Plan {
    macOS [arm64 macosx14.2 macos] (MacBook Pro, 00006031-000871643A44001C-macosx14.2-arm64-macos), [], thinning enabled) {
        Destination: My Mac dvtdevice-local-computer:localhost | default device for macos [
            Framework Agent - Previews {
                execution points [
                    point Preview Preflight | Registry-AnalyticsView.swift#1: from Editor(6525) for local
                    provider AnalyticsDesktopPlugin.Registry[AnalyticsView.swift #1 (line 235)]
                ]
                translation units [
                    AnalyticsView.swift (in AnalyticsDesktopPlugin.framework)
                ]
                loadable products [
                    Description(buildableName: "AnalyticsDesktopPlugin.framework", moduleName: "AnalyticsDesktopPlugin")
                ]
                modules [
                    AnalyticsDesktopPlugin.framework
                ]
            }
        ]
    }
}

== POWER STATE LOGS:

2/23/2024, 2:37 PM Received power source state: Battery Powered (lowPowerMode: false, status: charging, level: 34%)
2/23/2024, 2:37 PM Broadcasting device power state: Mid Power
2/23/2024, 2:37 PM No device power state user override user default value.Current power state: Mid Power

Reproduction steps

  • Define an xcodeproj target with a macos_dynamic_framework top level target
  • Add #Preview { Text("Hi") }
  • Notice previews error

Expected behavior

Previews work for macos_dynamic_framework

rules_xcodeproj version

1.16.0

Xcode version

15.1

Bazel version

6.5.0

rules_apple version

No response

rules_swift version

No response

Additional information

No response

@luispadron luispadron added the bug Something isn't working label Feb 23, 2024
@luispadron
Copy link
Contributor Author

Do we maybe need something similar to: #2722

@luispadron
Copy link
Contributor Author

I tested using just macos_framework and it fails as well:

Previews log == DATE:
Friday, February 23, 2024 at 2:48:27 PM Eastern Standard Time

2024-02-23T19:48:27Z

== PREVIEW UPDATE ERROR:

LinkDylibError: Failed to build AnalyticsView.swift

Linking failed: no such file or directory: '/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins/AnalyticsDesktopPlugin.framework/Versions/A/AnalyticsDesktopPlugin'

clang: error: no such file or directory: '/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins/AnalyticsDesktopPlugin.framework/Versions/A/AnalyticsDesktopPlugin'


==================================

|  BuildInvocationError
|  
|  /Users/lpadron/Development/cash-ios/Code/DeveloperTools/EchoPlugins/DesktopPlugins/EchoDesktopPlugins.xcodeproj/rules_xcodeproj/bazel/ld.sh -F /Applications/Xcode-15.1.0.app/Contents/SharedFrameworks -Xlinker -reproducible -target arm64-apple-macos13.0 -isysroot /Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -O0 -L/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Intermediates.noindex/EagerLinkingTBDs/Debug -F/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Intermediates.noindex/EagerLinkingTBDs/Debug -Xlinker -no_deduplicate -fobjc-link-runtime -L/Applications/Xcode-15.1.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -L/usr/lib/swift @/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Intermediates.noindex/EchoDesktopPlugins.build/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins/AnalyticsDesktopPlugin.framework/DerivedSources/link.params /Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins/AnalyticsDesktopPlugin.framework/Versions/A/AnalyticsDesktopPlugin /Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Intermediates.noindex/EchoDesktopPlugins.build/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins/AnalyticsDesktopPlugin.framework/Objects-normal/arm64/AnalyticsView.1.preview-thunk.o -o /Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Intermediates.noindex/EchoDesktopPlugins.build/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins/AnalyticsDesktopPlugin.framework/Objects-normal/arm64/AnalyticsView.1.preview-thunk.dylib -fprofile-instr-generate -client_name AnalyticsDesktopPlugin -bundle -framework SwiftUI

== VERSION INFO:

Tools: 15C65
OS:    23D60
PID:   69649
Model: MacBook Pro
Arch:  arm64e

== ENVIRONMENT:

openFiles = [
    /Users/lpadron/Development/cash-ios/Code/DeveloperTools/EchoPlugins/DesktopPlugins/Sources/AnalyticsDesktopPlugin/AnalyticsView.swift
]
wantsNewBuildSystem = true
newBuildSystemAvailable = true
activeScheme = AnalyticsDesktopPlugin
activeRunDestination = My Mac variant macos arm64
workspaceArena = [x]
buildArena = [x]
buildableEntries = [
    AnalyticsDesktopPlugin.framework
]
runMode = Dynamic Replacement

== SELECTED RUN DESTINATION:

name = My Mac
eligible = true
sdk = Optional(<DVTSDK:0x10df0d0a0:'macosx14.2':macOS 14.2:<DVTFilePath:0x600001ffd650:'/Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk'>>)
variant = Optional("macos")
device = Optional(<DVTLocalComputer: 0x123807ea0 (My Mac | arm64e)>)

== SELECTED RUN DESTINATION:

macOS 14.2 | macos | arm64 | MacBook Pro | no proxy

== PACKAGE RESOLUTION ERRORS:

== REFERENCED SOURCE PACKAGES:

== SESSION GROUP 5407:

workspace identifier: WorkspaceIdentifier(identifier: D5829D22-086C-4896-BF23-DBEB61DF25C9)
providers: [
    Preview Provider | Registry-AnalyticsView.swift#1 [Editor(5371)]
]
translation units: [
    /Users/lpadron/Development/cash-ios/Code/DeveloperTools/EchoPlugins/DesktopPlugins/Sources/AnalyticsDesktopPlugin/AnalyticsView.swift
]
attributes: [
    Editor(5371):     []
]
session: 5408
request sessions: [
    Registry[AnalyticsView.swift #1 (line 235)]: not completed
]

== UPDATE SESSION 5408:

Start Date: Friday, February 23, 2024 at 2:48:20 PM Eastern Standard Time
Preview Provider {
    UpdaterStore {
        updaterLimit: none
        updatersByIdentifier: [
            5429 {
                state: unloaned
                RemoteAgentUpdater {
                    workspaceIdentifier: D5829D22-086C-4896-BF23-DBEB61DF25C9
                    supportsOnDevice: false
                    processName: XCPreviewAgent.app
                    pid: 69999
                }
            }
        ]
        expectedAbandonedIdentifiers: []
    }
    My Mac {
        dvtDevice: My Mac
        buildNumber: 14.3.1 (23D60)
        arch: arm64e
    }
    pid: 69999
    host bundle: 
    com.apple.dt.PreviewAgent.macOS {
        url: file:///Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Agents/XCPreviewAgent.app
        version: 21.20.11
        attributes: [
            LaunchConfigEnvironmentVariablesPreviewAttributesKey: ["DYLD_INSERT_LIBRARIES": "/Applications/Xcode-15.1.0.app/Contents/Developer/usr/lib/libLogRedirect.dylib", "DYLD_LIBRARY_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "OS_ACTIVITY_TOOLS_PRIVACY": "YES", "OS_LOG_DT_HOOK_MODE": "0x07", "SQLITE_ENABLE_THREAD_ASSERTIONS": "1", "DYLD_FRAMEWORK_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "OS_LOG_TRANSLATE_PRINT_MODE": "0x80", "__XPC_DYLD_FRAMEWORK_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "PACKAGE_RESOURCE_BUNDLE_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "IDE_DISABLED_OS_ACTIVITY_DT_MODE": "1", "OS_LOG_DT_HOOK_PREFIX": "OSLOG-BC840ADB-A722-4B26-BEA2-318C885D0453", "__XPC_DYLD_LIBRARY_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "__XCODE_BUILT_PRODUCTS_DIR_PATHS": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "OS_ACTIVITY_TOOLS_OVERSIZE": "YES", "CFLOG_FORCE_DISABLE_STDERR": "1"],
        ]
    }
    builtTargetDescriptions: empty
}
Preview Preflight {
    UpdaterStore {
        updaterLimit: none
        updatersByIdentifier: [
            5429 {
                state: unloaned
                RemoteAgentUpdater {
                    workspaceIdentifier: D5829D22-086C-4896-BF23-DBEB61DF25C9
                    supportsOnDevice: false
                    processName: XCPreviewAgent.app
                    pid: 69999
                }
            }
        ]
        expectedAbandonedIdentifiers: []
    }
    My Mac {
        dvtDevice: My Mac
        buildNumber: 14.3.1 (23D60)
        arch: arm64e
    }
    pid: 69999
    host bundle: 
    com.apple.dt.PreviewAgent.macOS {
        url: file:///Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Agents/XCPreviewAgent.app
        version: 21.20.11
        attributes: [
            LaunchConfigEnvironmentVariablesPreviewAttributesKey: ["DYLD_INSERT_LIBRARIES": "/Applications/Xcode-15.1.0.app/Contents/Developer/usr/lib/libLogRedirect.dylib", "DYLD_LIBRARY_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "OS_ACTIVITY_TOOLS_PRIVACY": "YES", "OS_LOG_DT_HOOK_MODE": "0x07", "SQLITE_ENABLE_THREAD_ASSERTIONS": "1", "DYLD_FRAMEWORK_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "OS_LOG_TRANSLATE_PRINT_MODE": "0x80", "__XPC_DYLD_FRAMEWORK_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "PACKAGE_RESOURCE_BUNDLE_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "IDE_DISABLED_OS_ACTIVITY_DT_MODE": "1", "OS_LOG_DT_HOOK_PREFIX": "OSLOG-BC840ADB-A722-4B26-BEA2-318C885D0453", "__XPC_DYLD_LIBRARY_PATH": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "__XCODE_BUILT_PRODUCTS_DIR_PATHS": "/Users/lpadron/Library/Developer/Xcode/DerivedData/EchoDesktopPlugins-helyoquiuggduwgcebfpozcjrbeg/Build/Intermediates.noindex/Previews/AnalyticsDesktopPlugin/Products/Debug/bazel-out/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-8f63b8dd0af6/bin/Code/DeveloperTools/EchoPlugins/DesktopPlugins", "OS_ACTIVITY_TOOLS_OVERSIZE": "YES", "CFLOG_FORCE_DISABLE_STDERR": "1"],
        ]
    }
    builtTargetDescriptions: empty
}
Build Graph {
    target framework AnalyticsDesktopPlugin.framework (#1)
       translationUnit AnalyticsView.swift (#2)
       Preview Provider | Registry-AnalyticsView.swift#1 [Editor(5371)] Preview Provider | Registry-AnalyticsView.swift#1 [Editor(5371)] (#3)
       Preview Preflight | Registry-AnalyticsView.swift#1: from Editor(5371) for local Preview Preflight | Registry-AnalyticsView.swift#1: from Editor(5371) for local (#4)
}
Update Plan {
    macOS [arm64 macosx14.2 macos] (MacBook Pro, 00006031-000871643A44001C-macosx14.2-arm64-macos), [], thinning enabled) {
        Destination: My Mac dvtdevice-local-computer:localhost | default device for macos [
            Framework Agent - Previews {
                execution points [
                    point Preview Preflight | Registry-AnalyticsView.swift#1: from Editor(5371) for local
                    provider AnalyticsDesktopPlugin.Registry[AnalyticsView.swift #1 (line 235)]
                ]
                translation units [
                    AnalyticsView.swift (in AnalyticsDesktopPlugin.framework)
                ]
                loadable products [
                    Description(buildableName: "AnalyticsDesktopPlugin.framework", moduleName: "AnalyticsDesktopPlugin")
                ]
                modules [
                    AnalyticsDesktopPlugin.framework
                ]
            }
        ]
    }
}

== POWER STATE LOGS:

2/23/2024, 2:48 PM Received power source state: Battery Powered (lowPowerMode: false, status: charging, level: 51%)
2/23/2024, 2:48 PM No device power state user override user default value.Current power state: Full Power

@luispadron
Copy link
Contributor Author

luispadron commented Feb 23, 2024

The dylib doesn’t seem to exist in derived data. But if I copy it there manually then it works correctly

@luispadron luispadron changed the title Bug: Xcode Previews fail when using macos_dynamic_framework Bug: Xcode Previews fail when using macos_*_framework Feb 23, 2024
@brentleyjones
Copy link
Contributor

Similar to the other issue, rules_apple is creating a framework with the wrong layout:

$ tree /Users/brentley/Developer/rules_xcodeproj/examples/integration/bazel-output-base/rules_xcodeproj.noindex/build_output_base/execroot/_main/
bazel-out/darwin_arm64-dbg-macos-arm64-min14.0-applebin_macos-ST-1fae1195bb35/bin/macOSApp/Source/Lib.framework
/Users/brentley/Developer/rules_xcodeproj/examples/integration/bazel-output-base/rules_xcodeproj.noindex/build_output_base/execroot/_main/bazel-out/darwin_arm64-dbg-macos-arm64-min14.0-applebin_macos-ST-1fae1195bb35/bin/macOSApp/Source/Lib.framework
├── Headers
│   └── Lib.h
├── Info.plist
├── Lib
└── Modules
    ├── Lib.swiftmodule
    │   ├── arm64.swiftdoc
    │   └── arm64.swiftmodule
    └── module.modulemap

Once it creates macOS frameworks with the correct layout, then this will start working automatically.

@luispadron
Copy link
Contributor Author

Ah gotcha! Interestingly though I can't repro in the integration examples, previews work there for the macOS app

@brentleyjones
Copy link
Contributor

For the app it worked, but it didn't work when I added a preview to macOSLib.framework.

@luispadron luispadron self-assigned this Feb 24, 2024
@luispadron
Copy link
Contributor Author

@brentleyjones So I started looking at properly making frameworks for macOS with the structure described in: https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html

It's a non-trivial change to the rules and while we should definitely do it, I'll likely need more help to get that change done.

In the meantime, we've been able to work around this by symlinking the framework to the expected Versions/A path. Could rules_xcodeproj do this for us for preview builds while the rules are updated, thoughts?

@brentleyjones
Copy link
Contributor

We symlink the frameworks to versions in bazel-out, so we can't really modify them. Because of this I'm not sure there is an easy way for us to solve it on the rules_xcodeproj side.

I'm not opposed to doing something on this side, but anything would still have to be performant (which is what the symlink was made to address), correct, and forward compatible. If you think doing that work would be easier, I won't stop you 😁.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants