Build failure -- missing dependency? Help!

Viktor Dukhovni ietf-dane at
Mon Mar 15 10:44:20 UTC 2021

On Mon, Mar 15, 2021 at 09:46:35AM +0100, Sylvain Henry wrote:
> >
> > Thank you! Don’t forget to comment it – especially because it is fake.
> Done in

Speaking of build failures with the legacy make system, I see a build
failure on FreeBSD 12.2 with "validate --legacy" that I don't see with
hadrian.  It looks like the C compiler flags aren't quite the same and
warnings are more tolerated in the hadrian build.

The issue is that once "PosixSource.h" is included, FreeBSD (rightly I
believe) hides header prototypes of various non-POSIX extensions.  In
particular pthread_setname_np(3), is not exposed from <pthread.h>.

The hadrian build works fine, but the legacy build stops with a fatal
missing prototype.

The fix appears to be include <pthread.h> before "PosixSource.h" as
below.  Since we have no CI for FreeBSD, and this change only affects
FreeBSD, I'm not sure whether it makes sense to burn build CI cycles for
an MR with this change.  What's the right way to proceed?  FWIW, with
your MR and the below patch, the FreeBSD "validate --legacy"
successfully builds GHC.  [ The tests seem to all be failing, perhaps
the test driver scripts are not portable to FreeBSD, but previously
the compiler was not building. ]

--- a/rts/posix/Itimer.c
+++ b/rts/posix/Itimer.c
@@ -17,6 +17,12 @@
  * seems to support.  So much for standards.

+#include "ghcconfig.h"
+#if defined(freebsd_HOST_OS)
+#include <pthread.h>
+#include <pthread_np.h>
 #include "PosixSource.h"
 #include "Rts.h"


More information about the ghc-devs mailing list