Bug 88321 - Crosscompiled gcc does not use preinstalled as
Summary: Crosscompiled gcc does not use preinstalled as
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 8.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-03 16:45 UTC by Daniel Fruzynski
Modified: 2024-04-09 04:19 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Fruzynski 2018-12-03 16:45:03 UTC
I have build gcc 8.2.0 as as crosscompiler for Centos 7 x86_64 -> MinGW x86_64. Before starting I installed gcc 4.9.3 MinGW crosscompiler from EPEL repository. 

My new crosscompiler was configured in following way:

[root@localhost build]# ../gcc-8.2.0/configure --prefix=/gcc-8.2-mingw/ --enable-languages=c,c++ --disable-multilib --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=x86_64-w64-mingw32 --without-newlib --disable-multilib --disable-plugin --with-system-zlib --disable-nls --without-included-gettext --disable-win32-registry --enable-threads=posix --enable-libgomp --with-sysroot=/usr/x86_64-w64-mingw32/sys-root --with-gxx-include-dir=/usr/x86_64-w64-mingw32/sys-root/mingw/include/c++
checking build system type... x86_64-redhat-linux-gnu
checking host system type... x86_64-redhat-linux-gnu
checking target system type... x86_64-w64-mingw32
checking for a BSD-compatible install... /bin/install -c
checking whether ln works... yes                                                                                             
checking whether ln -s works... yes                                                                                          
checking for a sed that does not truncate output... /bin/sed                                                                 
checking for gawk... gawk                                                                                                    
checking for libatomic support... yes
checking for libitm support... no
checking for libsanitizer support... no
checking for libvtv support... yes
checking for libmpx support... no
checking for libhsail-rt support... no
checking for x86_64-redhat-linux-gnu-gcc... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for x86_64-redhat-linux-gnu-g++... no
checking for x86_64-redhat-linux-gnu-c++... no
checking for x86_64-redhat-linux-gnu-gpp... no
checking for x86_64-redhat-linux-gnu-aCC... no
checking for x86_64-redhat-linux-gnu-CC... no
checking for x86_64-redhat-linux-gnu-cxx... no
checking for x86_64-redhat-linux-gnu-cc++... no
checking for x86_64-redhat-linux-gnu-cl.exe... no
checking for x86_64-redhat-linux-gnu-FCC... no
checking for x86_64-redhat-linux-gnu-KCC... no
checking for x86_64-redhat-linux-gnu-RCC... no
checking for x86_64-redhat-linux-gnu-xlC_r... no
checking for x86_64-redhat-linux-gnu-xlC... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... no
checking for x86_64-redhat-linux-gnu-gnatbind... no
checking for gnatbind... no
checking for x86_64-redhat-linux-gnu-gnatmake... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
configure: WARNING: using in-tree isl, disabling version check
*** This configuration is not supported in the following subdirectories:
     zlib target-libitm target-libsanitizer target-libmpx target-libffi target-libgo gnattools gotools target-libada target-libhsail-rt target-libgfortran target-libbacktrace target-libobjc target-liboffloadmic
    (Any other directories should still work fine.)
