On FreeBSD 12 sys/sysctl.h requires sys/types.h
authorViktor Dukhovni <ietf-dane@dukhovni.org>
Sun, 10 Nov 2019 18:11:19 +0000 (13:11 -0500)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Sun, 24 Nov 2019 19:33:18 +0000 (14:33 -0500)
Else build fails with:

    In file included from ExecutablePath.hsc:42:
    /usr/include/sys/sysctl.h:1062:25: error: unknown type name 'u_int'; did you mean 'int'?
     int sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
     ^~~~~
     int
    compiling libraries/base/dist-install/build/System/Environment/ExecutablePath_hsc_make.c failed (exit code 1)

Perhaps also also other FreeBSD releases, but additional include
will no harm even if not needed.

libraries/base/System/Environment/ExecutablePath.hsc

index 3c9d36c..cdf39ea 100644 (file)
@@ -39,6 +39,7 @@ import Foreign.Marshal.Array
 import Foreign.Ptr
 import Foreign.Storable
 import System.Posix.Internals
+#include <sys/types.h>
 #include <sys/sysctl.h>
 #elif defined(mingw32_HOST_OS)
 import Control.Exception