Tencent / wcdb

WCDB is a cross-platform database framework developed by WeChat.
Other
10.82k stars 1.41k forks source link

Xcode 9.3 Support? #283

Closed aidevjoe closed 6 years ago

aidevjoe commented 6 years ago

The language of WCDB

Swift

The version of WCDB

v1.0.6

The platform of WCDB

iOS

The installation of WCDB

Cocoapods

What's the issue?

When I use Xcode 9.2 everything works, but after updating to Xcode 9.3, I can't compile it. See the chart for specific errors

BBHNation commented 6 years ago

It happens to me too. Maybe the bug comes from Swift 4.1

RingoD commented 6 years ago

on going

nuomi1 commented 6 years ago
➜  Carthage git:(master) ✗ carthage update --use-submodules --no-build
*** Fetching SnapKit
*** Fetching Charts
*** Fetching RxSwift
*** Fetching wcdb
*** Checking out wcdb at "v1.0.6.1"
*** Checking out RxSwift at "4.1.2"
*** Checking out Charts at "v3.1.0"
*** Checking out SnapKit at "4.0.0"
➜  Carthage git:(master) ✗ carthage update --cache-builds
*** Fetching SnapKit
*** Fetching Charts
*** Fetching RxSwift
*** Fetching wcdb
*** Checking out wcdb at "v1.0.6.1"
*** Checking out RxSwift at "4.1.2"
*** Checking out Charts at "v3.1.0"
*** Checking out SnapKit at "4.0.0"
*** No cache found for Charts, building with all downstream dependencies
*** No cache found for RxSwift, building with all downstream dependencies
*** No cache found for SnapKit, building with all downstream dependencies
*** No cache found for wcdb, building with all downstream dependencies
*** xcodebuild output can be found in /var/folders/42/tmk7tyg11vl37yw9btws1gc80000gn/T/carthage-xcodebuild.duSKKz.log
*** Downloading RxSwift.framework binary at "Spread.2"
*** Skipped installing RxSwift.framework binary due to the error:
    "Incompatible Swift version - framework was built with 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2) and the local version is 4.1 (swiftlang-902.0.48 clang-902.0.37.1)."
*** Building scheme "Charts" in Charts.xcodeproj
*** Building scheme "RxBlocking-tvOS" in Rx.xcworkspace
*** Building scheme "RxBlocking-macOS" in Rx.xcworkspace
*** Building scheme "RxBlocking-iOS" in Rx.xcworkspace
*** Building scheme "RxBlocking-watchOS" in Rx.xcworkspace
*** Building scheme "RxCocoa-macOS" in Rx.xcworkspace
*** Building scheme "RxCocoa-tvOS" in Rx.xcworkspace
*** Building scheme "RxCocoa-iOS" in Rx.xcworkspace
*** Building scheme "RxCocoa-watchOS" in Rx.xcworkspace
*** Building scheme "RxSwift-watchOS" in Rx.xcworkspace
*** Building scheme "RxSwift-macOS" in Rx.xcworkspace
*** Building scheme "RxSwift-tvOS" in Rx.xcworkspace
*** Building scheme "RxSwift-iOS" in Rx.xcworkspace
*** Building scheme "RxTests-macOS" in Rx.xcworkspace
*** Building scheme "RxTests-iOS" in Rx.xcworkspace
*** Building scheme "RxTests-tvOS" in Rx.xcworkspace
*** Building scheme "SnapKit" in SnapKit.xcworkspace
*** Building scheme "WCDB" in WCDB.xcworkspace
*** Building scheme "sqlcipher.swift" in WCDB.xcworkspace
*** Building scheme "sqliterk.swift" in WCDB.xcworkspace
*** Building scheme "WCDB.swift" in WCDB.xcworkspace
Build Failed
    Task failed with exit code 65:
    /usr/bin/xcrun xcodebuild -workspace /Users/nuomi/Documents/Carthage/Carthage/Checkouts/wcdb/WCDB.xcworkspace -scheme WCDB.swift -configuration Release -derivedDataPath /Users/nuomi/Library/Caches/org.carthage.CarthageKit/DerivedData/9.3_9E145/wcdb/v1.0.6.1 ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/42/tmk7tyg11vl37yw9btws1gc80000gn/T/wcdb SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/nuomi/Documents/Carthage/Carthage/Checkouts/wcdb)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/42/tmk7tyg11vl37yw9btws1gc80000gn/T/carthage-xcodebuild.duSKKz.log
