Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 927826 - sys-boot/grub-2.12-r2 fails to build on x32 (grub/efi/api.h:1117:3: error: X32 does not support ‘ms_abi’ attribute)
Summary: sys-boot/grub-2.12-r2 fails to build on x32 (grub/efi/api.h:1117:3: error: X3...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mike Gilbert
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: x32
  Show dependency tree
 
Reported: 2024-03-25 16:06 UTC by Nick Bowler
Modified: 2024-05-29 10:34 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (sys-boot:grub-2.12-r2:20240325-155825.log,535.08 KB, text/plain)
2024-03-25 16:07 UTC, Nick Bowler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Bowler 2024-03-25 16:06:29 UTC
Hi,

The recently stabilized sys-boot/grub-2.12-r2 fails to build on x32:

  In file included from /var/tmp/portage/sys-boot/grub-2.12-r2/work/grub-2.12/include/grub/efi/efi.h:25,
                   from /var/tmp/portage/sys-boot/grub-2.12-r2/work/grub-2.12/grub-core/commands/file.c:28:
  /var/tmp/portage/sys-boot/grub-2.12-r2/work/grub-2.12/include/grub/efi/api.h:1117:3: error: X32 does not support ‘ms_abi’ attribute
   1117 |   (__grub_efi_api *raise_tpl) (grub_efi_tpl_t new_tpl);
        |   ^
  make[2]: *** [Makefile:8775: grub-core/commands/grub_file-file.o] Error 1

The previous version (2.06-r9) installs without errors.

Portage 3.0.61 (python 3.11.8-final-0, default/linux/amd64/17.0/x32, gcc-12, glibc-2.38-r10, 5.4.238 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.4.238-x86_64-Intel-R-_Core-TM-_i3-2120T_CPU_@_2.60GHz-with-glibc2.38
KiB Mem:    16125388 total,   7717332 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Mon, 25 Mar 2024 00:45:00 +0000
sh dash 0.5.12
ld GNU ld (Gentoo 2.40 p5) 2.40.0
ccache version 4.9.1 [enabled]
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.1_p16-r6::gentoo
dev-build/autoconf:        2.71-r6::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.27.9::gentoo
dev-build/libtool:         2.4.7-r3::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.3.2::gentoo
dev-lang/perl:             5.38.2-r2::gentoo
dev-lang/python:           3.10.12::gentoo, 3.11.8_p1::gentoo, 3.12.2_p1::gentoo
dev-util/ccache:           4.9.1::gentoo
sys-apps/baselayout:       2.14-r2::gentoo
sys-apps/openrc:           0.53::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/binutils:        2.40-r5::gentoo, 2.41-r5::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/gcc:             12.3.1_p20230526::gentoo, 13.2.1_p20240210::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-kernel/linux-headers:  6.6::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38-r10::gentoo
Repositories:

gentoo
    location: /srv/repos/gentoo
    sync-type: webrsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    sync-user: portage
    priority: -1000
    volatile: True
    sync-webrsync-verify-signature: true

gentoo-draconx
    location: /srv/repos/gentoo-draconx
    masters: gentoo
    volatile: True

gentoo-fixes
    location: /srv/repos/gentoo-fixes
    masters: gentoo
    volatile: True

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnux32"
CFLAGS="-Os -pipe -march=sandybridge -mno-aes"
CHOST="x86_64-pc-linux-gnux32"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-Os -pipe -march=sandybridge -mno-aes"
DISTDIR="/srv/repos/gentoo/distfiles"
EMERGE_DEFAULT_OPTS="-j2 --keep-going --dynamic-deps=n --autounmask-write=n --unordered-display --verbose-conflicts --binpkg-respect-use=y --with-bdeps-auto=n"
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="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live ccache config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted 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 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="/etc/portage/*postsync.d"
LANG="en_CA.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
MAKEOPTS="-j4"
PKGDIR="/var/cache/portage/packages"
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"
SHELL="/bin/zsh"
USE="acl amd64 bzip2 cli crypt dri fortran gdbm iconv idn ipv6 kerberos libtirpc multilib ncurses nls openmp pam pcre python readline seccomp split-usr ssl unicode xattr zlib" ABI_X86="x32" ADA_TARGET="gcc_12" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio 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="avx mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, 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, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS

=================================================================
                        Package Settings
=================================================================

sys-boot/grub-2.06-r9::gentoo was built with the following:
USE="fonts nls themes -device-mapper -doc -efiemu -libzfs -mount -sdl (-test) -truetype -verify-sig" ABI_X86="(x32)" GRUB_PLATFORMS="efi-64 pc -coreboot -efi-32 -emu -ieee1275 (-loongson) -multiboot -qemu (-qemu-mips) -uboot -xen -xen-32 -xen-pvh"
CFLAGS=""
FEATURES="usersync unmerge-logs sandbox binpkg-logs ebuild-locks sfperms unmerge-orphans binpkg-dostrip buildpkg-live binpkg-multi-instance parallel-fetch qa-unresolved-soname-deps xattr multilib-strict ipc-sandbox assume-digests fixlafiles usersandbox config-protect-if-modified pkgdir-index-trusted preserve-libs strict protect-owned network-sandbox merge-sync userpriv binpkg-docompress distlocks unknown-features-warn news userfetch ccache pid-sandbox"
LDFLAGS=""
Comment 1 Nick Bowler 2024-03-25 16:07:58 UTC
Created attachment 888559 [details]
build log
Comment 2 Mike Gilbert gentoo-dev 2024-03-25 19:08:08 UTC
x32 is pretty much dead on Gentoo. Please work with upstream to resolve this if desired.
Comment 3 Mike Gilbert gentoo-dev 2024-03-25 19:30:40 UTC
Note that I am happy to apply a patch that has been submitted upstream first.
Comment 4 Steven Newbury 2024-05-28 13:15:49 UTC
FWIW, I'm still working on x32, so it's not entirely dead.

Regarding this bug though, I don't believe it is "FIXED UPSTREAM".  The specific code in question *must* be built for -m64 with ms_abi since it needs to meet the efi-64 ABI.  Likewise efi-32 support requires -m32.

Fixing this is on my TODO list.
Comment 5 Mike Gilbert gentoo-dev 2024-05-28 14:03:58 UTC
(In reply to Steven Newbury from comment #4)

RESOLVED UPSTREAM just means you should work with upstream to address the issue.
Comment 6 Steven Newbury 2024-05-28 14:14:19 UTC
Just to be clear, if I patch the build system to use -m64/-m32 for the firmware parts I'll need to get it accepted upstream before a patch can be accepted for this bug?
Comment 7 Mike Gilbert gentoo-dev 2024-05-28 14:31:49 UTC
(In reply to Steven Newbury from comment #6)

I am happy to apply patches if they have been submitted upstream. They do not necessarily need to be merged yet.

Note that if the changes are too complex for me to understand, I may choose to wait for upstream to review them. However, I doubt that would be the case for a simple flags change in the build system.

I can also offer feedback on your changes before you send them upstream if desired.
Comment 8 Steven Newbury 2024-05-29 10:34:43 UTC
This is a little odd... TARGET_CFLAGS get correctly set with -m64 in the build for the efi-64 components, but grub-core seems to need it too, but just uses the normal host CFLAGS from the environment.  All the utility programs obviously build fine with CHOST.  It will take some time to unravel it.

However, an easy workaround for x32 could be to just use -m32/-m64 for the host CFLAGS for 32 and 64 bit grub variants.  I've tested this, and it does emerge fine.  None of the utility programs link to anything more than the ld-linux, linux-vdso, and libc anyway.  It's not like it's a component which benefits from x32 in any way.