checking for default BUILD_CONFIG... 
checking for --enable-vtable-verify... no
checking for bison... bison -y
checking for bison... bison
checking for gm4... no
checking for gnum4... no
checking for m4... m4
checking for flex... flex
checking for flex... flex
checking for makeinfo... makeinfo
checking for expect... no
checking for runtest... no
checking for x86_64-redhat-linux-gnu-ar... no
checking for ar... ar
checking for x86_64-redhat-linux-gnu-as... no
checking for as... as
checking for x86_64-redhat-linux-gnu-dlltool... no
checking for dlltool... no
checking for x86_64-redhat-linux-gnu-ld... no
checking for ld... ld
checking for x86_64-redhat-linux-gnu-lipo... no
checking for lipo... no
checking for x86_64-redhat-linux-gnu-nm... no
checking for nm... nm
checking for x86_64-redhat-linux-gnu-ranlib... no
checking for ranlib... ranlib
checking for x86_64-redhat-linux-gnu-strip... no
checking for strip... strip
checking for x86_64-redhat-linux-gnu-windres... no
checking for windres... no
checking for x86_64-redhat-linux-gnu-windmc... no
checking for windmc... no
checking for x86_64-redhat-linux-gnu-objcopy... no
checking for objcopy... objcopy
checking for x86_64-redhat-linux-gnu-objdump... no
checking for objdump... objdump
checking for x86_64-redhat-linux-gnu-readelf... no
checking for readelf... readelf
checking for x86_64-w64-mingw32-cc... no
checking for x86_64-w64-mingw32-gcc... x86_64-w64-mingw32-gcc
checking for x86_64-w64-mingw32-c++... x86_64-w64-mingw32-c++
checking for x86_64-w64-mingw32-gcc... x86_64-w64-mingw32-gcc
checking for x86_64-w64-mingw32-gfortran... no
checking for x86_64-w64-mingw32-gccgo... no
checking for ar... no
checking for x86_64-w64-mingw32-ar... x86_64-w64-mingw32-ar
checking for as... no
checking for x86_64-w64-mingw32-as... x86_64-w64-mingw32-as
checking for dlltool... no
checking for x86_64-w64-mingw32-dlltool... x86_64-w64-mingw32-dlltool
checking for ld... no
checking for x86_64-w64-mingw32-ld... x86_64-w64-mingw32-ld
checking for lipo... no
checking for x86_64-w64-mingw32-lipo... no
checking for nm... no
checking for x86_64-w64-mingw32-nm... x86_64-w64-mingw32-nm
checking for objcopy... no
checking for x86_64-w64-mingw32-objcopy... x86_64-w64-mingw32-objcopy
checking for objdump... no
checking for x86_64-w64-mingw32-objdump... x86_64-w64-mingw32-objdump
checking for ranlib... no
checking for x86_64-w64-mingw32-ranlib... x86_64-w64-mingw32-ranlib
checking for readelf... no
checking for x86_64-w64-mingw32-readelf... x86_64-w64-mingw32-readelf
checking for strip... no
checking for x86_64-w64-mingw32-strip... x86_64-w64-mingw32-strip
checking for windres... no
checking for x86_64-w64-mingw32-windres... x86_64-w64-mingw32-windres
checking for windmc... no
checking for x86_64-w64-mingw32-windmc... x86_64-w64-mingw32-windmc
checking where to find the target ar... pre-installed
checking where to find the target as... pre-installed
checking where to find the target cc... just compiled
checking where to find the target c++... just compiled
checking where to find the target c++ for libstdc++... just compiled
checking where to find the target dlltool... pre-installed
checking where to find the target gcc... just compiled
checking where to find the target gfortran... pre-installed
checking where to find the target gccgo... pre-installed
checking where to find the target ld... pre-installed
checking where to find the target lipo... pre-installed
checking where to find the target nm... pre-installed
checking where to find the target objcopy... pre-installed
checking where to find the target objdump... pre-installed
checking where to find the target ranlib... pre-installed
checking where to find the target readelf... pre-installed
checking where to find the target strip... pre-installed
checking where to find the target windres... pre-installed
checking where to find the target windmc... pre-installed
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
config.status: creating Makefile
[root@localhost build]# 

Build also completed successfully. However when I tried to use it, it turned out that it is broken. Looks that configure script found preinstalled binutils, but path to it is not hardcoded in built crosscompiler. Here is output from build with --verbose option:

