mmp / pbrt-v3

Source code for pbrt, the renderer described in the third edition of "Physically Based Rendering: From Theory To Implementation", by Matt Pharr, Wenzel Jakob, and Greg Humphreys.
http://pbrt.org
BSD 2-Clause "Simplified" License
4.86k stars 1.18k forks source link

Build error in OSX Mojave(10.14.2). Here is error info and the solution to fix it. #247

Closed AlcEccentric closed 4 years ago

AlcEccentric commented 5 years ago

There are multiple similar errors shown in the cmath file like

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:315:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'? using ::isfinite; ......

I found a solution in a post of this link: https://github.com/neovim/neovim/issues/9050 The reason is

Starting with Mojave, the headers are no longer installed under /usr/include/ by default.

To fix it, you should run open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg to install a compatibility package. This can only help you to build pbrt successfully with make command, which means the build still fails in the Xcode.

BTW, the post above said:

The release notes also states that this compatibility package will no longer be provided in the near future, so the build system on macOS will have to be adapted to look for headers in the SDK, making this (at that future point) indeed an nvim issue (if you do not want to punt this to homebrew).

I am doubting whether this will also be a pbrt issue in future. @mmp

mmp commented 4 years ago

I've spent a bunch of time looking into this. It's not clear to me that there's a need to have the headers in /usr/include to build pbrt. In particular, nothing in the build scripts requires that, and, as one data-point, I don't have a /usr/include on the Mojave system I use for development and pbrt builds fine.

I'm wondering if you upgraded to Mojave, didn't re-run cmake, and then saw that error--i.e. if the generated Makefiles from before had direct references to /usr/include that stopped working.