Opened 10 years ago

Closed 10 years ago

Last modified 11 months ago

#3201 closed bug (fixed)

ar: Bad file number

Reported by: simonmar Owned by: simonmar
Priority: normal Milestone: 6.12.1
Component: Build System (make) Version: 6.10.2
Keywords: Cc: asklingenberg@…
Operating System: Windows Architecture: x86
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Satnam Singh reported to me that he gets

xargs: /c/ghc/ghc-6.10.1/bin/ar: Bad file number

when trying to build GHC on Windows using MSYS. Turning off SplitObjs works around it. We should verify and investigate.

Change History (5)

comment:1 Changed 10 years ago by Deewiant

Probably the same thing that I ran into with Gtk2hs:

Basicaly, MinGW's ar can't handle too many object files at once.

comment:2 Changed 10 years ago by asklinge

Cc: asklingenberg@… added

I get the same error. It appears to me to be a problem with xargs that does not realize it overflows the Windows command line, and passes truncated file names to ar.

What I do to get GHC to build in MSYS is move /bin/xargs.exe to /bin/_xargs.exe and create an xargs shell script:

_xargs -s 32767 $@

And it works with SplitObjs enabled. Quicker than editing multiple Makefiles, but it's a hack.

Maybe a solution is to set up a wrapper in the build system to call xargs in this fashion when building on MSYS?

comment:3 Changed 10 years ago by simonmar

Owner: set to simonmar

comment:4 Changed 10 years ago by simonmar

Resolution: fixed
Status: newclosed
Thu May 21 03:31:31 PDT 2009  Simon Marlow <>
  * Fix #3201: "ar: Bad file number" build error with MSYS and SplitObjs=YES

Incedentally: 32767 didn't work for me, but 30000 did.

comment:5 Changed 11 months ago by bgamari

Component: Build SystemBuild System (make)
Type of failure: None/Unknown

The new Hadrian build system has been merged. Relabeling the tickets concerning the legacy make build system to prevent confusion.

Note: See TracTickets for help on using tickets.