public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/105352] New: Building cross-compiler for host i686-w64-mingw32, target mips32-elf, fails
@ 2022-04-22 20:48 dragorn421 at gmail dot com
2022-04-22 20:56 ` [Bug other/105352] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: dragorn421 at gmail dot com @ 2022-04-22 20:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105352
Bug ID: 105352
Summary: Building cross-compiler for host i686-w64-mingw32,
target mips32-elf, fails
Product: gcc
Version: 11.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: dragorn421 at gmail dot com
Target Milestone: ---
Created attachment 52853
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52853&action=edit
configure_log.txt, make_log.txt, make_g++_error_log.txt, libcody_config.log
I am building in Ubuntu-22.04, in WSL2 in Windows 10 21H1.
I want the compiled executable files to run natively on Windows 32-bits as .exe
, hence the host `i686-w64-mingw32`.
I want the target to be `mips32-elf` a.k.a. `mips64-unknown-elf`.
Having downloaded `binutils-2.38.tar.gz` and `gcc-11.3.0.tar.gz`, I ran the
following commands:
```
# install some packages, and build and install binutils
sudo apt install build-essential libgmp-dev libmpfr-dev libmpc-dev
sudo apt install gcc-mingw-w64-i686
tar -xvf binutils-2.38.tar.gz
mkdir objdir_binutils
cd objdir_binutils
../binutils-2.38/configure --host=i686-w64-mingw32 --target=mips32-elf
--disable-nls
sudo apt install texinfo
make
sudo make install
tar -xvf gcc-11.3.0.tar.gz
cd gcc-11.3.0
./contrib/download_prerequisites
cd ..
mkdir objdir_gcc
cd objdir_gcc
../gcc-11.3.0/configure --host=i686-w64-mingw32 --target=mips32-elf
--disable-nls
make
```
Building and installing binutils worked just fine (I don't know if it's
required to build gcc or relevant here)
However building gcc fails at `make` with the following error:
```
make[2]: Entering directory '/home/dragorn421/exe_build/objdir_gcc/libcpp'
g++ -I../../gcc-11.3.0/libcpp -I. -I../../gcc-11.3.0/libcpp/../include
-I../../gcc-11.3.0/libcpp/include -g -O2 -D__USE_MINGW_ACCESS -W -Wall
-Wno-narrowing -Wwrite-strings -Wmissing-format-attribute -pedantic
-Wno-long-long -fno-exceptions -fno-rtti -I../../gcc-11.3.0/libcpp -I.
-I../../gcc-11.3.0/libcpp/../include -I../../gcc-11.3.0/libcpp/include -c -o
charset.o -MT charset.o -MMD -MP -MF .deps/charset.Tpo
../../gcc-11.3.0/libcpp/charset.c
In file included from ../../gcc-11.3.0/libcpp/system.h:374,
from ../../gcc-11.3.0/libcpp/charset.c:21:
../../gcc-11.3.0/libcpp/../include/libiberty.h:112:14: error: ambiguating new
declaration of ‘char* basename(const char*)’
112 | extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL
ATTRIBUTE_NONNULL(1);
| ^~~~~~~~
In file included from ../../gcc-11.3.0/libcpp/system.h:205,
from ../../gcc-11.3.0/libcpp/charset.c:21:
/usr/include/string.h:524:26: note: old declaration ‘const char* basename(const
char*)’
524 | extern "C++" const char *basename (const char *__filename)
| ^~~~~~~~
make[2]: *** [Makefile:226: charset.o] Error 1
```
See attached `configure_log.txt` and `make_log.txt` for the full output of
`../gcc-11.3.0/configure` and `make`.
As suggested in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65863 , I tried
passing `--build=i686-linux` to `../gcc-11.3.0/configure`, which didn't change
the resulting error above.
For what it's worth I also had the same issue on Ubuntu 18.04, also in WSL2,
with gcc 10.3.0 and gcc 11.3.0
Out of curiosity, I tried to comment out the duplicate declaration of the
symbol `extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL
ATTRIBUTE_NONNULL(1);` (by prepending `//` before the line) in
`gcc-11.3.0/include/libiberty.h`.
This results in a scarier error (at least to me):
```
Configuring in ./libcody
configure: creating cache ./config.cache
checking build system type... x86_64-pc-linux-gnu
checking host system type... i686-w64-mingw32
checking maintainer-mode...
checking whether the C++ compiler works... no
configure: error: in `/home/dragorn421/exe_build/objdir_gcc/libcody':
configure: error: C++ compiler cannot create executables
See `config.log' for more details
make[1]: *** [Makefile:8759: configure-libcody] Error 1
```
See attached `make_g++_error_log.txt` for the full output of this second make
run.
See attached `libcody_config.log` for the full content of
`objdir_gcc/libcody/config.log`. I think the relevant bits are:
1) g++ is recent and "standard"
```
configure:2098: checking for C++ compiler version
configure:2107: g++ --version >&5
g++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:2118: $? = 0
```
2) It gets passed a malformed argument? `-Wl,--stack,12582912`
```
configure:2138: checking whether the C++ compiler works
configure:2160: g++ -g -O2 -D__USE_MINGW_ACCESS -static-libstdc++
-static-libgcc -Wl,--stack,12582912 conftest.cpp >&5
/usr/bin/ld: unrecognized option '--stack'
/usr/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
configure:2164: $? = 1
configure:2202: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "codylib"
| #define PACKAGE_TARNAME "codylib"
| #define PACKAGE_VERSION "0.0"
| #define PACKAGE_STRING "codylib 0.0"
| #define PACKAGE_BUGREPORT "github.com/urnathan/libcody"
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:2207: error: in `/home/dragorn421/exe_build/objdir_gcc/libcody':
configure:2209: error: C++ compiler cannot create executables
See `config.log' for more details
```
I have no idea how to monkeypatch that second issue :(
To be clear I'm describing two (related?) issues here, the "`basename` symbol
issue" and the "g++ `-Wl,--stack,12582912` issue".
Thanks in advance for any help you may offer. :)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug other/105352] Building cross-compiler for host i686-w64-mingw32, target mips32-elf, fails
2022-04-22 20:48 [Bug other/105352] New: Building cross-compiler for host i686-w64-mingw32, target mips32-elf, fails dragorn421 at gmail dot com
@ 2022-04-22 20:56 ` pinskia at gcc dot gnu.org
2022-04-22 20:59 ` dragorn421 at gmail dot com
2022-04-22 22:55 ` dragorn421 at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-04-22 20:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105352
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>../gcc-11.3.0/configure --host=i686-w64-mingw32 --target=mips32-elf --disable-nls
>I want the compiled executable files to run natively on Windows 32-bits as .exe , hence the host `i686-w64-mingw32`.
You don't have a i686-w64-mingw32 cross compiler installed though.
So you are just doing something which won't work until you get a cross compiler
on the machine.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug other/105352] Building cross-compiler for host i686-w64-mingw32, target mips32-elf, fails
2022-04-22 20:48 [Bug other/105352] New: Building cross-compiler for host i686-w64-mingw32, target mips32-elf, fails dragorn421 at gmail dot com
2022-04-22 20:56 ` [Bug other/105352] " pinskia at gcc dot gnu.org
@ 2022-04-22 20:59 ` dragorn421 at gmail dot com
2022-04-22 22:55 ` dragorn421 at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: dragorn421 at gmail dot com @ 2022-04-22 20:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105352
Dragorn421 <dragorn421 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|INVALID |FIXED
Build| |x86_64-pc-linux-gnu
Host| |i686-w64-mingw32
Target| |mips64-unknown-elf
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=65863
--- Comment #2 from Dragorn421 <dragorn421 at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> >../gcc-11.3.0/configure --host=i686-w64-mingw32 --target=mips32-elf --disable-nls
>
>
> >I want the compiled executable files to run natively on Windows 32-bits as .exe , hence the host `i686-w64-mingw32`.
>
> You don't have a i686-w64-mingw32 cross compiler installed though.
> So you are just doing something which won't work until you get a cross
> compiler on the machine.
Doesn't `sudo apt install gcc-mingw-w64-i686` take care of that? It seems to be
detected correctly going by the configure output:
```
checking for i686-w64-mingw32-gcc... i686-w64-mingw32-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether i686-w64-mingw32-gcc accepts -g... yes
checking for i686-w64-mingw32-gcc option to accept ISO C89... none needed
```
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug other/105352] Building cross-compiler for host i686-w64-mingw32, target mips32-elf, fails
2022-04-22 20:48 [Bug other/105352] New: Building cross-compiler for host i686-w64-mingw32, target mips32-elf, fails dragorn421 at gmail dot com
2022-04-22 20:56 ` [Bug other/105352] " pinskia at gcc dot gnu.org
2022-04-22 20:59 ` dragorn421 at gmail dot com
@ 2022-04-22 22:55 ` dragorn421 at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: dragorn421 at gmail dot com @ 2022-04-22 22:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105352
--- Comment #3 from Dragorn421 <dragorn421 at gmail dot com> ---
Ah, I was missing the g++ cross compiler, I see. Thanks :)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-22 22:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-22 20:48 [Bug other/105352] New: Building cross-compiler for host i686-w64-mingw32, target mips32-elf, fails dragorn421 at gmail dot com
2022-04-22 20:56 ` [Bug other/105352] " pinskia at gcc dot gnu.org
2022-04-22 20:59 ` dragorn421 at gmail dot com
2022-04-22 22:55 ` dragorn421 at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).