ROOT 6.16.00 Compilation error on OSX 10.14 - ::signbit not found

I’ve resolved my issues and I am now able to successfully install root v6.16.00 on macOS 10.14 with Xcode 10 and Homebrew. Apologies for the long post, but I want to share my experiences with you as I struggled to get any decent information about resolving this issue.

I think the issue arises either from the standard “upgrade” procedure to macOS 10.14 Mojave or if you install legacy headers. If you install macOS 10.14 Mojave properly you should not have a /usr/include directory. For whatever reason, Apple have decided to move away from this Unix standard and instead all headers are now packaged within Xcode itself. Some people, including myself may have installed the legacy headers as instructed in the Xcode 10 README for other projects:

The Command Line Tools package installs the macOS system headers inside the macOS SDK. Software that compiles with the installed tools will search for headers within the macOS SDK provided by either Xcode at:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
or the Command Line Tools at:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
depending on which is selected using xcode-select.
The command line tools will search the SDK for system headers by default.
However, some software may fail to build correctly against the SDK and require macOS headers to be installed in the base system under /usr/include.
If you are the maintainer of such software, we encourage you to update your project to work with the SDK or file a bug report for issues that are preventing you from doing so. As a workaround, an extra package is provided which will install the headers to the base system.
In a future release, this package will no longer be provided. You can find this package at:
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
 To make sure that you're using the intended version of the command line tools, run xcode-select -s <path to Xcode> or xcode select -s /Library/Developer/CommandLineTools after installing.

When attempting to install ROOT v6.14.06 and subsequently ROOTv6.16.00 I kept running into “signbit” errors.
I detailed these in another post Problem installing ROOT v6.14.06 on macOS Mojave version 10.14.2
I noticed that ROOT attempted to link to these legacy headers in /usr/include

There may be other ways to remove the /usr/include directory (sudo does not work by default), but the way I approached it was to reinstall Mojave using recovery mode i.e. restart your Mac and the hold down command + R keys. Once the recovery screen opens choose to install Mojave. Installing this way is not a clean install (i.e. you will not erase everything on your Mac) and only overwrites system files not personal files & applications etc. This reinstall process successfully removed the /usr/include directory and any legacy headers residing within. I then made sure that Xcode and the command line tools were all installed successfully.

After this I ran brew update, brew outdated, brew upgrade and brew cleanup. If you want to use your Homebrew mysql and openssl make sure you run brew info for each of these and follow the instructions to export these to the PKG_CONFIG_PATH (if you use) and PATH.

After doing all of this I reinstalled ROOT, but I ran into a further problem at 76% when ROOT tries to build RMySQL. I noticed the following in the ROOT c++ build command -L/usr/local/opt/mysql@5.7/lib -lmysqlclient -lssl -lcrypto. Naturally this fails because libssl is not in the Homebrew mysql directory. Basically ROOT doesn’t pickup the Homebrew openssl lib directory despite successfully finding the Homebrew openssl lib during the CMake configure step e.g. the configure output message states

Found OpenSSL: /usr/local/Cellar/openssl/1.0.2q/lib/libcrypto.dylib (found version "1.0.2q")

Anyway you can solve this issue by simply exporting the Homebrew openssl path to your library path i.e. export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/

I have not attempted using the -Dmacos_native=ON flag, which maybe resolves the issues addressed here? For me at least, the steps I’ve outline above work and ROOT now installs from source on macOS 10.14.3 with Xcode 10.1 and Homebrew v2.0.1 and appears to work perfectly.