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

Cannot find or use auto-linked libraries XCTestSwiftSupport and XCTest #2155

Closed
4 of 17 tasks
memoriesus opened this issue Mar 25, 2020 · 13 comments
Closed
4 of 17 tasks

Comments

@memoriesus
Copy link

memoriesus commented Mar 25, 2020

⚠️ If you don't have something to report in the following format, it will probably be easier and faster to ask in the slack channel first. ⚠️

⚠️ Please take you time to fill in the fields below. If we aren't provided with this basic information about your issue we probably won't be able to help you and there won't be much we can do except to close the issue :( ⚠️

If you still want to report issue, please delete above statements before submitting an issue.

Short description of the issue:

I updated my Xcode 11.4 and then build the project(it's okay, changed nothing, but it shows the error cannot find or use auto-linked libraries XCTestSwift Support and XCTest.

Undefined symbols for architecture arm64:
"_swift_FORCE_LOAD$XCTestSwiftSupport", referenced from:
_swift_FORCE_LOAD$XCTestSwiftSupport$RxTest in RxTest.o
"XCTest.XCTFail(
: Swift.String, file: Swift.StaticString, line: Swift.UInt) -> ()", referenced from:
RxTest.XCTAssertRecordedElements(
: [RxTest.Recorded<RxSwift.Event>], : [A], file: Swift.StaticString, line: Swift.UInt) -> () in RxTest.o
"XCTest.XCTAssertEqual
(: @autoclosure () throws -> A, _: @autoclosure () throws -> A, : @autoclosure () -> Swift.String, file: Swift.StaticString, line: Swift.UInt) -> ()", referenced from:
RxTest.XCTAssertEqual
(: [RxSwift.Event], : [RxSwift.Event], file: Swift.StaticString, line: Swift.UInt) -> () in RxTest.o
RxTest.XCTAssertEqual(
: [RxSwift.SingleEvent], : [RxSwift.SingleEvent], file: Swift.StaticString, line: Swift.UInt) -> () in RxTest.o
RxTest.XCTAssertEqual(
: [RxSwift.MaybeEvent], : [RxSwift.MaybeEvent], file: Swift.StaticString, line: Swift.UInt) -> () in RxTest.o
RxTest.XCTAssertEqual(
: [RxSwift.CompletableEvent], : [RxSwift.CompletableEvent], file: Swift.StaticString, line: Swift.UInt) -> () in RxTest.o
RxTest.XCTAssertEqual
(: [RxTest.Recorded<RxSwift.Event>], : [RxTest.Recorded<RxSwift.Event>], file: Swift.StaticString, line: Swift.UInt) -> () in RxTest.o
RxTest.XCTAssertEqual(
: [RxTest.Recorded<RxSwift.Event<A?>>], : [RxTest.Recorded<RxSwift.Event<A?>>], file: Swift.StaticString, line: Swift.UInt) -> () in RxTest.o
RxTest.XCTAssertRecordedElements
(: [RxTest.Recorded<RxSwift.Event>], _: [A], file: Swift.StaticString, line: Swift.UInt) -> () in RxTest.o

Expected outcome:

build successfully

What actually happens:
Failed to find or use auto-linked libraries XCTestSwiftSupport and XCTest

what actually happens goes here

Self contained code example that reproduces the issue:

  code goes here
  
// If we can't get a self contained code example that reproduces the issue, there is a big chance we won't be able
// to help you because there is not much we can do.
//
// `Self contained code example` means:
//
// * that we should be able to just run the provided code without changing it.
// * that it will reproduce the issue upon running

RxSwift/RxCocoa/RxBlocking/RxTest version/commit

version or commit here

Platform/Environment

  • iOS
  • macOS
  • tvOS
  • watchOS
  • playgrounds

How easy is to reproduce? (chances of successful reproduce after running the self contained code)

  • easy, 100% repro
  • sometimes, 10%-100%
  • hard, 2% - 10%
  • extremely hard, %0 - 2%

Xcode version:

Xcode 11.4

⚠️ Fields below are optional for general issues or in case those questions aren't related to your issue, but filling them out will increase the chances of getting your issue resolved. ⚠️

Installation method:

  • CocoaPods
  • Carthage
  • Git submodules

I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)

  • yes (which ones)
  • no

Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)

  • just starting
  • I have a small code base
  • I have a significant code base
@freak4pc
Copy link
Member

Please provide more details. Package manager, reproducible sample, etc.

@memoriesus
Copy link
Author

