urbanairship / ios-library

Urban Airship iOS SDK
http://urbanairship.com
Apache License 2.0
478 stars 265 forks source link

Failed to build for Previews when using Airship 17.6.0 #382

Closed neriusv closed 1 year ago

neriusv commented 1 year ago

Preliminary Info

What Airship dependencies are you using?

Airship 17.6.0

What are the versions of any relevant development tools you are using?

Xcode 15.0

Report

What unexpected behavior are you seeing?

Project fails to build for previews when using Airship 17.6.0. Airship 17.5.1 work fine.

What is the expected behavior?

SwiftUI Previews should build successfully with Airship 17.6.0.

What are the steps to reproduce the unexpected behavior?

  1. Create a new SwiftUI project in Xcode;
  2. Add Airship 17.6.0 using SPM;
  3. Open ContentView (which is created by default when creating a new project);
  4. Try running the Preview: Error message: 4 duplicate symbols for architecture arm64 Everything works correctly after downgrading to Airship 17.5.1;

Do you have logging for the issue?

duplicate symbol '_OBJC_CLASS_$_UAMeteredUsageEventData' in:
    .../Library/Developer/Xcode/DerivedData/AirshipError-diuzgsxrjdspltebuyenceppjsau/Build/Intermediates.noindex/Previews/AirshipError/Intermediates.noindex/Airship.build/Debug-iphonesimulator/AirshipCore.build/Objects-normal/arm64/MeteredUsageStore.o
    .../Library/Developer/Xcode/DerivedData/AirshipError-diuzgsxrjdspltebuyenceppjsau/Build/Intermediates.noindex/Previews/AirshipError/Intermediates.noindex/Airship.build/Debug-iphonesimulator/AirshipCore.build/Objects-normal/arm64/UAMeteredUsageEventData+CoreDataClass.o
duplicate symbol '_OBJC_METACLASS_$_UAMeteredUsageEventData' in:
    /Users/neriuswork/Library/Developer/Xcode/DerivedData/AirshipError-diuzgsxrjdspltebuyenceppjsau/Build/Intermediates.noindex/Previews/AirshipError/Intermediates.noindex/Airship.build/Debug-iphonesimulator/AirshipCore.build/Objects-normal/arm64/MeteredUsageStore.o
    .../Library/Developer/Xcode/DerivedData/AirshipError-diuzgsxrjdspltebuyenceppjsau/Build/Intermediates.noindex/Previews/AirshipError/Intermediates.noindex/Airship.build/Debug-iphonesimulator/AirshipCore.build/Objects-normal/arm64/UAMeteredUsageEventData+CoreDataClass.o
duplicate symbol '_OBJC_CLASS_$_UAirshipCacheData' in:
    .../Library/Developer/Xcode/DerivedData/AirshipError-diuzgsxrjdspltebuyenceppjsau/Build/Intermediates.noindex/Previews/AirshipError/Intermediates.noindex/Airship.build/Debug-iphonesimulator/AirshipCore.build/Objects-normal/arm64/AirshipCache.o
    .../Library/Developer/Xcode/DerivedData/AirshipError-diuzgsxrjdspltebuyenceppjsau/Build/Intermediates.noindex/Previews/AirshipError/Intermediates.noindex/Airship.build/Debug-iphonesimulator/AirshipCore.build/Objects-normal/arm64/UAirshipCacheData+CoreDataClass.o
duplicate symbol '_OBJC_METACLASS_$_UAirshipCacheData' in:
    .../Library/Developer/Xcode/DerivedData/AirshipError-diuzgsxrjdspltebuyenceppjsau/Build/Intermediates.noindex/Previews/AirshipError/Intermediates.noindex/Airship.build/Debug-iphonesimulator/AirshipCore.build/Objects-normal/arm64/AirshipCache.o
    .../Library/Developer/Xcode/DerivedData/AirshipError-diuzgsxrjdspltebuyenceppjsau/Build/Intermediates.noindex/Previews/AirshipError/Intermediates.noindex/Airship.build/Debug-iphonesimulator/AirshipCore.build/Objects-normal/arm64/UAirshipCacheData+CoreDataClass.o
ld: 4 duplicate symbols for architecture arm64
rlepinski commented 1 year ago

Thanks, looking into it

rlepinski commented 1 year ago

I think this might be a swift data build thing? not really sure but having troubles reliably reproducing this. Could you point to branch GH-382 and let me know if it resolves it for you?

rlepinski commented 1 year ago

I just pushed another change with a fix, was able to reproduce finally after wiping derived data.

neriusv commented 1 year ago

I tried using GH-382 but now it doesn't build at all:

CompileC....Library/Developer/Xcode/DerivedData/AirshipError-diuzgsxrjdspltebuyenceppjsau/Build/Intermediates.noindex/Airship.build/Debug-iphonesimulator/AirshipCore.build/Objects-normal/arm64/UAirshipCacheData+CoreDataClass.o /Users/neriuswork/Library/Developer/Xcode/DerivedData/AirshipError-diuzgsxrjdspltebuyenceppjsau/Build/Intermediates.noindex/Airship.build/Debug-iphonesimulator/AirshipCore.build/DerivedSources/CoreDataGenerated/UAirshipCache/UAirshipCacheData+CoreDataClass.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'AirshipCore' from project 'Airship')

error: Build input file cannot be found: '....Library/Developer/Xcode/DerivedData/AirshipError-diuzgsxrjdspltebuyenceppjsau/Build/Intermediates.noindex/Airship.build/Debug-iphonesimulator/AirshipCore.build/DerivedSources/resource_bundle_accessor.h'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'AirshipCore' from project 'Airship')

CompileC ...Library/Developer/Xcode/DerivedData/AirshipError-diuzgsxrjdspltebuyenceppjsau/Build/Intermediates.noindex/Airship.build/Debug-iphonesimulator/AirshipCore.build/Objects-normal/arm64/UAirshipCacheData+CoreDataProperties.o /Users/neriuswork/Library/Developer/Xcode/DerivedData/AirshipError-diuzgsxrjdspltebuyenceppjsau/Build/Intermediates.noindex/Airship.build/Debug-iphonesimulator/AirshipCore.build/DerivedSources/CoreDataGenerated/UAirshipCache/UAirshipCacheData+CoreDataProperties.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'AirshipCore' from project 'Airship')

error: Build input file cannot be found: '...Library/Developer/Xcode/DerivedData/AirshipError-diuzgsxrjdspltebuyenceppjsau/Build/Intermediates.noindex/Airship.build/Debug-iphonesimulator/AirshipCore.build/DerivedSources/resource_bundle_accessor.h'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'AirshipCore' from project 'Airship')

Clearing DerivedData does not help.

rlepinski commented 1 year ago

@neriusv i just pushed another change, it was a codegen issue with the new coredata files

rlepinski commented 1 year ago

I believe this is fixed in 17.6.1

neriusv commented 1 year ago

I can confirm this is fixed in 17.6.1. Thanks!