Bug 697476 - Rename string.h and math.h to avoid compile errors for customers in Xcode
Summary: Rename string.h and math.h to avoid compile errors for customers in Xcode
Status: RESOLVED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: fitz (show other bugs)
Version: master
Hardware: iPad iOS 9
: P2 major
Assignee: MuPDF bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-12 10:16 UTC by Joseph Heenan
Modified: 2017-01-17 11:36 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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).