Bug 697476

Summary: Rename string.h and math.h to avoid compile errors for customers in Xcode
Product: MuPDF Reporter: Joseph Heenan <joseph.heenan>
Component: fitzAssignee: MuPDF bugs <mupdf-bugs>
Status: RESOLVED FIXED    
Severity: major CC: tor.andersson
Priority: P2    
Version: master   
Hardware: iPad   
OS: iOS 9   
Customer: Word Size: ---

Description Joseph Heenan 2017-01-12 10:16:59 UTC
The default configuration of Xcode means that #include <math.h> in one of the mupdf headers resolves to fitz/math.h, which causes some very confusing errors.

The workaround is to USE_HEADERMAP = NO and make sure include/mupdf/fitz is NOT on the compiler's include path.

Arguably Xcode is wrong in this default behaviour, it's also not uncommon for iOS engineers to use recursive includes of the whole project dir which breaks things in the same way.

Anyway, I suggest to avoid continual pain for us/customers, rename string.h and math.h (to, say, fits-math.h perhaps).
Comment 1 Tor Andersson 2017-01-17 11:36:36 UTC
Fixed in commit 8577a7cf12ccdb258b773a03471663952fd12a4c
Author: Tor Andersson <tor.andersson@artifex.com>
Date:   Fri Jan 13 13:20:59 2017 +0100

    Fix 697476: Rename header files.
    
    Xcode has an idiotic default configuration where it gets confused by include
    search paths and file names in projects, so that it will load our
    "mupdf/fitz/math.h" instead of the system <math.h>.
    
    Work around this by renaming header files that have the same base name as a
    system header (even though they live in a subdirectory, and should never be
    available directly on the compiler's include path).