Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 916486 - app-misc/resolve-march-native-2.2.0 fails on arm64 -march is empty.
Summary: app-misc/resolve-march-native-2.2.0 fails on arm64 -march is empty.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM64 Linux
: Normal normal
Assignee: Sebastian Pipping
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-29 11:50 UTC by Roy Bamford
Modified: 2023-11-05 17:55 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roy Bamford gentoo-dev 2023-10-29 11:50:05 UTC
app-misc/resolve-march-native-2.2.0 fails on arm64.

$ resolve-march-native
gcc: error: missing argument to '-march='
ERROR: Command '['gcc', '-S', '-fverbose-asm', '-o', '/tmp/tmpt3g224md/march_native.s', '/tmp/tmpt3g224md/empty.c', '-march=']' returned non-zero exit status 1.
roy@moriarty ~ $ resolve-march-native --debug
# gcc -S -fverbose-asm -o /tmp/tmptak2avgc/march_native.s /tmp/tmptak2avgc/empty.c -march=native
Flags extracted: -mabi=lp64 -mcpu=emag+crc -mlittle-endian
Flags extracted: -mabi=lp64 -march= -mbranch-protection= -mcmodel=small -mcpu=emag+crc -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 -mglibc -mharden-sls= -mlittle-endian -momit-leaf-frame-pointer -moutline-atomics -moverride= -mpc-relative-literal-loads -msign-return-address=none -mstack-protector-guard-offset= -mstack-protector-guard-reg= -mstack-protector-guard=global -msve-vector-bits=scalable -mtls-dialect=desc -mtls-size=24 -mtune=
# gcc -S -fverbose-asm -o /tmp/tmpoo_h3j88/march_native.s /tmp/tmpoo_h3j88/empty.c -march=
gcc: error: missing argument to '-march='
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/resolve_march_native/__main__.py", line 50, in _inner_main
    options.gcc, options.debug).run(options)
                                ^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/resolve_march_native/engine.py", line 122, in run
    march_explicit_flag_set = self._get_march_explicit_flag_set(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/resolve_march_native/engine.py", line 68, in _get_march_explicit_flag_set
    run(self._gcc_command, [self._get_march_explicit(arch)], self._debug)))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/resolve_march_native/runner.py", line 44, in run
    subprocess.check_output(cmd, env=env)
  File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['gcc', '-S', '-fverbose-asm', '-o', '/tmp/tmpoo_h3j88/march_native.s', '/tmp/tmpoo_h3j88/empty.c', '-march=']' returned non-zero exit status 1.
ERROR: Command '['gcc', '-S', '-fverbose-asm', '-o', '/tmp/tmpoo_h3j88/march_native.s', '/tmp/tmpoo_h3j88/empty.c', '-march=']' returned non-zero exit status 1.

gcc says 
$ gcc -march=native -v -E - < /dev/null 2>&1 | grep cc1 | perl -pe 's/ -mno-\S+//g; s/^.* - //g;'
-mlittle-endian -mabi=lp64 -mcpu=emag+crc -dumpbase -

$ emerge --info
Portage 3.0.51 (python 3.11.5-final-0, default/linux/arm64/17.0, gcc-13, glibc-2.38-r4, 6.3.1-gentoo aarch64)
=================================================================
System uname: Linux-6.3.1-gentoo-aarch64-with-glibc2.38
KiB Mem:   263112528 total, 157578824 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sat, 30 Sep 2023 15:30:01 +0000
Head commit of repository gentoo: 6f9633fa02ef5fcb8f300a098b950addb78d438b
sh bash 5.2_p15-r6
ld GNU ld (Gentoo 2.41 p2) 2.41.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p15-r6::gentoo
dev-lang/perl:             5.38.0-r1::gentoo
dev-lang/python:           3.11.5::gentoo, 3.12.0_rc3::gentoo
dev-lang/rust:             1.72.0::gentoo
dev-util/cmake:            3.27.6-r1::gentoo
dev-util/meson:            1.2.2::gentoo
sys-apps/baselayout:       2.14::gentoo
sys-apps/openrc:           0.50::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/autoconf:        2.71-r7::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.41-r1::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/gcc:             13.2.1_p20230826::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.5::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38-r4::gentoo
Repositories:

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