@freak4pc Thank for your replies, because the libraries was private, I cannot share the code.
I just do only one thing, I updated Xcode and then rebuild my project ,the error occurs.
It looks like the issuelink error
But based on the answer from stack overflow custom building setting cannot solve this issue.

@freak4pc
Copy link
Member

All my tests are running, without further details I can't help much.
Can you share the package manager you're using?

@memoriesus
Copy link
Author

Screen Shot 2020-03-25 at 22 21 58

Yeah like that

@freak4pc
Copy link
Member

freak4pc commented Mar 25, 2020

Ok, so In general Swift Package Manager has some serious duplicate issues. I’ve filed several bugs to Apple and the SPM team about this but it wasn’t resolved yet. See #2063 for example.

Unfortunately I don’t have a proper solution for you since this is a SPM bug, not an RxSwift bug.

@memoriesus
Copy link
Author

Ok, buggy apple.....Hope all will be better tomorrow morning...Haha

@dannyhertz
Copy link

dannyhertz commented Mar 27, 2020

FWIW I'm seeing this issue only using Cocoapods not SPM at all. Here are the relevant lines of my podspec file:

  s.swift_version = '5.0'
  s.dependency 'DeviceKit'
  s.dependency 'RxTest'
  s.dependency 'RxSwift', '5.1.1'
  s.dependency 'SnapshotTesting', '1.7.2'

And here is the podfile.lock of the example project that is failing:

PODS:
  - ButterflyCore (0.1.0):
    - Overture
    - RxSwift (~> 5.1.1)
  - ButterflyCoreTestHelpers (0.1.0):
    - DeviceKit
    - RxSwift (= 5.1.1)
    - RxTest
    - SnapshotTesting (= 1.7.2)
  - DeviceKit (3.0.0)
  - Overture (0.5.0)
  - RxSwift (5.1.1)
  - RxTest (5.1.1):
    - RxSwift (~> 5)
  - SnapshotTesting (1.7.2)

DEPENDENCIES:
  - ButterflyCore (from `../`)
  - ButterflyCoreTestHelpers (from `../../ButterflyCoreTestHelpers/ButterflyCoreTestHelpers.podspec`)

SPEC REPOS:
  trunk:
    - DeviceKit
    - Overture
    - RxSwift
    - RxTest
    - SnapshotTesting

EXTERNAL SOURCES:
  ButterflyCore:
    :path: "../"
  ButterflyCoreTestHelpers:
    :path: "../../ButterflyCoreTestHelpers/ButterflyCoreTestHelpers.podspec"

SPEC CHECKSUMS:
  ButterflyCore: a5ef778d7a428f6335d468ada5794ef805a7f828
  ButterflyCoreTestHelpers: d96c7294586178408012ce8960c93f1f099814bb
  DeviceKit: fc3c2bd361a8d68d8a91eb715e453aede57317e5
  Overture: 2e6252ead5da6d3347f758047f27a31cb469d59d
  RxSwift: 81470a2074fa8780320ea5fe4102807cb7118178
  RxTest: 711632d5644dffbeb62c936a521b5b008a1e1faa
  SnapshotTesting: 8caa6661fea7c8019d5b46de77c16bab99c36c5c

PODFILE CHECKSUM: ca9bab34386e851959dfcb17d4b27b10ed8365b0

COCOAPODS: 1.8.4

@freak4pc
Copy link
Member

Any way for you to provide a repro project @dannyhertz ?

@dannyhertz
Copy link

dannyhertz commented Mar 28, 2020

@freak4pc very sorry for the false alarm. Turns out these were missing from the podspec of my test helper pod.

  s.frameworks = "XCTest"
  s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO' }

Strange that things were working before in 11.3 without them. Thanks again!

@memoriesus
Copy link
Author

memoriesus commented Apr 4, 2020

@freak4pc Perhaps the issue has a relationship with RxSwift, I remove dependency about RxSwift, the error disappeared at once, I use SPM to manage other libraries like Kingfisher and Promise, all is okay.
It looks like the issue #2127

@freak4pc
Copy link
Member

freak4pc commented Apr 7, 2020

As mentioned, this is an issue with SPM specifically. The other frameworks you mentioned aren't comparable because they're a single framework, while RxSwift inclues 5 different products, while some of them depend on each other and have specific test products.

@memoriesus
Copy link
Author

Okay, hope it can be solved very soon...

@freak4pc
Copy link
Member

Closing this, see #2127 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants