After enabling Enhaced Security the linker error Library 'c++polyfills' not found occurs (Simulator only)

After enabling Enhanced Security for an existing iOS project (mixed Objective-C / Swift) I get the linker error: Library 'c++polyfills' not found This happens when compiling for a simulator as run destination. Device builds (debug) or archiving a release build works. However I need to be able to test on a simulator...

Xcode version is 26.4.1, Simulator uses iOS 26.4.1

Answered by DTS Engineer in 887307022

Thanks for those extra titbits. Using that, I was able to reproduce the problem:

  1. Using Xcode 26.4, I created a new project from the iOS > App template, choosing Swift as the language.
  2. I set the deployment target to iOS 17.7.
  3. And chose Any iOS Simulator as the run target.
  4. I added the Enhanced Security capability and checked Enable Hardware Memory Tagging. At this point things were still building just fine.
  5. I added a new Objective-C class to the project.

And lo! that triggers the problem.

I then raised the deployment target up to iOS 18.6 and the problem went away. So, it seems like the combination of a simulator build for iOS 17 with MTE enabled. Interesting.

That’s clearly a supported configuration, so you should definitely file a bug about this. Once you’re done, reply here with your bug number so that I can add my own internal comments to it.

How much testing do you do in the iOS 17 simulator? If the answer is “None at all.” you could work around this by temporary raising the deployment target for your simulator build to iOS 18.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Interesting. Consider this:

% find /Applications/Xcode.app -name '*polyfills*'
…/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/lib/libc++polyfills.a
…/Platforms/DriverKit.platform/Developer/SDKs/DriverKit.sdk/System/DriverKit/usr/lib/libc++polyfills.a
…/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libc++polyfills.a
…/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/lib/libc++polyfills.a
…/Platforms/XROS.platform/Developer/SDKs/XROS.sdk/usr/lib/libc++polyfills.a
…/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libc++polyfills.a

Note how the library is present for all the real device platforms but is missing for all the simulator platforms (like iPhoneSimulator.platform). I suspect that the root cause of this issue is that this combination simply wasn’t anticipated. However, I’d like to learn a little more about your setup before I send you off to file a bug.

I tried reproducing this with a new project created from the built-in iOS > App template, but couldn’t. I suspect it’s because your project is using something C++-ish that requires it to bring in that library.

What’s your project’s deployment target?

Did you tweak any of the checkboxes in the Enhanced Security capability? If so, which ones?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hello Quinn,

thanks for your reply.

The deployment target is iOS 17.7

In the Enhanced Security capability I also added Hardware Memory Tagging (but not the soft mode)

The project had C++ code in it, since I did use the Receigen App (Mac App Store) for receipt validation, but I removed all the code including OpenSSL when I switched to StoreKit 2.

Currently the project just uses Objective C / plain C and Swift but no C++.

Cheers

Brian

Thanks for those extra titbits. Using that, I was able to reproduce the problem:

  1. Using Xcode 26.4, I created a new project from the iOS > App template, choosing Swift as the language.
  2. I set the deployment target to iOS 17.7.
  3. And chose Any iOS Simulator as the run target.
  4. I added the Enhanced Security capability and checked Enable Hardware Memory Tagging. At this point things were still building just fine.
  5. I added a new Objective-C class to the project.

And lo! that triggers the problem.

I then raised the deployment target up to iOS 18.6 and the problem went away. So, it seems like the combination of a simulator build for iOS 17 with MTE enabled. Interesting.

That’s clearly a supported configuration, so you should definitely file a bug about this. Once you’re done, reply here with your bug number so that I can add my own internal comments to it.

How much testing do you do in the iOS 17 simulator? If the answer is “None at all.” you could work around this by temporary raising the deployment target for your simulator build to iOS 18.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

After enabling Enhaced Security the linker error Library 'c++polyfills' not found occurs (Simulator only)
 
 
Q