Opened 8 years ago

Closed 8 years ago

#5480 closed bug (fixed)

Ghc 7.2.1 does not build anymore on NetBSD

Reported by: adegroot Owned by: igloo
Priority: high Milestone: 7.4.1
Component: Compiler Version: 7.2.1
Keywords: Cc:
Operating System: NetBSD Architecture: x86
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


While ghc 7.0.4 builds fine, changes between 7.0.4 and 7.2.1 breaks the build on NetBSD. The first patch fixes the build problem on NetBSD, I think it is mostly clean.

The second patch fixes some linker warning on NetBSD. It is probably incorrect in the generic case, so I would like your advice on it. The issue is that NetBSD keeps binary compatibilities by renaming functions incompatible with old NetBSD binaries in header files and if proper header files are not included, the linker complains above warning message like :

warning: reference to compatibility gettimeofday(); include <sys/time.h> to generate correct reference

This also happens when Haskell program calls FFI function that is renamed in some header file,

So the second patch provides some FFI wrappers for such functions in C files with proper header files included.

With this two patches, I'm able to pass most of the test on a NetBSD-5.99.55 / x86. There are still a few failures, but it need more investigations.

Best regards

Attachments (2)

ghc.netbsd.diff (5.2 KB) - added by adegroot 8 years ago.
patch for NetBSD build
ghc.netbsd.ffi.diff (14.8 KB) - added by adegroot 8 years ago.
patch to fix linker warning

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by adegroot

Attachment: ghc.netbsd.diff added

patch for NetBSD build

Changed 8 years ago by adegroot

Attachment: ghc.netbsd.ffi.diff added

patch to fix linker warning

comment:1 Changed 8 years ago by igloo

Milestone: 7.4.1
Priority: normalhigh
Status: newpatch

Thanks for the patches; I'll take a look

comment:2 Changed 8 years ago by igloo

Owner: set to igloo

comment:3 Changed 8 years ago by igloo@…

commit 498467cf44e871a6abdb1e16714f6e91c7b10a80

Author: Ian Lynagh <>
Date:   Fri Nov 25 01:12:47 2011 +0000

    Fixes for NetBSD
    Based on a patch from Arnaud Degroote <> in
    trac #5480.

 aclocal.m4                        |    5 ++++-
 compiler/main/DriverPipeline.hs   |    2 +-
 compiler/main/StaticFlags.hs      |    4 ++--
 compiler/nativeGen/PPC/CodeGen.hs |    1 +
 compiler/utils/Platform.hs        |    2 ++
 mk/                   |    1 +
 rts/RtsUtils.c                    |    2 +-
 7 files changed, 12 insertions(+), 5 deletions(-)

comment:4 Changed 8 years ago by adegroot

I can confirm that ghc current build fine on NetBSD/x86. Next job, x86_64 :D

comment:5 Changed 8 years ago by simonmar

Resolution: fixed
Status: patchclosed

Presumably we can close the ticket now, right?

Note: See TracTickets for help on using tickets.