MobileNativeFoundation / MobileNativeFoundation/rules_xcodeproj

Bug: Xcode Previews fail when using `macos_*_framework`

Open
#2,915 8 comments 0 reactions 1 assignee View on GitHub

@luispadron is already working on this.

Since Feb 24, 2024.

bug
Dominant language
Swift
Stars
626
Forks
124
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.