dundee / gdu

Fast disk usage analyzer with console interface written in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pi5 aarch64: gcc: error: unrecognized command-line option '-marm'

glowinthedark opened this issue · comments

Building from source on raspberry pi 5 throws a compile error:

$ go install github.com/dundee/gdu/v5/cmd/gdu@latest

go: downloading github.com/dundee/gdu/v5 v5.25.0
go: downloading github.com/dundee/gdu v1.7.1
go: downloading github.com/gdamore/tcell/v2 v2.6.0
go: downloading github.com/rivo/tview v0.0.0-20230530133550-8bd761dda819
go: downloading github.com/mattn/go-isatty v0.0.19
go: downloading github.com/sirupsen/logrus v1.9.2
go: downloading golang.org/x/sys v0.8.0
go: downloading github.com/maruel/natural v1.1.0
go: downloading github.com/fatih/color v1.15.0
go: downloading github.com/gdamore/encoding v1.0.0
go: downloading github.com/lucasb-eyer/go-colorful v1.2.0
go: downloading github.com/mattn/go-runewidth v0.0.14
go: downloading golang.org/x/term v0.8.0
go: downloading golang.org/x/text v0.9.0
go: downloading github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
go: downloading github.com/rivo/uniseg v0.4.4
# runtime/cgo
gcc: error: unrecognized command-line option '-marm'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

System details

Click to show details
$ go version
go version go1.21.5 linux/arm

----------------------

$ uname -a
Linux iq 6.1.0-rpi7-rpi-2712 #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64 GNU/Linux

----------------------

$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

----------------------

$ lscpu
Architecture:            aarch64
  CPU op-mode(s):        32-bit, 64-bit
  Byte Order:            Little Endian
CPU(s):                  4
  On-line CPU(s) list:   0-3
Vendor ID:               ARM
  Model name:            Cortex-A76
    Model:               1
    Thread(s) per core:  1
    Core(s) per cluster: 4
    Socket(s):           -
    Cluster(s):          1
    Stepping:            r4p1
    CPU(s) scaling MHz:  100%
    CPU max MHz:         2400.0000
    CPU min MHz:         1000.0000
    BogoMIPS:            108.00
    Flags:               fp asimd evtstrm aes pmull sha1 sha2 crc32

                          atomics fphp asimdhp cpuid asimdrdm lrcpc

                          dcpop asimddp
Vulnerabilities:
  Gather data sampling:  Not affected
  Itlb multihit:         Not affected
  L1tf:                  Not affected
  Mds:                   Not affected
  Meltdown:              Not affected
  Mmio stale data:       Not affected
  Retbleed:              Not affected
  Spec rstack overflow:  Not affected
  Spec store bypass:     Mitigation; Speculative Store Bypass disab

                         led via prctl
  Spectre v1:            Mitigation; __user pointer sanitization
  Spectre v2:            Mitigation; CSV2, BHB
  Srbds:                 Not affected
  Tsx async abort:       Not affected

I submitted a similar error report for building with go a few days ago. Cannot find my submission.
Using same go version, 64 bit Bookworm, same build same go on Pi4 Bullseye is fine.

A possible workaround is to cross-compile it on some other box with a working golang env (e.g. linux x64, mac x64/arm64, etc) with:

git clone https://github.com/dundee/gdu.git
cd gdu/cmd/gdu
GOOS=linux GOARCH=arm64 go build -o gdu main.go

This will produce the gdu executable for aarch64 that will run n a pi5, etc.

@skutoroff: confirming — the root cause is installing an armv6l version of golang on an arm64 OS. Removing the go env and reinstalling the arm64 flavour from https://go.dev/dl/ solves the issue.