gentoo / dlang

[MIRROR] D programming language ebuild repository
https://gitweb.gentoo.org/repo/user/dlang.git
GNU General Public License v2.0
30 stars 23 forks source link

selfhost Installation failed for >=dmd-2.094.2 #116

Closed ZhennanWu closed 1 year ago

ZhennanWu commented 1 year ago

All dmd self hosting builds above 2.094.2 (2.094~2.099) are broken on my setup without an existing dmd. It seems the bootstrap dmd binary is not found.

Build Log ``` sudo cat /var/tmp/portage/dev-lang/dmd-2.094.2/temp/build.log Password: * Package: dev-lang/dmd-2.094.2:2.094 * Repository: dlang * USE: abi_x86_64 amd64 elibc_glibc kernel_linux selfhost userland_GNU * FEATURES: network-sandbox preserve-libs sandbox userpriv usersandbox * FEATURES='assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live 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' * CFLAGS='-march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=16 -fuse-linker-plugin -pipe -falign-functions=32 -Wl,-O1 -Wl,--as-needed' * CXXFLAGS='-march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=16 -fuse-linker-plugin -pipe -falign-functions=32 -Wl,-O1 -Wl,--as-needed' * FFLAGS='-march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=16 -fuse-linker-plugin -pipe -falign-functions=32 -Wl,-O1 -Wl,--as-needed' * FCFLAGS='-march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=16 -fuse-linker-plugin -pipe -falign-functions=32 -Wl,-O1 -Wl,--as-needed' * F77FLAGS='-march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=16 -fuse-linker-plugin -pipe -falign-functions=32 -Wl,-O1 -Wl,--as-needed' * LDFLAGS='-Wl,-O1 -Wl,--as-needed -march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=16 -fuse-linker-plugin -pipe -falign-functions=32' * MAKEOPTS='-j16' * gcc (Gentoo 12.2.1_p20230428-r1 p2) 12.2.1 20230428 * g++ (Gentoo 12.2.1_p20230428-r1 p2) 12.2.1 20230428 * GNU ld (Gentoo 2.39 p6) 2.39.0 * Linux znwu-GDC-G 6.1.19-gentoo #15 SMP PREEMPT_DYNAMIC Mon May 8 01:30:27 PDT 2023 x86_64 12th Gen Intel(R) Core(TM) i7-12700K GenuineIntel GNU/Linux >>> Unpacking source... >>> Unpacking dmd.2.094.2.linux.tar.xz to /var/tmp/portage/dev-lang/dmd-2.094.2/work >>> Source unpacked in /var/tmp/portage/dev-lang/dmd-2.094.2/work >>> Preparing source in /var/tmp/portage/dev-lang/dmd-2.094.2/work/dmd2 ... * Applying 2.078-link-32-bit-shared-lib-with-ld.bfd.patch ... [ ok ] >>> Source prepared. >>> Configuring source in /var/tmp/portage/dev-lang/dmd-2.094.2/work/dmd2 ... >>> Source configured. >>> Compiling source in /var/tmp/portage/dev-lang/dmd-2.094.2/work/dmd2 ... * Building dmd build script... dmd -mcpu=native -O -release -inline -boundscheck=off dmd/src/build.d -L-O1 -L--as-needed -march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -pipe -falign-functions=32 -ofdmd/generated/build /var/tmp/portage/dev-lang/dmd-2.094.2/temp/environment: line 2531: dmd: command not found * ERROR: dev-lang/dmd-2.094.2::dlang failed (compile phase): * (no error message) * * Call stack: * ebuild.sh, line 136: Called src_compile * environment, line 4922: Called dmd_src_compile * environment, line 2703: Called dlang_compile_bin 'dmd/generated/build' 'dmd/src/build.d' * environment, line 2444: Called dlang_exec 'dmd' '-mcpu=native' '-O' '-release' '-inline' '-boundscheck=off' 'dmd/src/build.d' '-L-O1' '-L--as-needed' '-march=native' '-O3' '-fgraphite-identity' '-floop-nest-optimize' '-fdevirtualize-at-ltrans' '-fipa-pta' '-fno-semantic-interposition' '-pipe' '-falign-functions=32' '-ofdmd/generated/build' * environment, line 2531: Called die * The specific snippet of code: * ${@} || die * * If you need support, post the output of `emerge --info '=dev-lang/dmd-2.094.2::dlang'`, * the complete build log and the output of `emerge -pqv '=dev-lang/dmd-2.094.2::dlang'`. * The complete build log is located at '/var/tmp/portage/dev-lang/dmd-2.094.2/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/dev-lang/dmd-2.094.2/temp/environment'. * Working directory: '/var/tmp/portage/dev-lang/dmd-2.094.2/work/dmd2' * S: '/var/tmp/portage/dev-lang/dmd-2.094.2/work/dmd2' ```
Emerge info ``` emerge --info '=dev-lang/dmd-2.094.2::dlang' Portage 3.0.44 (python 3.11.3-final-0, default/linux/amd64/17.1/desktop/gnome/systemd/merged-usr, gcc-12, glibc-2.36-r7, 6.1.19-gentoo x86_64) ================================================================= System Settings ================================================================= System uname: Linux-6.1.19-gentoo-x86_64-12th_Gen_Intel-R-_Core-TM-_i7-12700K-with-glibc2.36 KiB Mem: 65610756 total, 57618944 free KiB Swap: 0 total, 0 free Timestamp of repository gentoo: Mon, 08 May 2023 09:00:01 +0000 Head commit of repository gentoo: 4392befa43bba1a82bd89ecb8fd9d46f3580dd4c Timestamp of repository dlang: Sun, 07 May 2023 16:17:56 +0000 Head commit of repository dlang: 4f39e1ab29d5ad240d4b4ff8495ea2bd1d0c9aad Timestamp of repository lto-overlay: Sun, 07 May 2023 16:18:09 +0000 Head commit of repository lto-overlay: b5942a1085a5e77d04f4e6806b0b05322dbe3563 Timestamp of repository mv: Sun, 07 May 2023 16:18:01 +0000 Head commit of repository mv: eeebef72f2265352c68845e653b9f28c23444e2e sh bash 5.1_p16-r2 ld GNU ld (Gentoo 2.39 p6) 2.39.0 ccache version 4.7.4 [disabled] app-misc/pax-utils: 1.3.5::gentoo app-shells/bash: 5.1_p16-r2::gentoo dev-java/java-config: 2.3.1::gentoo dev-lang/perl: 5.36.0-r2::gentoo dev-lang/python: 3.11.3::gentoo dev-lang/rust: 1.69.0-r1::gentoo dev-util/ccache: 4.7.4::gentoo dev-util/cmake: 3.25.3::gentoo dev-util/meson: 1.0.1::gentoo sys-apps/baselayout: 2.13-r1::gentoo sys-apps/sandbox: 2.29::gentoo sys-apps/systemd: 253.3-r1::gentoo sys-devel/autoconf: 2.13-r7::gentoo, 2.71-r5::gentoo sys-devel/automake: 1.16.5::gentoo sys-devel/binutils: 2.39-r5::gentoo sys-devel/binutils-config: 5.5::gentoo sys-devel/gcc: 12.2.1_p20230428-r1::gentoo sys-devel/gcc-config: 2.10::gentoo sys-devel/libtool: 2.4.7-r1::gentoo sys-devel/llvm: 15.0.7::gentoo sys-devel/make: 4.4.1::gentoo sys-kernel/linux-headers: 6.1::gentoo (virtual/os-headers) sys-libs/glibc: 2.36-r7::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 volatile: True sync-rsync-verify-max-age: 24 sync-rsync-verify-jobs: 1 sync-rsync-extra-opts: sync-rsync-verify-metamanifest: yes dlang location: /var/db/repos/dlang sync-type: git sync-uri: https://github.com/gentoo-mirror/dlang.git masters: gentoo volatile: True lto-overlay location: /var/db/repos/lto-overlay sync-type: git sync-uri: https://github.com/gentoo-mirror/lto-overlay.git masters: gentoo mv volatile: True mv location: /var/db/repos/mv sync-type: git sync-uri: https://github.com/gentoo-mirror/mv.git masters: gentoo volatile: True ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="@FREE @BINARY-REDISTRIBUTABLE freedist google-chrome NVIDIA-CUDA NVIDIA-cuDNN Microsoft-vscode MSttfEULA free-noncomm" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=16 -fuse-linker-plugin -pipe -falign-functions=32" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /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" CXXFLAGS="-march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=16 -fuse-linker-plugin -pipe -falign-functions=32" DISTDIR="/var/cache/distfiles" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE 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 XDG_STATE_HOME" FCFLAGS="-O3 -march=native -pipe" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live 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="-O3 -march=native -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_US.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LEX="flex" MAKEOPTS="-j16" PKGDIR="/var/cache/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" RUSTFLAGS="-C target-cpu=native" SHELL="/bin/bash" USE="X a52 aac acl acpi alsa amd64 bluetooth branding bzip2 cairo cdda cdr cjk cli colord crypt cuda cups dbus dri dts dvd dvdr eds emoji encode eselect-ldso evo exif ffmpeg flac fortran gdbm gif gnome gnome-keyring gnome-online-accounts gpm gstreamer gtk gui iconv icu introspection ipv6 jpeg lcms libglvnd libnotify libsecret libtirpc mad mng mp3 mp4 mpeg ms multilib nautilus ncurses networkmanager nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds pulseaudio qt5 readline sdl seccomp sound spell ssl startup-notification svg sysprof systemd test-rust tiff tracker truetype udev udisks unicode upower usb vdpau vorbis wayland wxwidgets x264 xattr xcb xft xml xv xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2021" 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 avx512f avx512dq avx512cd avx512bw avx512vl avx512vbmi f16c fma3 mmx mmxext pclmul popcnt rdrand sha 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" INPUT_DEVICES="libinput" KERNEL="linux" L10N="ru zh-CN" 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-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby30" USERLAND="GNU" VIDEO_CARDS="nvidia intel" 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: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, SIZE, STRINGS, STRIP, YACC, YFLAGS ```
the-horo commented 1 year ago