ACCEPT_KEYWORDS="arm64 ~arm64"
ACCEPT_LICENSE="@FREE freedist"
CBUILD="aarch64-unknown-linux-gnu"
CFLAGS="-O2 -pipe -march=armv8-a+crypto+crc"
CHOST="aarch64-unknown-linux-gnu"
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="-O2 -pipe -march=armv8-a+crypto+crc"
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="-O2 -pipe -march=armv8-a+crypto+crc"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs 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="-O2 -pipe -march=armv8-a+crypto+crc"
GENTOO_MIRRORS="http://mirrors.gethosted.online/gentoo                 http://www.mirrorservice.org/sites/distfiles.gentoo.org/                 http://mirrors.soeasyto.com/distfiles.gentoo.org/                 http://mirror.leaseweb.com/gentoo/                 http://gentoo.mirrors.ovh.net/gentoo-distfiles/                 http://ftp.snt.utwente.nl/pub/os/linux/gentoo                 https://www.mirrorservice.org/sites/distfiles.gentoo.org/                 http://mirror.bytemark.co.uk/gentoo/                  http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/                  http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/"
LANG="en_GB.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
MAKEOPTS="-j32"
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"
SHELL="/bin/bash"
USE="acl arm64 bzip2 cli crypt dri fortran gdbm iconv ipv6 libtirpc lvm ncurses nls nptl openmp pam pcre readline seccomp split-usr ssl test-rust thin unicode xattr zlib" 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_ARM="edsp vfp vfpv3 vfpv4 vfp-d32 aes sha1 sha2 crc32 v8" 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" 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="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" QEMU_SOFTMMU_TARGETS="aarch64" QEMU_USER_TARGETS="aarch64" RUBY_TARGETS="ruby31" VIDEO_CARDS="fbdev dummy v4l" 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, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Sebastian Pipping gentoo-dev 2023-10-30 22:31:10 UTC
Probably the same as issue 105 on GitHub: GCC does not seem to provide the needed output on that platform.  Maybe adding support for -mcpu would fix it, that would be GitHub issue 78.
Comment 2 Sebastian Pipping gentoo-dev 2023-10-31 00:22:14 UTC
Any chance you could try pull request https://github.com/hartwork/resolve-march-native/pull/107 ?  The description there includes commands to easy running code off the branch.  Thanks in advance!
Comment 3 Leonid Kopylov 2023-10-31 04:56:29 UTC
on parallels desktop it seems to work fine:

# resolve-march-native
-march=armv8-a+crc+lse+rcpc+rdma+dotprod+aes+sha3+fp16fml+sb+ssbs+flagm+pauth
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-31 04:57:54 UTC
(In reply to Leonid Kopylov from comment #3)
> on parallels desktop it seems to work fine:
> 
> # resolve-march-native
> -march=armv8-a+crc+lse+rcpc+rdma+dotprod+aes+sha3+fp16fml+sb+ssbs+flagm+pauth

This is the version in tree or the PR sping mentions? (Could you try that too?)
Comment 5 Leonid Kopylov 2023-10-31 04:59:04 UTC
# emerge resolve-march-native -pvq
[ebuild   R   ] app-misc/resolve-march-native-2.2.0  USE="-test" PYTHON_TARGETS="python3_11 -python3_10"
Comment 6 Roy Bamford gentoo-dev 2023-10-31 13:58:15 UTC
(In reply to Sebastian Pipping from comment #2)
> Any chance you could try pull request
> https://github.com/hartwork/resolve-march-native/pull/107 ?  The description
> there includes commands to easy running code off the branch.  Thanks in
> advance!

On the Hawk, emag 8180 CPU, I get ... 

(venv) moriarty /tmp/tmp.CEqcBYwlf4/resolve-march-native # resolve-march-native --debug
# gcc -S -fverbose-asm -o /tmp/tmpux9yewls/march_native.s /tmp/tmpux9yewls/empty.c -march=native
Flags extracted: -mabi=lp64 -mcpu=emag+crc -mlittle-endian
Flags extracted: -mabi=lp64 -march= -mbranch-protection= -mcmodel=small -mcpu=emag+crc -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 -mglibc -mharden-sls= -mlittle-endian -momit-leaf-frame-pointer -moutline-atomics -moverride= -mpc-relative-literal-loads -msign-return-address=none -mstack-protector-guard-offset= -mstack-protector-guard-reg= -mstack-protector-guard=global -msve-vector-bits=scalable -mtls-dialect=desc -mtls-size=24 -mtune=
# gcc -S -fverbose-asm -o /tmp/tmp279e9i4d/march_native.s /tmp/tmp279e9i4d/empty.c -march=
gcc: error: missing argument to '-march='
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/resolve_march_native/__main__.py", line 50, in _inner_main
    options.gcc, options.debug).run(options)
                                ^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/resolve_march_native/engine.py", line 122, in run
    march_explicit_flag_set = self._get_march_explicit_flag_set(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/resolve_march_native/engine.py", line 68, in _get_march_explicit_flag_set
    run(self._gcc_command, [self._get_march_explicit(arch)], self._debug)))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/resolve_march_native/runner.py", line 44, in run
    subprocess.check_output(cmd, env=env)
  File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['gcc', '-S', '-fverbose-asm', '-o', '/tmp/tmp279e9i4d/march_native.s', '/tmp/tmp279e9i4d/empty.c', '-march=']' returned non-zero exit status 1.
ERROR: Command '['gcc', '-S', '-fverbose-asm', '-o', '/tmp/tmp279e9i4d/march_native.s', '/tmp/tmp279e9i4d/empty.c', '-march=']' returned non-zero exit status 1.
(venv) moriarty /tmp/tmp.CEqcBYwlf4/resolve-march-native # 

It's not tested on the Pi 4 yet.
Comment 7 Sebastian Pipping gentoo-dev 2023-10-31 18:22:28 UTC
Roy, I have pushed fixes two times more since you tried.  Could you try again with the latest commit (3c50184e022a2d8c4b02b8904c9742b9220e4959)?  I'm optimistic that you'll get better results this time.
Comment 8 Roy Bamford gentoo-dev 2023-10-31 20:02:19 UTC
(In reply to Sebastian Pipping from comment #7)
> Roy, I have pushed fixes two times more since you tried.  Could you try
> again with the latest commit (3c50184e022a2d8c4b02b8904c9742b9220e4959)? 
> I'm optimistic that you'll get better results this time.

Still "negative function"

(venv) moriarty /tmp/tmp.UOxF7ZG66F/resolve-march-native # resolve-march-native --debug
# gcc -S -fverbose-asm -o /tmp/tmp3u1334st/march_native.s /tmp/tmp3u1334st/empty.c -march=native
Flags extracted: -mabi=lp64 -mcpu=emag+crc -mlittle-endian
Flags extracted: -mabi=lp64 -march= -mbranch-protection= -mcmodel=small -mcpu=emag+crc -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 -mglibc -mharden-sls= -mlittle-endian -momit-leaf-frame-pointer -moutline-atomics -moverride= -mpc-relative-literal-loads -msign-return-address=none -mstack-protector-guard-offset= -mstack-protector-guard-reg= -mstack-protector-guard=global -msve-vector-bits=scalable -mtls-dialect=desc -mtls-size=24 -mtune=
# gcc -S -fverbose-asm -o /tmp/tmp5dzrbfvb/march_native.s /tmp/tmp5dzrbfvb/empty.c -march=
gcc: error: missing argument to '-march='
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/resolve_march_native/__main__.py", line 50, in _inner_main
    options.gcc, options.debug).run(options)
                                ^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/resolve_march_native/engine.py", line 122, in run
    march_explicit_flag_set = self._get_march_explicit_flag_set(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/resolve_march_native/engine.py", line 68, in _get_march_explicit_flag_set
    run(self._gcc_command, [self._get_march_explicit(arch)], self._debug)))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/resolve_march_native/runner.py", line 44, in run
    subprocess.check_output(cmd, env=env)
  File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['gcc', '-S', '-fverbose-asm', '-o', '/tmp/tmp5dzrbfvb/march_native.s', '/tmp/tmp5dzrbfvb/empty.c', '-march=']' returned non-zero exit status 1.
