Commit d42eeec3 authored by Simon Marlow's avatar Simon Marlow
Browse files

Fix #3201: "ar: Bad file number" build error with MSYS and SplitObjs=YES

parent ad9ca094
...@@ -777,6 +777,16 @@ LD_X = @LdXFlag@ ...@@ -777,6 +777,16 @@ LD_X = @LdXFlag@
# overflowing command-line length limits. # overflowing command-line length limits.
LdIsGNULd = @LdIsGNULd@ LdIsGNULd = @LdIsGNULd@
# On MSYS, building with SplitObjs=YES fails with
# ar: Bad file number
# see #3201. We need to specify a smaller max command-line size
# to work around it. 32767 doesn't work; 30000 does.
ifeq "$(Windows)" "YES"
XARGS = xargs -s 30000
else
XARGS = xargs
endif
# #
# In emergency situations, REAL_SHELL is used to perform shell commands # In emergency situations, REAL_SHELL is used to perform shell commands
# from within the ghc driver script, by scribbling the command line to # from within the ghc driver script, by scribbling the command line to
......
...@@ -160,7 +160,7 @@ $$(rts_$1_LIB) : $$(rts_$1_OBJS) rts/libs.depend ...@@ -160,7 +160,7 @@ $$(rts_$1_LIB) : $$(rts_$1_OBJS) rts/libs.depend
else else
$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_LIB) : $$(rts_$1_OBJS)
$$(RM) $$@ $$(RM) $$@
echo $$(rts_$1_OBJS) | xargs $$(AR) $$(EXTRA_AR_ARGS) $$@ echo $$(rts_$1_OBJS) | $$(XARGS) $$(AR) $$(EXTRA_AR_ARGS) $$@
endif endif
endef endef
......
...@@ -52,11 +52,11 @@ else ...@@ -52,11 +52,11 @@ else
ifeq "$$($1_$2_SplitObjs)" "YES" ifeq "$$($1_$2_SplitObjs)" "YES"
$$($1_$2_$3_LIB) : $$($1_$2_$3_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_$3_LIB) : $$($1_$2_$3_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS)
$$(RM) $$@ $$(RM) $$@
(echo $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) `$$($1_$2_$3_MKSTUBOBJS)`; find $$(patsubst %.$$($3_osuf),%_split,$$($1_$2_$3_HS_OBJS)) -name '*.$$($3_osuf)' -print) | xargs $$(AR) $$(EXTRA_AR_ARGS) $$@ (echo $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) `$$($1_$2_$3_MKSTUBOBJS)`; find $$(patsubst %.$$($3_osuf),%_split,$$($1_$2_$3_HS_OBJS)) -name '*.$$($3_osuf)' -print) | $$(XARGS) $$(AR) $$(EXTRA_AR_ARGS) $$@ || $(RM) $$@
else else
$$($1_$2_$3_LIB) : $$($1_$2_$3_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_$3_LIB) : $$($1_$2_$3_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS)
$$(RM) $$@ $$(RM) $$@
echo $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_$3_HS_OBJS) `$$($1_$2_$3_MKSTUBOBJS)` | xargs $$(AR) $$(EXTRA_AR_ARGS) $$@ echo $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_$3_HS_OBJS) `$$($1_$2_$3_MKSTUBOBJS)` | $$(XARGS) $$(AR) $$(EXTRA_AR_ARGS) $$@ || $(RM) $$@
endif endif
endif endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment