Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 751295

Summary: sys-devel/crossdev-20200801: target x86_64-w64-mingw32 compilation failed (-flto)
Product: Gentoo Linux Reporter: Paul Bordukov <pa5hgan>
Component: Current packagesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED OBSOLETE    
Severity: normal CC: chiitoo, crossdev, jstein, pa5hgan
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge --info
cross-x86_64-w64-mingw32-info.log
cross-x86_64-w64-mingw32-mingw64-runtime.log.xz
mingw64-runtime-config.logs.tar.xz
20201108-cross-x86_64-w64-mingw32-7.0.0-info.log
20201108-cross-x86_64-w64-mingw32-7.0.0-gcc-stage2.log.xz
20201108-gcc-config.logs.tar.xz

Description Paul Bordukov 2020-10-26 08:15:09 UTC
Hello,

I try to install target x86_64-w64-mingw32 using crossdev:
sudo crossdev --target x86_64-w64-mingw32

It fails on stage "Emerging cross-mingw64-runtime" with "error: mingw64-runtime failed :("


Reproducible: Always

Steps to Reproduce:
1. sudo emerge crossdev
2. sudo crossdev --target x86_64-w64-mingw32

Actual Results:  
Installation procedure fails:

pashgan@wing$ sudo crossdev --target x86_64-w64-mingw32
LPKG=mingw64-runtime
LVER=[latest]
-
 * crossdev version:      20200801
 * Host Portage ARCH:     amd64
 * Host Portage System:   x86_64-pc-linux-gnu (i686-pc-linux-gnu x86_64-pc-linux-gnu)
 * Target Portage ARCH:   amd64
 * Target System:         x86_64-w64-mingw32
 * Stage:                 4 (C/C++ compiler)
 * USE=multilib:          no
 * Target ABIs:           amd64

 * binutils:              binutils-[latest]
 * gcc:                   gcc-[latest]
 * libc:                  mingw64-runtime-[latest]

 * CROSSDEV_OVERLAY:      /home/pashgan/temp/source/layman/local
 * PORT_LOGDIR:           /var/log/portage
 * PORTAGE_CONFIGROOT:    /
 * Portage flags:


 * Log: /var/log/portage/cross-x86_64-w64-mingw32-binutils.log
 * Emerging cross-binutils ...                                                      [ ok ]
 * Log: /var/log/portage/cross-x86_64-w64-mingw32-mingw64-runtime-headers.log
 * Emerging cross-mingw64-runtime-headers ...                                       [ ok ]
 * Log: /var/log/portage/cross-x86_64-w64-mingw32-gcc-stage1.log
 * Emerging cross-gcc-stage1 ...                                                    [ ok ]
 * Log: /var/log/portage/cross-x86_64-w64-mingw32-mingw64-runtime.log
 * Emerging cross-mingw64-runtime ...

 * error: mingw64-runtime failed :(
 *
 * If you file a bug, please attach the following logfiles:
 * /var/log/portage/cross-x86_64-w64-mingw32-info.log
 * /var/log/portage/cross-x86_64-w64-mingw32-mingw64-runtime.log.xz
 * /var/tmp/portage/cross-x86_64-w64-mingw32/mingw64-runtime*/temp/mingw64-runtime-config.logs.tar.xz


Expected Results:  
Target x86_64-w64-mingw32 has to be reached by crossdev.
Comment 1 Paul Bordukov 2020-10-26 08:16:08 UTC
Created attachment 668588 [details]
emerge --info
Comment 2 Paul Bordukov 2020-10-26 08:16:52 UTC
Created attachment 668591 [details]
cross-x86_64-w64-mingw32-info.log
Comment 3 Paul Bordukov 2020-10-26 08:17:37 UTC
Created attachment 668594 [details]
cross-x86_64-w64-mingw32-mingw64-runtime.log.xz
Comment 4 Paul Bordukov 2020-10-26 08:18:07 UTC
Created attachment 668597 [details]
mingw64-runtime-config.logs.tar.xz
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2020-11-08 11:50:02 UTC
Perhaps a side-efect of mingw64-runtime-8.0.0.

Does 7.0.0 work for you as is? That is a new install, right? (not a reinstall on top of existing cross-toolchain).
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2020-11-08 13:08:57 UTC
I think it's a side-effect of USE=libraries being used before gcc-stage2 is ready.
Comment 7 Larry the Git Cow gentoo-dev 2020-11-08 13:26:54 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=f952e6bd7030033b2e4a3c8b9d62accb91e8e354

commit f952e6bd7030033b2e4a3c8b9d62accb91e8e354
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-11-08 13:25:05 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-11-08 13:25:05 +0000

    crossdev: disable USE=libraries for stage1 install
    
    Reported-by: Paul Bordukov
    Bug: https://bugs.gentoo.org/751295
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 crossdev | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Comment 8 Larry the Git Cow gentoo-dev 2020-11-08 13:51:48 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7094391e4a0722c5469e86f5ab7becfdcc34617d

commit 7094391e4a0722c5469e86f5ab7becfdcc34617d
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-11-08 13:51:29 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-11-08 13:51:43 +0000

    sys-devel/crossdev: bump up to 20101108
    
    Single change:  disable USE=libraries for stage1 install
    
    Reported-by: Paul Bordukov
    Closes: https://bugs.gentoo.org/751295
    Package-Manager: Portage-3.0.9, Repoman-3.0.2
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 sys-devel/crossdev/Manifest                 |  1 +
 sys-devel/crossdev/crossdev-20201108.ebuild | 36 +++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
Comment 9 Paul Bordukov 2020-11-08 16:41:52 UTC
(In reply to Sergei Trofimovich from comment #5)
> Perhaps a side-efect of mingw64-runtime-8.0.0.
> 
> Does 7.0.0 work for you as is? That is a new install, right? (not a
> reinstall on top of existing cross-toolchain).

Correct, this is new install. 7.0.0 cannot be compiled on my system as well. I've also tried crossdev-20201108.ebuild, and now it passes 'Emerging cross-mingw64-runtime' phase, but fails on 'Emerging cross-gcc-stage2'.
Comment 10 Paul Bordukov 2020-11-08 16:44:18 UTC
Created attachment 670469 [details]
20201108-cross-x86_64-w64-mingw32-7.0.0-info.log
Comment 11 Paul Bordukov 2020-11-08 16:44:58 UTC
Created attachment 670472 [details]
20201108-cross-x86_64-w64-mingw32-7.0.0-gcc-stage2.log.xz
Comment 12 Paul Bordukov 2020-11-08 16:45:34 UTC
Created attachment 670475 [details]
20201108-gcc-config.logs.tar.xz
Comment 13 Sergei Trofimovich (RETIRED) gentoo-dev 2020-11-09 08:43:58 UTC
(In reply to Paul Bordukov from comment #9)

> I've also tried crossdev-20201108.ebuild, and now it passes 'Emerging
> cross-mingw64-runtime' phase, but fails on 'Emerging cross-gcc-stage2'.

That means mingw64-runtime linking is fixed and you have another one. Looking at the error message:

.../ld: .../gcc-10.2.0-r3/temp/libgcc_s_seh-1.dll.tmp.Ipd8Na.ltrans0.ltrans.o: in function `_CRT_INIT':
.../libgcc/crt/crtdll.c:140: undefined reference to `_execute_onexit_table'

LTO linker fails to resolve a few symbols out of mingw64-runtime package. Might be a problem in mingw64-runtime, gcc or binutils handling of LTO.

Does 'USE=-lto crossdev -t x86_64-w64-mingw32' work?
Comment 14 Sergei Trofimovich (RETIRED) gentoo-dev 2020-11-09 08:46:30 UTC
Also, another thing to try is to rebuild mingw64-runtime without -flto C{,XX}FLAGS (or with -ffat-lto-objects) as I don't think we filter those out.
Comment 15 Chiitoo gentoo-dev 2020-11-17 20:33:41 UTC
For what it is worth, I built with USE="-libraries" on the runtimes first, and afterwards rebuilt them with it enabled, and was able to build the compilers with 'EXTRA_ECONF="--enable-threads=posix"' which requires libraries.

That is:

cross-i686-w64-mingw32/mingw64-runtime
cross-i686-w64-mingw32/gcc
cross-x86_64-w64-mingw32/mingw64-runtime
cross-x86_64-w64-mingw32/gcc
Comment 16 Paul Bordukov 2020-11-18 07:09:57 UTC
Sergei, I've tried 'USE=-lto crossdev -t x86_64-w64-mingw32' -- it also fails at 'Emerging cross-gcc-stage2'. Let ms check(In reply to Sergei Trofimovich from comment #14)
> Also, another thing to try is to rebuild mingw64-runtime without -flto
> C{,XX}FLAGS (or with -ffat-lto-objects) as I don't think we filter those out.

Removing -flto flag for cross-x86_64-w64-mingw32/mingw64-runtime helped! Now target x86_64-w64-mingw32 is reachable.

I see that crossdev creates /etc/portage/package.env/cross-x86_64-w64-mingw32 file with a reference: cross-x86_64-w64-mingw32/mingw64-runtime cross-x86_64-w64-mingw32/mingw64-runtime.conf. It can instruct gcc what flags to use. Will it be reasonable to add 'flto' tweak there?
Comment 17 Zoë Sparks 2021-04-20 14:54:11 UTC
I'm having this issue as well (configure fails while emerging cross-x86_64-win64-mingw32/mingw64-runtime with "C compiler cannot create executables" when running `crossdev -t x86_64-w64-mingw32`), although with crossdev-20201129. I haven't been able to get it to budge for the life of me. By default, package.use/cross-x86_64-win64-mingw32 has "-selinux -libraries -multilib" for mingw64-runtime; I've tried with and without -lto and -flto for it as well but to no avail. I don't see -flto in C{,XX}FLAGS in cross-x86_64-w64-mingw32/mingw64-runtime.conf, but I did try adding -ffat-lto-objects for both, which made no difference either. This is with a totally fresh crossdev environment, right after emerging crossdev and setting up a local overlay for it.
Comment 18 Zoë Sparks 2021-04-20 15:49:05 UTC
I got it to work with `USE='-* nopie' crossdev --ov-output /var/db/repos/localrepo-crossdev/ x86_64-w64-mingw32`, so my USE flags must be to blame somehow. Here's my `emerge --info` in case it's helpful:

Portage 3.0.18 (python 3.8.9-final-0, default/linux/amd64/17.1, gcc-10.3.0, glibc-2.33, 5.11.14 x86_64)
=================================================================
System uname: Linux-5.11.14-x86_64-Intel-R-_Core-TM-_i7-7700K_CPU_@_4.20GHz-with-glibc2.2.5
KiB Mem:    65789752 total,  41804244 free
KiB Swap:    1023996 total,   1023996 free
Timestamp of repository gentoo: Thu, 15 Apr 2021 00:30:01 +0000
Head commit of repository gentoo: 1c3c1a7e9603fa0d2c8da0277d5dc95853f7ab44
Head commit of repository audio-overlay: 655abd8cae496fe97efff861aeb619e0d699151d

Head commit of repository stha09: 258829228d20af0900309b02ff72a22280635c43

sh bash 5.1_p4
ld GNU ld (Gentoo 2.35.2 p1) 2.35.2
app-shells/bash:          5.1_p4::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.32.1::gentoo
dev-lang/python:          3.8.9::gentoo, 3.9.4::gentoo
dev-lang/rust:            1.51.0::gentoo
dev-util/cmake:           3.20.1::gentoo
sys-apps/baselayout:      2.7-r1::gentoo
sys-apps/openrc:          0.42.1-r1::gentoo
sys-apps/sandbox:         2.23::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.3-r1::gentoo
sys-devel/binutils:       2.35.2::gentoo
sys-devel/gcc:            10.3.0::gentoo
sys-devel/gcc-config:     2.4::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.11::gentoo (virtual/os-headers)
sys-libs/glibc:           2.33::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 

audio-overlay
    location: /var/db/repos/audio-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-audio/audio-overlay.git
    masters: gentoo

localrepo
    location: /var/db/repos/localrepo
    masters: gentoo

stha09
    location: /var/db/repos/gpo-stha09
    sync-type: git
    sync-uri: https://github.com/stha09/gpo-stha09
    masters: gentoo

crossdev
    location: /var/db/repos/localrepo-crossdev
    masters: gentoo
    priority: 10

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -ftree-vectorize -march=native -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -ftree-vectorize -march=native -pipe"
DISTDIR="/home/zoe/ganymede/portage/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -ftree-vectorize -march=native -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -ftree-vectorize -march=native -pipe"
GENTOO_MIRRORS="http://mirror.leaseweb.com/gentoo/ http://gentoo.osuosl.org/ http://www.gtlib.gatech.edu/pub/gentoo http://mirror.rackspace.com/gentoo/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j6"
PKGDIR="/home/zoe/ganymede/portage/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac aalib acl acpi alembic alsa amd64 audiofile berkdb bzip2 cairo cb cdda cddb cli collada corefonts crypt cuda cups cxx dec265 dga djvu dri driver dvd elogind emacs eme-free enc265 encode eselect-ldso examples exif fbcon ffmpeg fftw flac fluidsynth fontconfig fortran ftp gdbm gdk-pixbuf gif gl gles2 gmp gnuplot graphicsmagick graphviz gsl gstreamer gvim gzip hdri heif hscolour hwaccel iconv imap initramfs inotify ipv6 jack java javascript jit jpeg json kms ladspa lame lapack latex lcms libde265 libffi libglvnd libnotify libsamplerate libtirpc lm-sensors logrotate lqr lto lua luajit lzma magic man mono mp3 mp4 mpeg mpi mplayer multilib ncurses nls nptl nvml ogg openal opencl openexr opengl openimageio openmp opensubdiv openvdb opus osc osl oss pam pango pcre pdf pgo plotutils png postgres postscript profile ptex python q32 rav1e raw readline romio ruby sdl seccomp smp sndfile sound sox split-usr sqlite ssl startup-notification svg synctex tbb tcpd theora threads tiff tool tools truetype unicode usb utils uvm valgrind vdpau videos vim-syntax vorbis vulkan webp wmf x264 x265 xattr xcb xcomposite xml xxhash yaml zip zlib zsh-completion" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python3_8" RUBY_TARGETS="ruby26 ruby27 ruby30" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS
Comment 19 Sergei Trofimovich (RETIRED) gentoo-dev 2021-04-27 06:31:32 UTC
(In reply to Zoë Sparks from comment #17)
> I'm having this issue as well (configure fails while emerging
> cross-x86_64-win64-mingw32/mingw64-runtime with "C compiler cannot create
> executables" when running `crossdev -t x86_64-w64-mingw32`), although with
> crossdev-20201129. I haven't been able to get it to budge for the life of
> me. By default, package.use/cross-x86_64-win64-mingw32 has "-selinux
> -libraries -multilib" for mingw64-runtime; I've tried with and without -lto
> and -flto for it as well but to no avail. I don't see -flto in C{,XX}FLAGS
> in cross-x86_64-w64-mingw32/mingw64-runtime.conf, but I did try adding
> -ffat-lto-objects for both, which made no difference either. This is with a
> totally fresh crossdev environment, right after emerging crossdev and
> setting up a local overlay for it.

It means it's probably a different bug from this. I suggest filing a separate one.
Comment 20 Andreas K. Hüttel archtester gentoo-dev 2023-08-23 01:22:31 UTC
Whatever this was, we probably have fresh bugs by now.