Same issues as #108.

The fix, as stated in https://github.com/gentoo/dlang/issues/108#issuecomment-1242994024 and in the documentation, you have to add NOCADD to your package.cflags to prevent your LDFLAGS to receive values from CFLAGS. For example:

*/*::dlang NOCADD=1
ssterling commented 1 year ago

The fix, as stated in #108 (comment) and in the documentation, you have to add NOCADD to your package.cflags to prevent your LDFLAGS to receive values from CFLAGS. For example:

*/*::dlang NOCADD=1

I emerged portage-bashrc-mv—which seems to be the canonical implementation of package.cflags—and added */*::dlang NOCADD=1 to /etc/portage/package.cflags, but DMD still fails to compile in the same way as of the OP.

the-horo commented 1 year ago

I have been mistaken in my first comment. There is indeed an issue with >=dmd-2.094 when selfhosting. The problem happens on this line: dlang_compile_bin dmd/generated/build dmd/src/build.d because dlang_compile_bin doesn't know anything about the compiler available in the release archive. This bug is fixed in #121.

What made me think this was an issue with package.cflags is that @ZhennanWu logs say that he has the mv overlay installed and that overlay has the portage-bashrc-mv package that provides package.cflags along with some other things. The problem with this package is that it defaults to combining CFLAGS CXXFLAGS and LDFLAGS, their reasoning being that some pacakages don't respect them properly, which happens to break dlang packages since they do actually try to respect LDFLAGS. In his case, after the fix from #121 he would still have to disable this merging, and that's what I suggested in my previous comment.

@ssterling in your case you don't need to install any new packages, and can safely remove portage-bashrc-mv, you just need to wait for the PR to get merged, or apply the patch yourself if you're in a hurry, but in that case it would be faster to install a dmd version prior to dmd-2.094 and then use that to install newer compiler versions.

My mistake for not reading the build log properly as it clearly states the error:

/var/tmp/portage/dev-lang/dmd-2.094.2/temp/environment: line 2531: dmd: command not found
mleise commented 1 year ago

I'll close this as fixed then. Thank you everyone.