According this manual I have installed i686-w64-mingw32. When I try to run a compiled program, I get an empty output. USE="-fortran" crossdev -t i686-w64-mingw32 --stable -oO /usr/crossdev-overlay Example: $ cat hello.cpp #include <iostream> using namespace std; int main() { cout << "Hello, World" << endl; return 0; } $ i686-w64-mingw32-g++ -O2 hello.cpp -o hello.exe -mconsole -static-libgcc -static-libstdc++ $ wine hello.exe $
Link to mingw32 manual: https://wiki.gentoo.org/wiki/Mingw
(In reply to Dmitri Filov from comment #0) > According this manual I have installed i686-w64-mingw32. > When I try to run a compiled program, I get an empty output. > > USE="-fortran" crossdev -t i686-w64-mingw32 --stable -oO > /usr/crossdev-overlay > > Example: > $ cat hello.cpp > #include <iostream> > using namespace std; > > int main() { > cout << "Hello, World" << endl; > return 0; > } > > $ i686-w64-mingw32-g++ -O2 hello.cpp -o hello.exe -mconsole -static-libgcc > -static-libstdc++ > > $ wine hello.exe > > $ Does adding '-no-pie' help?
(In reply to Sergei Trofimovich from comment #2) > (In reply to Dmitri Filov from comment #0) > > $ i686-w64-mingw32-g++ -O2 hello.cpp -o hello.exe -mconsole -static-libgcc > > -static-libstdc++ > > > > $ wine hello.exe > > > > $ > > Does adding '-no-pie' help? Assuming workaround does help: https://www.linux.org.ru/forum/development/13966748?lastmod=1516422156800&filter=show#comment-13968613 It means mingw startup code is not compatible with --enable-default-pie. To avoid passing -no-pie into every linked program you can disable gcc[pie] as: $ USE="-pie" crossdev -t i686-w64-mingw32 or override default in /etc/portage/package.use/cross-i686-w64-mingw32
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=1803a14a1ad634a1e1153efd2f906aa1c7bb0fc1 commit 1803a14a1ad634a1e1153efd2f906aa1c7bb0fc1 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2018-01-20 12:30:01 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2018-01-20 12:30:01 +0000 crossdev: blacklist known broken targets for PIE and SSP, bug #644930 - SSP is not supported by alpha, hppa, ia64, avr, nios2, mmix - PIE is not supported by avr, mmix, mingw32 Bug: https://bugs.gentoo.org/644930 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> crossdev | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-)}
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5239f0b88b067302a5897a199554c76afa61b1bc commit 5239f0b88b067302a5897a199554c76afa61b1bc Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2018-01-20 18:54:16 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2018-01-20 18:55:24 +0000 sys-devel/crossdev: bump up to 20180120 Closes: https://bugs.gentoo.org/644930 Package-Manager: Portage-2.3.19, Repoman-2.3.6 sys-devel/crossdev/Manifest | 1 + sys-devel/crossdev/crossdev-20180120.ebuild | 35 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+)
Looks like x86_64-w64-mingw32 needs the same fix, otherwise it also produces executables that just hang.
(In reply to Jernej Simoncic from comment #6) > Looks like x86_64-w64-mingw32 needs the same fix, otherwise it also produces > executables that just hang. Did you have a chance to try to rebuild gcc with USE=-pie? If it helps you I'll extend the hack to all mingw targets.
Yes, with USE=-pie the resulting x64 executables work fine (tested on GIMP 2.10)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=56de3cc88635c85f96298072111a81dadf424e9f commit 56de3cc88635c85f96298072111a81dadf424e9f Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2018-05-08 21:38:40 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2018-05-08 21:38:40 +0000 crossdev: disable USE=pie for all mingw targets Jernej reports that x86_64-w64-mingw32 also exhibits the same runtime failures with USE=pie. Reported-by: Jernej Simoncic Bug: https://bugs.gentoo.org/644930 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> crossdev | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e42f1893098bfc973c2c869cfc33e6df7d31e9fd commit e42f1893098bfc973c2c869cfc33e6df7d31e9fd Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2018-05-08 21:44:02 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2018-05-08 21:44:46 +0000 sys-devel/crossdev: bump up to 20180508, bug #644930 Single new patch: "disable USE=pie for all mingw targets" Reported-by: Jernej Simoncic Closes: https://bugs.gentoo.org/644930 Package-Manager: Portage-2.3.36, Repoman-2.3.9 sys-devel/crossdev/Manifest | 1 + sys-devel/crossdev/crossdev-20180508.ebuild | 39 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+)
Thanks for the report and test! crossdev-20180508 should default to saner toolchain now.
*** Bug 661572 has been marked as a duplicate of this bug. ***