Xcode 8, Cocoa Touch Framework, mm_malloc.h not found

We have a Cocoa Touch Framework which consists of an Objective-C front-end wrapping a C/C++ cross-platform code base. We've been building this framework on Yosemite using Xcode 7.2.1. We now have a build machine running macos Sierra, with Xcode 8 and Xcode 7.2.1 installed (Xcode.app and Xcode7.2.1.app). We can still build our framework using Xcode 7.2.1, but we'd like move forward.


When attempting to build using Xcode 8, we're getting the compiler error "Implicit declaration of function '_mm_malloc' is invalid in C99...". We're also getting "Module '_Builtin_intrinsics.intel.mm_malloc' requires feature 'x86' module.modulemap.


To illustrate the issue:

  • Create an iOS Cocoa Touch Framework
  • Create a new .c file
  • Then add #include <mm_malloc.h> to the source file
  • Build


In Xcode 8, you will get the error "Module '_Builtin_intrinsics.intel.mm_malloc' requires feature 'x86' module.modulemap"


In Xcode 7.2.1, your build should succeed. If you cmd+click <mm_malloc.h>, you will be taken to the source file for mm_malloc.h.

On my machine, the path is:

/Applications/Xcode7.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/7.0.2/include/mm_malloc.h


In Xcode 8, you cannot cmd+click <mm_malloc.h>, Xcode doesn't seem to know where it lives, and pops up the "?".

Again, the framework built using Xcode 7.2.1 has been incorporated into iOS enterprise apps and successfully runs on recent iPhone and iPad devices through iOS 9+, including iOS 7.1.2 running on an iPhone 4 -- technically on iOS 7.1.2 on iPhone 4, as the framework has yet to be included in an application submitted to the appstore.


By the way, we started building this Cocoa Touch Framework in Xcode 6.4. Was this a fluke that our framework compiled in both Xcode 6.4 and Xcode 7.2.1? Or is this a bug in Xcode 8? Or what added settings are needed to get this framework to compile in Xcode 8?

I believe I have a better understanding as to what's going on. The header mm_malloc.h is indeed being found, but the module.modulemap file is implicitly being loaded as it's a sibling file in the same folder/directory. That module.modulemap states among other things, that mm_malloc.h is explicitly restricted to 'x86', and therefore, the issue when attempting to build a Cocoa Touch Framework. However, in Xcode 7.2.1, this is not an issue, so it appears that the 'feature' is now working, to my demise.


It turns out, that there's a clang switch that I can turn off, the default is implicit-module-maps. Using -fno-implicit-module-maps allows my build to successfully complete. I believe this is okay, for me, as the public interface of my framework, an Obj-C header, is isolated from the C/C++ cross platform code base used within.

Xcode 8, Cocoa Touch Framework, mm_malloc.h not found
 
 
Q