ERROR: Command '['gcc', '-S', '-fverbose-asm', '-o', '/tmp/tmp5dzrbfvb/march_native.s', '/tmp/tmp5dzrbfvb/empty.c', '-march=']' returned non-zero exit status 1.
(venv) moriarty /tmp/tmp.UOxF7ZG66F/resolve-march-native # 

Hmm ...

roy@moriarty ~ $ gcc -### -E - -march=native 2>&1 | sed -r '/cc1/!d;s/(")|(^.* - )|( -mno-[^\ ]+)//g'
-mlittle-endian -mabi=lp64 -mcpu=emag+crc -dumpbase -

gcc does not return any -march here, maybe that won't help?

On a Pi4, its the same. Both are using gcc-13.
Pi_4_Pheonix ~ # gcc -### -E - -march=native 2>&1 | sed -r '/cc1/!d;s/(")|(^.* - )|( -mno-[^\ ]+)//g'
-mlittle-endian -mabi=lp64 -mcpu=cortex-a72+crc -dumpbase -


Without the filtering ...
moriarty /tmp/tmp.UOxF7ZG66F/resolve-march-native # gcc -### -E - -march=native 2>&1
Using built-in specs.
COLLECT_GCC=gcc
Target: aarch64-unknown-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/gcc-13-20230826/configure --host=aarch64-unknown-linux-gnu --build=aarch64-unknown-linux-gnu --prefix=/usr --bindir=/usr/aarch64-unknown-linux-gnu/gcc-bin/13 --includedir=/usr/lib/gcc/aarch64-unknown-linux-gnu/13/include --datadir=/usr/share/gcc-data/aarch64-unknown-linux-gnu/13 --mandir=/usr/share/gcc-data/aarch64-unknown-linux-gnu/13/man --infodir=/usr/share/gcc-data/aarch64-unknown-linux-gnu/13/info --with-gxx-include-dir=/usr/lib/gcc/aarch64-unknown-linux-gnu/13/include/g++-v13 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/aarch64-unknown-linux-gnu/13/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 13.2.1_p20230826 p7' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --disable-fixed-point --enable-libgomp --disable-libssp --disable-libada --disable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --without-zstd --without-isl --enable-default-pie --enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.2.1 20230826 (Gentoo 13.2.1_p20230826 p7) 
COLLECT_GCC_OPTIONS='-E'  '-mlittle-endian' '-mabi=lp64' '-mcpu=emag+crc'
 /usr/libexec/gcc/aarch64-unknown-linux-gnu/13/cc1 -E -quiet - -mlittle-endian "-mabi=lp64" "-mcpu=emag+crc" -dumpbase -
COMPILER_PATH=/usr/libexec/gcc/aarch64-unknown-linux-gnu/13/:/usr/libexec/gcc/aarch64-unknown-linux-gnu/13/:/usr/libexec/gcc/aarch64-unknown-linux-gnu/:/usr/lib/gcc/aarch64-unknown-linux-gnu/13/:/usr/lib/gcc/aarch64-unknown-linux-gnu/:/usr/lib/gcc/aarch64-unknown-linux-gnu/13/../../../../aarch64-unknown-linux-gnu/bin/
LIBRARY_PATH=/usr/lib/gcc/aarch64-unknown-linux-gnu/13/:/usr/lib/gcc/aarch64-unknown-linux-gnu/13/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/aarch64-unknown-linux-gnu/13/../../../../aarch64-unknown-linux-gnu/lib/:/usr/lib/gcc/aarch64-unknown-linux-gnu/13/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-E'  '-mlittle-endian' '-mabi=lp64' '-mcpu=emag+crc'

still no -march= returned.
Comment 9 Sebastian Pipping gentoo-dev 2023-10-31 20:26:39 UTC
Hello Roy, I can tell from part of the traceback that it's not running the latest code from commit 3c50184e022a2d8c4b02b8904c9742b9220e4959 — runner.py line 44 would be different.  Are you on the right branch?  Did you update the remote and hard-reset the branch to the latest changes?  How did you install the code from Git to /usr?
Comment 10 Roy Bamford gentoo-dev 2023-10-31 21:35:00 UTC
I used the script in https://github.com/hartwork/resolve-march-native/pull/107
and checked git log to see that HEAD was at commit 3c50184e022a2d8c4b02b8904c9742b9220e4959

