Undefined symbol _swift_getFunctionReplacement

Hello,

We're struggling with building our app. We are updating to Xcode 11.1, and linker always fails with the error:

Undefined symbols for architecture x86_64:
  "_swift_getFunctionReplacement", referenced from:
      _swift_getFunctionReplacement50 in libswiftCompatibilityDynamicReplacements.a(DynamicReplaceable.cpp.o)

Apparently it implicitly adds libswiftCompatibilityDynamicReplacements.a to linker and that library needs these 2 functions (_swift_getFunctionReplacement and _swift_getOrigOfReplaceable) to be available, but for some reason they are missing.

Could you please provide any advice how to solve this issue?

4 Likes

Have you tried Xcode 11.2?

I'm investigating the issue, my current guess is that we accidentally linked wrong dependencies to an application target (special app for internal use). They were dependencies for UnitTests and they themselves were dependent upon XCTest, which I think is not the exact cause of the problem. I can not say what is the root cause of the problem at the moment.

It somehow worked in Xcode 10 and stopped working in Xcode 11.1. Put this issue on hold.

The issue was caused by this line: 'LIBRARY_SEARCH_PATHS' => '$(TOOLCHAIN_DIR)/usr/lib/swift-$(SWIFT_VERSION)/$(PLATFORM_NAME) $(inherited)' in a podspec of testing framework.

The line was added, because it was the only way to link with XCTest properly on Xcode 11. It is the only way I found on the internet so far and I was working on this problem for a long time.

It would be nice to know a better way to make a cocoapods pod that links with XCTest.

Example of pull request with fix: https://github.com/Brightify/Cuckoo/pull/315 (this fixed linking in runtime if tests are built with Xcode 11).

Similar issue (making pod for testing): https://github.com/ReactiveX/RxSwift/issues/2072

1 Like

Yes, we've tried Xcode 11.2, same issue appears.

We also want to link with XCTAutomationSupport to use some really awesome private APIs for custom searching of elements (XCElementSnapshot) and many many more. I know it was a risky idea, but without it we wouldn't be able to get where we are now in UI testing.

The problem was solved by setting DEAD_CODE_STRIPPING to YES

1 Like
Terms of Service

Privacy Policy

Cookie Policy