Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

XCode 11: Can't find library libXCTestSwiftSupport.dylib when running tests #773

Open
neotron opened this issue Oct 14, 2019 · 12 comments
Open

Comments

@neotron
Copy link

neotron commented Oct 14, 2019

This appears to live in

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/lib/

and I can get it to run if I add the following to the command line:

TEST_FRAMEWORK_SEARCH_PATHS=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/lib/
@AnneTheAgile
Copy link
Contributor

We get this too, but it's intermittent. Is that what you have @neotron ?

@neotron
Copy link
Author

neotron commented Nov 8, 2019

It happens persistently for me on every run.

@ExtremeMan
Copy link
Contributor

Does this error happen when running Swift tests?

@AnneTheAgile
Copy link
Contributor

AnneTheAgile commented Nov 8, 2019

1.Update; our team used this solve;
Unit tests do not run on iOS 11 devices on Xcode 11 when using dynamically linked libraries · Issue #9165 · CocoaPods/CocoaPods: CocoaPods/CocoaPods#9165 (comment)

2.For me it was not actually intermittent
Xctool would always fail
xcodebuild by itself could pass
so it seems like an interaction, maybe xctool adds certain paths for us automagically @ExtremeMan ?

3.we are now still using xctool with fix [1] and all is well.
ty for a great project!

4.we have both swift tests and ios tests I believe in our project

@neotron
Copy link
Author

neotron commented Nov 8, 2019

We have mixed ObjC / Swift tests, and the tests depend on a library with mixed objc/swift code.

@ExtremeMan
Copy link
Contributor

@neotron do you think you can give me a test project where it is reproducible? I created several examples myself and couldn't repro the issue.

@ExtremeMan
Copy link
Contributor

Alternatively if you can build xctool locally, can you try this change: in XCToolUtil.m in function NSString *IOSTestFrameworkDirectories() add another entry to the array:

NSString *IOSTestFrameworkDirectories()
{
  NSArray *directories = @[
    [XcodeDeveloperDirPath() stringByAppendingPathComponent:@"Library/Frameworks"],
    [XcodeDeveloperDirPath() stringByAppendingPathComponent:@"Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks"],
    [XcodeDeveloperDirPath() stringByAppendingPathComponent:@"Platforms/iPhoneSimulator.platform/Developer/usr/lib"],
  ];
  return [directories componentsJoinedByString:@":"];
}

Another question I have - do you run logic or app tests? Because in case of app tests libXCTestSwiftSupport.dylib is part of app bundle.

@ExtremeMan
Copy link
Contributor

And is it iOS or OS X target? Thanks!

@neotron
Copy link
Author

neotron commented Dec 10, 2019

I can see if I can get a reproducible project. It's iOS / logic tests - not app bundle.

@ExtremeMan
Copy link
Contributor

Thanks! Or if it is easier to try with a suggested fix I can live with that :)

@ExtremeMan
Copy link
Contributor

For the test bundle - are tests in Swift, Objective-C or both?

@neotron
Copy link
Author

neotron commented Dec 10, 2019

It's a combination of Swift and Objective C - mostly ObjC. Same with the library where the actual code lives in.

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

No branches or pull requests

3 participants