I'll try again Wed evening UK time.
Comment 11 Roy Bamford gentoo-dev 2023-11-01 20:14:38 UTC
(In reply to Sebastian Pipping from comment #9)
> Hello Roy, I can tell from part of the traceback that it's not running the
> latest code from commit 3c50184e022a2d8c4b02b8904c9742b9220e4959 — runner.py
> line 44 would be different.  Are you on the right branch?  Did you update
> the remote and hard-reset the branch to the latest changes?  How did you
> install the code from Git to /usr?

This time as a different user. Showing all the steps ...

moriarty is my emag 8180 (Hawk).

roy@moriarty ~ $ cd "$(mktemp -d)"
roy@moriarty /tmp/tmp.9Jg3At02uO $ git clone --branch issue-78-support-mcpu https://github.com/hartwork/resolve-march-native
Cloning into 'resolve-march-native'...
remote: Enumerating objects: 1057, done.
remote: Counting objects: 100% (421/421), done.
remote: Compressing objects: 100% (221/221), done.
remote: Total 1057 (delta 236), reused 331 (delta 200), pack-reused 636
Receiving objects: 100% (1057/1057), 198.46 KiB | 2.02 MiB/s, done.
Resolving deltas: 100% (603/603), done.
roy@moriarty /tmp/tmp.9Jg3At02uO $ cd resolve-march-native/


Checked git log here.

roy@moriarty /tmp/tmp.9Jg3At02uO/resolve-march-native $ git log
roy@moriarty /tmp/tmp.9Jg3At02uO/resolve-march-native $ python3 -m venv venv 
roy@moriarty /tmp/tmp.9Jg3At02uO/resolve-march-native $ source venv/bin/activate
(venv) roy@moriarty /tmp/tmp.9Jg3At02uO/resolve-march-native $ pip install -e .
error: externally-managed-environment

× This environment is externally managed
╰─> 
    The system-wide Python installation in Gentoo should be maintained
    using the system package manager (e.g. emerge).
    
    If the package in question is not packaged for Gentoo, please
    consider installing it inside a virtual environment, e.g.:
    
    python -m venv /path/to/venv
    . /path/to/venv/bin/activate
    pip install mypackage
    
    To exit the virtual environment, run:
    
    deactivate
    
    The virtual environment is not deleted, and can be re-entered by
    re-sourcing the activate file.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
(venv) roy@moriarty /tmp/tmp.9Jg3At02uO/resolve-march-native $ hash resolve-march-native
(venv) roy@moriarty /tmp/tmp.9Jg3At02uO/resolve-march-native $ resolve-march-native --debug
# gcc -S -fverbose-asm -o /tmp/tmpd_k30zra/march_native.s /tmp/tmpd_k30zra/empty.c -march=native
Flags extracted: -mabi=lp64 -mcpu=emag+crc -mlittle-endian
Flags extracted: -mabi=lp64 -march= -mbranch-protection= -mcmodel=small -mcpu=emag+crc -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 -mglibc -mharden-sls= -mlittle-endian -momit-leaf-frame-pointer -moutline-atomics -moverride= -mpc-relative-literal-loads -msign-return-address=none -mstack-protector-guard-offset= -mstack-protector-guard-reg= -mstack-protector-guard=global -msve-vector-bits=scalable -mtls-dialect=desc -mtls-size=24 -mtune=
# gcc -S -fverbose-asm -o /tmp/tmpc0cg0nxb/march_native.s /tmp/tmpc0cg0nxb/empty.c -march=
gcc: error: missing argument to '-march='
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/resolve_march_native/__main__.py", line 50, in _inner_main
    options.gcc, options.debug).run(options)
                                ^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/resolve_march_native/engine.py", line 122, in run
    march_explicit_flag_set = self._get_march_explicit_flag_set(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/resolve_march_native/engine.py", line 68, in _get_march_explicit_flag_set
    run(self._gcc_command, [self._get_march_explicit(arch)], self._debug)))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/resolve_march_native/runner.py", line 44, in run
    subprocess.check_output(cmd, env=env)
  File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['gcc', '-S', '-fverbose-asm', '-o', '/tmp/tmpc0cg0nxb/march_native.s', '/tmp/tmpc0cg0nxb/empty.c', '-march=']' returned non-zero exit status 1.
