apple / swift-algorithms

Commonly used sequence and collection algorithms for Swift
Apache License 2.0
5.9k stars 435 forks source link

Xcode 14 & iOS 16 compile errors #189

Open stevenen opened 2 years ago

stevenen commented 2 years ago

The libray doesn't compile under Xcode 14 and iOS 16 beta 4

Swift Algorithms version: 1.0.0

Checklist

mdznr commented 2 years ago

What build errors are you seeing?

Arnold75 commented 2 years ago
Screen Shot 2022-08-21 at 10 42 51

I think same issue here, a ton of "let" property... use self.init in the pod files, something like 50 errors in the various files

/and already did a complete reinstall of Xcode/

stevenen commented 2 years ago

same errors as @Arnold75 shown in the comment above.

Arnold75 commented 1 year ago

@Stevenen I tried all the solutions on the following page: https://stackoverflow.com/questions/46690619/build-fails-with-command-failed-with-a-nonzero-exit-code?page=1&tab=scoredesc#tab-top

Saw that one? maybe one of them helps you... no success for me ... still clueless, lost hours over this. Even uninstalled xcode, the derived data folder, ... no success

dhruvilpatel07 commented 1 year ago

@Arnold75 or @stevenen were you able to fix this issue? I'm getting same error as above in Xcode 14.0!! Please let me know.

idemche commented 1 year ago
Screen Shot 2022-08-21 at 10 42 51

I think same issue here, a ton of "let" property... use self.init in the pod files, something like 50 errors in the various files /and already did a complete reinstall of Xcode/

If you use Cocoapods, try adding the following into post_install do |installer| in Podfile so it looks like:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
        if target.name == "SwiftAlgorithms"
           config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'NO'
       end
    end
  end
end

and then run pod install. That might help

jonasrotilli commented 1 year ago

if target.name == "SwiftAlgorithms" config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'NO' end

That solved it for me! I use cocoaPod. Thanks!

djs-code commented 1 year ago

Seeing these same errors as well when trying to pull in the Charts library (4.1.0) via Carthage. We're building this as part of an SDK we distribute, so we require BUILD_LIBRARY_FOR_DISTRIBUTION to be enabled.

djs-code commented 1 year ago

It seems that decorating the culprit Sequences and Collections (e.g. AdjacentPairsSequence, AdjacentPairsCollection, etc) with the @frozen modifier fixes this. Alas, ABI Stability isn't quite my forte.

@natecook1000 @xwu and anyone else who may know, does application of the @frozen decorator sound like the Correctâ„¢ approach here? If so, I'd be happy to follow up with a PR. Otherwise, I'll turn my attention to Charts.

MikePetitfils commented 1 year ago

Same issue here. Any update on this ?

ansonlv commented 1 year ago

Any update on this? We need to use this framework in our SDK. Please update it to support BUILD_LIBRARY_FOR_DISTRIBUTION = Yes.

dung-nguyen1 commented 1 year ago

Any update on this as we using framework in our SDK with BUILD_LIBRARY_FOR_DISTRIBUTION = Yes.

niorko commented 1 year ago

We are also using this library in SDK and we require BUILD_LIBRARY_FOR_DISTRIBUTION option to be enabled.

Snippet to simulate this issue: xcodebuild archive -scheme swift-algorithms -destination "generic/platform=iOS" -configuration Release -archivePath Archive SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES output.txt

sanderdekoning commented 1 year ago

Bump; how can BUILD_LIBRARY_FOR_DISTRIBUTION be enabled?

Please fix.