5

I was just trying to use Xcode to work on a C program - (It was a gtk based one) and get errors saying "traditional headermap style is no longer supported please migrate to use separate hedermaps"

What is a headermap?

Googling for headermap and C/C/Objective-C only takes me back to this Xcode error message

Searching on Apple Devreloper site returns no results no useful information - it does find

The legacy header map that was generated when the Always Search User Paths (ALWAYS_SEARCH_USER_PATHS) setting was YES is not supported by the new build system. Instead, set ALWAYS_SEARCH_USER_PATHS to NO and migrate to using modern header include syntax. Add any needed header files that are in the project repository to the Xcode project to ensure they are available for use in #include (via the project wide header map). Use quote-style include ("example.h") for project headers, and reserve angle-bracket include (<example.h>) for system headers.

What is "modern header include syntax" and what standard is it defined in (or anywhere it is defined)

Where is the term headermap defined and what is it?

mmmmmm
  • 32,227
  • 27
  • 88
  • 117
  • There is an answer by @Mecki in this post that describes the header map well. [link](https://stackoverflow.com/questions/2596695/controlling-which-project-header-file-xcode-will-include) – embedded_guy Jan 28 '21 at 18:54
  • @embedded_guy Slightly cleaer but does not explain separate hedermaps or modern header include syntax - and where is the official documentstion (althouigh that last bit is OT here) – mmmmmm Jan 28 '21 at 19:00

1 Answers1

4

From this link , author Mark Mentovai

By default, Xcode uses a "header map" to communicate includes to gcc. The header map is supposed to be an optimization to reduce repetitive on-disk searching by the compiler. A header map is structured essentially as a hash table, keyed by names used in #includes, and providing pathnames to the actual files. Generally speaking, the header maps produced by Xcode provide access to all of the header files in either a target or a project file. Xcode informs the compiler to use one or more header maps by passing an -I or -iquote argument referencing the header map file instead of a directory. The compiler integrates header maps into its normal search order, except when encountering an -I or -iquote corresponding to a header map, it queries the header map file instead of searching a directory.

Header maps have spoiled several perfectly good days for me, so I always disable them in Xcode now by setting USE_HEADERMAP = NO. However, they're on by default and the setting to disable them doesn't have any UI, so most projects wind up relying on the header map, whether they intend to or not.

The header map file format isn't documented publicly as far as I know, but the format is simple and is understood by Apple gcc. Relevant source code is available at:

http://www.opensource.apple.com/darwinsource/DevToolsOct2008/gcc_42-5566/libcpp/include/cpplib.h http://www.opensource.apple.com/darwinsource/DevToolsOct2008/gcc_42-5566/gcc/c-incpath.c

Also refer to the header map rewriter in the distccd server at src/xci_headermap.c.

Bert
  • 2,134
  • 19
  • 19