ERROR: Command '['gcc', '-S', '-fverbose-asm', '-o', '/tmp/tmpc0cg0nxb/march_native.s', '/tmp/tmpc0cg0nxb/empty.c', '-march=']' returned non-zero exit status 1.
(venv) roy@moriarty /tmp/tmp.9Jg3At02uO/resolve-march-native $
Comment 12 Sebastian Pipping gentoo-dev 2023-11-01 21:14:53 UTC
Hello Roy, resolve-march-native run from inside a fully activated virtualenv should not show files from /usr/lib/python3.11/ in tracebacks but from inside the virturalenv — something does not seem to work during "hash" or "source venv/bin/activate", right?  Does "type resolve-march-native" indicate anything helpful?  Are you in Bash?
Comment 13 Roy Bamford gentoo-dev 2023-11-02 17:13:22 UTC
(In reply to Sebastian Pipping from comment #12)
> Hello Roy, resolve-march-native run from inside a fully activated virtualenv
> should not show files from /usr/lib/python3.11/ in tracebacks but from
> inside the virturalenv — something does not seem to work during "hash" or
> "source venv/bin/activate", right?  Does "type resolve-march-native"
> indicate anything helpful?  Are you in Bash?

Sebastian,

I'm a twit. The app-misc/resolve-march-native-2.2.0 was still installed, as # type resolve-march-native
resolve-march-native is /usr/bin/resolve-march-native
returned. That's now removed.

Deactivating the virtual environments (one user one root), removing the /tmp files to clean up the mess, then starting over, now gets me ... 

(venv) roy@moriarty /tmp/tmp.9U4ujXZPjq/resolve-march-native $ hash resolve-march-native
-bash: hash: resolve-march-native: not found.

There is a ./resolve-march-native though.

Then  (venv) roy@moriarty /tmp/tmp.9U4ujXZPjq/resolve-march-native $ resolve-march-native --debug
-bash: resolve-march-native: command not found

as there is nothing called resolve-march-native to execute.
Comment 14 Sebastian Pipping gentoo-dev 2023-11-02 17:37:51 UTC
The "pip install -e ." run from inside the activated virtualenv is what produces the command, located at venv/bin/resolve-march-native (which is in $PATH).
Comment 15 Sebastian Pipping gentoo-dev 2023-11-04 14:09:58 UTC
I'll put the code with -mcpu= support as 3.0.0 into Gentoo now, all other arm64 boxes tried so far worked well with the new code.  We can always improve and fix more after as needed.  New ebuild coming up in a minute.
Comment 16 Larry the Git Cow gentoo-dev 2023-11-04 14:15:21 UTC
The bug has been closed via the following commit(s):

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

commit d4d5c2d0f81876b9ab6cf82b02f6b173aa150fd9
Author:     Sebastian Pipping <sping@gentoo.org>
AuthorDate: 2023-11-04 14:10:52 +0000
Commit:     Sebastian Pipping <sping@gentoo.org>
CommitDate: 2023-11-04 14:14:45 +0000

    app-misc/resolve-march-native: 3.0.0 with -mcpu= support
    
    Closes: https://bugs.gentoo.org/916486
    Signed-off-by: Sebastian Pipping <sping@gentoo.org>

 app-misc/resolve-march-native/Manifest              |  1 +
 .../resolve-march-native-3.0.0.ebuild               | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
Comment 17 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-04 17:51:03 UTC
Thank you for your efforts here!
Comment 18 Roy Bamford gentoo-dev 2023-11-05 17:14:21 UTC
Sebastian,

Thank you. My emag 81880 returns
moriarty ~ # resolve-march-native
-mcpu=emag+crc

and 

a Pi 4 shows
Pi_Router SSD ~ # resolve-march-native
-mcpu=cortex-a72+crc
Comment 19 Sebastian Pipping gentoo-dev 2023-11-05 17:55:03 UTC
Glad to hear, thanks for the update!