[root@localhost 1]# /gcc-8.2-mingw/bin/x86_64-w64-mingw32-gcc b.c --verbose
Using built-in specs.
COLLECT_GCC=/gcc-8.2-mingw/bin/x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/gcc-8.2-mingw/libexec/gcc/x86_64-w64-mingw32/8.2.0/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../gcc-8.2.0/configure --prefix=/gcc-8.2-mingw/ --enable-languages=c,c++ --disable-multilib --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=x86_64-w64-mingw32 --without-newlib --disable-multilib --disable-plugin --with-system-zlib --disable-nls --without-included-gettext --disable-win32-registry --enable-threads=posix --enable-libgomp --with-sysroot=/usr/x86_64-w64-mingw32/sys-root --with-gxx-include-dir=/usr/x86_64-w64-mingw32/sys-root/mingw/include/c++
Thread model: posix
gcc version 8.2.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 /gcc-8.2-mingw/libexec/gcc/x86_64-w64-mingw32/8.2.0/cc1 -quiet -v -D_REENTRANT b.c -quiet -dumpbase b.c -mtune=generic -march=x86-64 -auxbase b -version -o /tmp/ccqSPwgR.s
GNU C17 (GCC) version 8.2.0 (x86_64-w64-mingw32)
        compiled by GNU C version 4.8.5 20150623 (Red Hat 4.8.5-28), GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/x86_64-w64-mingw32/sys-root/usr/local/include"
ignoring nonexistent directory "/gcc-8.2-mingw/lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
 /gcc-8.2-mingw/lib/gcc/x86_64-w64-mingw32/8.2.0/include
 /gcc-8.2-mingw/lib/gcc/x86_64-w64-mingw32/8.2.0/include-fixed
 /usr/x86_64-w64-mingw32/sys-root/mingw/include
End of search list.
GNU C17 (GCC) version 8.2.0 (x86_64-w64-mingw32)
        compiled by GNU C version 4.8.5 20150623 (Red Hat 4.8.5-28), GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 469d3d21441592861ac6e22f11562b56
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 as -v -o /tmp/ccKqLs8c.o /tmp/ccqSPwgR.s
GNU assembler version 2.27 (x86_64-redhat-linux) using BFD version version 2.27-28.base.el7_5.1
/tmp/ccqSPwgR.s: Assembler messages:
/tmp/ccqSPwgR.s:3: Error: unknown pseudo-op: `.def'
/tmp/ccqSPwgR.s:3: Error: unknown pseudo-op: `.scl'
/tmp/ccqSPwgR.s:3: Error: Missing symbol name in directive
/tmp/ccqSPwgR.s:3: Error: unrecognized symbol type "32"
/tmp/ccqSPwgR.s:3: Error: unknown pseudo-op: `.endef'
/tmp/ccqSPwgR.s:5: Error: unknown pseudo-op: `.def'
/tmp/ccqSPwgR.s:5: Error: unknown pseudo-op: `.scl'
/tmp/ccqSPwgR.s:5: Error: Missing symbol name in directive
/tmp/ccqSPwgR.s:5: Error: unrecognized symbol type "32"
/tmp/ccqSPwgR.s:5: Error: unknown pseudo-op: `.endef'
/tmp/ccqSPwgR.s:6: Error: unknown pseudo-op: `.seh_proc'
/tmp/ccqSPwgR.s:9: Error: unknown pseudo-op: `.seh_pushreg'
/tmp/ccqSPwgR.s:11: Error: unknown pseudo-op: `.seh_setframe'
/tmp/ccqSPwgR.s:13: Error: unknown pseudo-op: `.seh_stackalloc'
/tmp/ccqSPwgR.s:14: Error: unknown pseudo-op: `.seh_endprologue'
/tmp/ccqSPwgR.s:20: Error: unknown pseudo-op: `.seh_endproc'
Comment 1 Daniel Fruzynski 2018-12-03 17:23:07 UTC
Update: there is workaround for this, pass "--with-ld=/bin/x86_64-w64-mingw32-ld --with-as=/bin/x86_64-w64-mingw32-as" to configure script.

I also tried to use "--with-ld=x86_64-w64-mingw32-ld --with-as=x86_64-w64-mingw32-as". With these options initial configure completed successfully, but build failed that command cannot be found - probably PATH environment variable was cleared during build, and full path to specified as/ld was not saved.
Comment 2 Eric Gallager 2018-12-03 18:21:26 UTC
Possibly related to or a duplicate of bug 61651?
Comment 3 Andrew Pinski 2024-04-01 04:20:33 UTC
The place where gcc usually finds the cross assembler/linker is aarch64-linux-gnu/bin/ rather than via the cross name unless you supply --with-as .
Though I wonder if this should change ...