[gdal-dev] building on macOS - fatal error: 'direct.h' file not found

Mateusz Loskot mateusz at loskot.net
Tue Jun 28 03:14:06 PDT 2022


On Tue, 28 Jun 2022 at 03:28, Nik Sands <nik at nixanz.com> wrote:
> However, I’m getting numerous build errors, starting with the following error when running cmake to build GDAL 3.5.0:
>
>         fatal error: 'direct.h' file not found

Check cmake command output for

-- Looking for direct.h

and what is the look-up result it reports.

GDAL's CMake configuration checks for direct.h
https://github.com/OSGeo/gdal/blob/14be6dea87fd44dc58c3e6a2befb5913147ddbc7/cmake/helpers/configure.cmake#L38

> I’m a hobbyist and not a professional developer, so my understanding of these things is quite limited.

You can still build with Autotools!

> However, my research so far indicates that ‘direct.h’ is a Windows-specific header file

Correct.

> and therefore perhaps cmake has not been configured correctly for macOS in this GDAL distribution?

As per the earlier link, it's simple, it runs
`check_include_file("direct.h" HAVE_DIRECT_H)`
and if the header is found, then HAVE_DIRECT_H is set.
The CMake configuration does almost the same as the Autotools does:
https://github.com/OSGeo/gdal/blob/14be6dea87fd44dc58c3e6a2befb5913147ddbc7/configure.ac#L295

Question is, is HAVE_DIRECT_H set on macOS or not.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the gdal-dev mailing list