#1201 building winsup/mingw fails to find cc1

cross (2)
Jay Krell

merged cygwin (winsup+newlib) tree with gcc tree

configure -build i686-pc-cygwin -host -i686-pc-cygwin -target i686-pc-mingw32


jay@jay-win9 /obj/gcc.1/i686-pc-cygwin/i686-pc-cygwin/i686-pc-cygwin/winsup/mingw
$ make
/obj/gcc.1/i686-pc-cygwin/i686-pc-cygwin/./gcc/xgcc -nostdinc -c -D__CRTDLL__ -U
__MSVCRT__ -g -g -I/src/gcc/winsup/mingw/include -I/src/gcc/winsup/mingw/../in
clude -nostdinc -iwithprefixbefore include -I /src/gcc/winsup/mingw/../w32api/in
clude -mno-cygwin /src/gcc/winsup/mingw/crt1.c -o crt1.o
xgcc: error trying to exec 'cc1': execvp: No such file or directory
make: *** [crt1.o] Error 1

The problem is that in winsup/mingw/Makefile, CC's -B and -L options are all
removed, in order to avoid picking up cygwin files. This code:

CC := @CC@
override CC := ${filter-out -L% -B%,${shell echo $(CC) | sed -e 's%\(-isystem\|-iwithprefixbefore\) *[^ ]*\( \|$$\)% %g'}}
# FIXME: Which is it, CC or CC_FOR_TARGET?

This is too aggressive.
An easy fix is to add -B../../../gcc to the end after the removals.
The real point is to add xgcc's directory to -B.

- Jay


  • jay_krell

    Why am I the only one who sees this?

    Here is a much less sleazy patch for it:

    $ diff -Naur /src/cygwin-snapshot-20080827-1.orig/winsup/mingw/Makefile.in /src
    --- /src/cygwin-snapshot-20080827-1.orig/winsup/mingw/Makefile.in 2008-08-
    01 12:13:23.000000000 -0700
    +++ /src/cygwin-snapshot-20080827-1/winsup/mingw/Makefile.in 2008-09-09 03:19
    :31.295250000 -0700
    @@ -88,7 +88,30 @@

    CC := @CC@
    ifneq (,$(findstring cygwin,$(target_alias)))
    -override CC := ${filter-out -L% -B%,${shell echo $(CC) | sed -e 's%\(-isystem\|
    -iwithprefixbefore\) *[^ ]*\( \|$$\)% %g'}}
    +# if target contains "cygwin", then remove from CC all -L, -B, -system, -withpr
    efixbefore options,
    +# EXCEPT for the first -B option, if it is the second word of CC.
    +# CC is typically like CC := /obj/gcc.4/./gcc/xgcc -B/obj/gcc.4/./gcc/ ...
    +# and if that first -B option is omitted, then:
    +# make[3]: Entering directory `/obj/gcc.4/i686-pc-cygwin/winsup/mingw'
    +# /obj/gcc.4/./gcc/xgcc -nostdinc -c -D__CRTDLL__ -U__MSVCRT__ -O2 -g -g -O2
    -I/src/gcc/winsup/mingw/include -I/src/gcc/winsup/mingw/../include -nostdinc -
    iwithprefixbefore include -I /src/gcc/winsup/mingw/../w32api/include -mno-cygwin
    /src/gcc/winsup/mingw/crt1.c -o crt1.o
    +# xgcc: error trying to exec 'cc1': execvp: No such file or directory
    +# We want instead:
    +# /obj/gcc.4/./gcc/xgcc -B/obj/gcc.4/./gcc/ -nostdinc -c -D__CRTDLL__ -U__MSV
    CRT__ -O2 -g -g -O2 -I/src/gcc/winsup/mingw/include -I/src/gcc/winsup/mingw/..
    /include -nostdinc -iwithprefixbefore include -I /src/gcc/winsup/mingw/../w32api
    /include -mno-cygwin /src/gcc/winsup/mingw/crt1.c -o crt1.o
    +# Another good implementation would be that if the first word of CC ends in "./
    gcc/xgcc", then
    +# add -B of the first word's dir.
    +# Yet another very good implementation would be if realpath(second word, withou
    t the -B) + /xgcc == realpath(first word),
    +# then preserve the second word.
    +# It does not appear one can check for string equality.
    +# Therefore, we use findstring(a,b) and findstr(b,a) to imply a == b.
    +# And since findstring and "and" return the input non-empty string for a true o
    utput, the result of and is what we append.
    +override CC := ${filter-out -L% -B%,${shell echo $(CC) | sed -e 's%\(-isystem\|
    -iwithprefixbefore\) *[^ ]*\( \|$$\)% %g'}} \ + ${and ${findstring ${firstword ${filter -B%,$(CC)}},${word 2,$(CC)}},${findstr
    ing ${word 2,$(CC)},${firstword ${filter -B%,$(CC)}}}}
    # FIXME: Which is it, CC or CC_FOR_TARGET?

    jay@jay-win9 ~

  • Earnie Boyd
    Earnie Boyd

    • labels: mingw runtime (deprecated use WSL) --> cross
    • status: open --> closed
    • resolution: --> out-of-date
    • category: --> Unknown
    • milestone: --> OTHER