➜  Carthage git:(master) ✗ carthage update --cache-builds
*** Fetching SnapKit
*** Fetching Charts
*** Fetching RxSwift
*** Fetching wcdb
*** Checking out wcdb at "v1.0.6.1"
*** Checking out RxSwift at "4.1.2"
*** Checking out Charts at "v3.1.0"
*** Checking out SnapKit at "4.0.0"
*** xcodebuild output can be found in /var/folders/42/tmk7tyg11vl37yw9btws1gc80000gn/T/carthage-xcodebuild.bPGIbk.log
*** Valid cache found for Charts, skipping build
*** Valid cache found for RxSwift, skipping build
*** Valid cache found for SnapKit, skipping build
*** No cache found for wcdb, building with all downstream dependencies
*** Building scheme "sqlcipher.swift" in WCDB.xcworkspace
*** Building scheme "sqliterk.swift" in WCDB.xcworkspace
*** Building scheme "WCDB" in WCDB.xcworkspace
*** Building scheme "WCDB.swift" in WCDB.xcworkspace
Build Failed
    Task failed with exit code 65:
    /usr/bin/xcrun xcodebuild -workspace /Users/nuomi/Documents/Carthage/Carthage/Checkouts/wcdb/WCDB.xcworkspace -scheme WCDB.swift -configuration Release -derivedDataPath /Users/nuomi/Library/Caches/org.carthage.CarthageKit/DerivedData/9.3_9E145/wcdb/v1.0.6.1 ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/42/tmk7tyg11vl37yw9btws1gc80000gn/T/wcdb SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/nuomi/Documents/Carthage/Carthage/Checkouts/wcdb)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/42/tmk7tyg11vl37yw9btws1gc80000gn/T/carthage-xcodebuild.bPGIbk.log

carthage-xcodebuild.bPGIbk.zip carthage-xcodebuild.duSKKz.zip

RingoD commented 6 years ago

It's said that Swift 4.1 is source compatible to 4.0, which means that developers can recompile the code without any changes. However, not. :(

BBHNation commented 6 years ago

We have to call Apple 'Dady'. - -

JackLSH2016 commented 6 years ago

So how to solve this problem? Have any suggesstions ?

neonio commented 6 years ago

Sorry but I encounter same issue, I try to add

pod 'WCDB.swift', :git => 'https://github.com/Tencent/wcdb.git', :branch => 'feature/swift4.1'

but it is not working. Any update?

RingoD commented 6 years ago

As I said, it's on going. It will be released early next week.

RingoD commented 6 years ago

WCDB may have encountered a swift bug, which is the conditional conformance in Swift 4.1. Here is the bug report: https://bugs.swift.org/browse/SR-7327 https://bugs.swift.org/browse/SR-7329 We are waiting for the reply from the staff.

Zhaoxinak commented 6 years ago

大概什么时候好啊? 项目玩不动了

RingoD commented 6 years ago

Maybe you should revert your Xcode to 9.2 for emergency. Since it may result in a Swift bug, the communication between us and Swift staffs could be a hard work with unpredictable time.

acenqiu commented 6 years ago

Have reverted to 9.2, but my iPhone has upgraded to 11.3 😭

RingoD commented 6 years ago

I have tried to bypass these bugs to be compatible with Swift 4.1. BUT, The more I tried, the more bugs I encountered. Here's the additional issues I submitted: https://bugs.swift.org/browse/SR-7331 https://bugs.swift.org/browse/SR-7330

I recommend you to revert your Xcode to 9.2 until the Swift staffs reply us.

MrPans commented 6 years ago

@acenqiu same with you. Both of Swift or WCDB updating for this bug will cost much time. Maybe we have to waiting until Swift 5.0 release.

wuyuehyang commented 6 years ago

@acenqiu Use Xcode 9.3 with Swift 4.0.3 Toolchain

RingoD commented 6 years ago

@wuyuehyang Could you please give us a tutorial about using Xcode 9.3 with Swift 4.0.3 Toolchain?

wuyuehyang commented 6 years ago

@RingoD Download Swift 4.0.3 Toolchain on https://swift.org/download/#releases, install the pkg file and you may found toolchain options in Xcode menu, or Preferences -> Components->Toolchains

niyaoyao commented 6 years ago

@RingoD I have faced the same issue, it's seemed that I have to download a Xcode 9.2 for development. Looking forward next release.

niyaoyao commented 6 years ago

@wuyuehyang It failed with issue: "1. While emitting SIL for 'encode(to:)' in module 'WCDBSwift' " 😢

RingoD commented 6 years ago

@wuyuehyang It works. Thanks.

samzhiwei commented 6 years ago

@niyaoyao Same issue. Any idea?

tanpengsccd commented 6 years ago

@niyaoyao So do i

acenqiu commented 6 years ago

I tried to soft link Toolchains of 9.2 to 9.3 but with no luck. It seems like file format has changed in iOS 11.3 SDK.

Auto-Linking supplied '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks//Metal.framework/Metal.tbd', file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/System/Library/Frameworks//Metal.framework/Metal.tbd

RingoD commented 6 years ago

@acenqiu @tanpengsccd @niyaoyao
Did you try to delete the derived data folder and rebuild?

neonio commented 6 years ago

@RingoD I tried to delete derived data but it still not working

RingoD commented 6 years ago

@amoyio Are you building for simulator or device?

neonio commented 6 years ago

@RingoD I tried simulator(iPhone X) and device.

neonio commented 6 years ago

Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file /Users/buildnode/jenkins/workspace/oss-swift-4.0-package-osx/llvm/include/llvm/Support/Casting.h, line 236. 0 swift 0x000000010617df38 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40 ... 1. While emitting SIL for 'encode(to:)' in module 'WCDBSwift'

It looks strange because in error log, it still shows oss-swift-4.0-package-osx.

RingoD commented 6 years ago

@amoyio What about compiling WCDB only? Will you also get this error?

neonio commented 6 years ago

@RingoD Yes, same error.

tanpengsccd commented 6 years ago

delete the derived data folder ,the error still appear

RingoD commented 6 years ago

Sorry but I have no idea why it happens. Swift 4.0.3 toolchains work fine here and all the WCDB testcases are passed.

BBHNation commented 6 years ago

@wuyuehyang Unlucky for me, I download swift-4.0.3-toolchain and installed it, select swift-4.0.3-toolchain in Xcode 9.3 performance,but Xcode can NOT compile it. The Error shows like this:

2018-04-04 10 59 35

Help Please


update: error comes from Cocoapods, Xcode 9.3 work fine with swift-4.0.3-toolchain in a project without Cocoapods.

Just2Archi commented 6 years ago

image

-remove-runtime-asserts

Unfortunately, Xcode 9.3 with swift-4.0.3-toolchain dose not work for everybody.

I use two versions of Xcode which work like a charm.

You can download Xcode 9.2 from Apple Developer Center

image

tanpengsccd commented 6 years ago

for me , only Xcode 9.2 can work!

RingoD commented 6 years ago

Here's the summary of the 4 issues I submitted: Three of them may be the bugs of conditional conformance, which is the new feature of Swift 4.1. According to the SE-0143, it would be full implemented in Swift 4.2. BUT, Codable forces us to use this feature. So code will be safe from these bugs if they don't use that. Unfortunately, Codable is the basic dependency of ORM feature in WCDB. So, we are helpless.

Followed by details:

  1. SR-7327 It will be by design once in the next Swift release.
  2. SR-7329 Dynamically querying conditional conformance is not yet supported, which is resolved in the Swift development snapshots.
  3. SR-7330 It's a nil string crash of CFStringCreateCopy in Foundation framework. Maybe it will be fixed in Swift 4.2.(I hope.)
  4. SR-7331 No reply!
RingoD commented 6 years ago

@niyaoyao As I said, reverting your Xcode to 9.2 or using the Swift 4.0.3 toolchains.

JackLSH2016 commented 6 years ago

@BBHNation how to do that? can you give me a example?

BBHNation commented 6 years ago

@JackLSH2016 Here is how to using the Swift 4.0.3 toolchains in Xcode 9.3:

  1. Install Xcode 9.3
  2. Download Swift 4.0.3 toolchains on https://swift.org/download/#releases
  3. Double click the swift 4.0.3 pkg file to install.
  4. Open your Xcode 9.3 and you may found toolchain options in Xcode menu, or Preferences -> Components->Toolchains (as @wuyuehyang said).
JackLSH2016 commented 6 years ago

@BBHNation Thanks,It's really useful.

Pircate commented 6 years ago

@BBHNation build fail on Xcode9.3 beta.. Must be release?

fenghudd01 commented 6 years ago

as @BBHNation said, swift-4.0.3-toolchain is only works fine without CocoaPods, @RingoD have any idea to fix the issue below when we use swift-4.0.3-toolchain 1. While emitting SIL for 'encode(to:)' in module 'WCDBSwift'

RingoD commented 6 years ago

@hufengdd01 Just revert to 9.2

ghost commented 6 years ago

Remove Xcode project and swift please

RingoD commented 6 years ago

@chulito1 Sorry but I don't know what you mean.

huangxinyu1213 commented 6 years ago

@Just2Archi @BBHNation just restart Xcode, and you will find a Toolchains below Xcode's Preference.

JackLSH2016 commented 6 years ago

@BBHNation your project can run in device? My project run similator can work well,when run in device have below problem: dyld: Library not loaded: @rpath/WCDBSwift.framework/WCDBSwift Referenced from: /var/containers/Bundle/Application/7B294DDD-68DC-4F12-A8EC-1F5D3CED7847/wawameiyan.app/wawameiyan Reason: image not found I try to below way to resolve it, but failed. http://stackoverflow.com/questions/26024100/dyld-library-not-loaded-rpath-libswiftcore-dylib

bianzhifeng commented 6 years ago

hi, when can this problem be solved ?

RingoD commented 6 years ago

@bianzhifeng I think I already make it clear. You can use the way above to be compatible with it. Or waiting for the Swift staff.

wbtvc commented 6 years ago

swift4.1都不支持,还说支持4.0以上,还大厂呢一点小问题这么久了都没解决