ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Building under OSX Yosemite using cmake

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Mon, 10 Nov 2014 19:59:48 -0800
On Nov 10, 2014, at 6:18 PM, David Ameiss <netshark@xxxxxxxxxxxxx> wrote:

> Not sure. However, on a Mavericks system with Xcode 6.1, it was NOT in the makefiles. Which likely means it’s something with dependencies (differing between 10.9 and 10.10), or some odd difference between the command line tools for 10.9 and 10.10.

No, it's a difference between Kernel.framework in 10.9 and 10.10, coupled with the way that we search for the math.h header (presumably because it might be in some strange place, rather than the standard include directory, on some platforms).

Kernel.framework is a framework that exists to supply headers, and some other information, for use when building *kernel-mode* loadable modules for OS X.  It may have some headers that are similar to standard headers for userland, but that are *not* usable when building userland code; the Kernel.framework string.h header is one of them.

For some unknown reason, Kernel.framework's headers, in Yosemite, include math.h.  There's no sign of math.h in the XNU source tree for Yosemite, and I really don't think Apple are encouraging kernel module developers to calculate trigonometric functions or Bessel functions or... in their kernel code, but maybe they are, these days.

This means that the search for math.h in FindM.cmake finds it in the Kernel.framework header directory, so CMake adds that to the list of directories in which to search for header files, adding a -I flag to the build process.  Hilarity ensues.

I've checked in a workaround, having FindM.cmake forcibly set CMAKE_FIND_FRAMEWORK to LAST before trying to find math.h and then restoring its previous value.

I'll file a bug with Apple to complain about math.h's presence; hopefully, if that's intentional, they'll at least tell me so, and perhaps tell me why as well.