Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 830917 - app-containers/docker on arm64 requires x86_64 gcc
Summary: app-containers/docker on arm64 requires x86_64 gcc
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM64 Linux
: Normal normal (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-10 12:01 UTC by Viacheslav Gagara
Modified: 2022-01-11 11:23 UTC (History)
3 users (show)

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


Attachments
build.log (build.log,3.44 KB, text/x-log)
2022-01-10 12:04 UTC, Viacheslav Gagara
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Viacheslav Gagara 2022-01-10 12:01:51 UTC
When emerging docker on arm64 arch it fails with:
> cgo: C compiler "x86_64-pc-linux-gnu-gcc" not found: exec: "x86_64-pc-linux-gnu-gcc": executable file not found in $PATH

Issue is reproduced in both native env (RPi board) as well as in chroot-ed qemu env.
If I cross-compile it on amd64 and then install on arm64 from binpkg then I got:
> -bash: /usr/bin/docker: cannot execute binary file: Exec format error  

Reproducible: Always

Steps to Reproduce:
1. emerge app-containers/docker
Actual Results:  
---> Making bundle: dynbinary (in bundles/dynbinary)
Building: bundles/dynbinary-daemon/dockerd-20.10.12
GOOS="" GOARCH="" GOARM=""
# runtime/cgo
cgo: C compiler "x86_64-pc-linux-gnu-gcc" not found: exec: "x86_64-pc-linux-gnu-gcc": executable file not found in $PATH


Expected Results:  
emerge should be OK

emerge --info
Portage 3.0.30 (python 3.9.9-final-0, default/linux/arm64/17.0, gcc-11.2.1, glibc-2.34-r4, 5.10.63-v8+ aarch64)
=================================================================
System uname: Linux-5.10.63-v8+-aarch64-with-glibc2.34
KiB Mem:     3440512 total,   2498700 free
KiB Swap:    1048572 total,   1048572 free
Timestamp of repository gentoo: Sat, 08 Jan 2022 10:51:51 +0000
Head commit of repository gentoo: a04c5ec400cba428929a913af02ecd5927ed0328

Head commit of repository genpi-tools: fad1235510901211a5008f853c571272a838ec89

Head commit of repository genpi64: 2e6be3d047e50ffbb44dfd4f38e103fe85860d81

sh bash 5.1_p16
ld GNU ld (Gentoo 2.37_p1 p1) 2.37
distcc 3.4 aarch64-unknown-linux-gnu [disabled]
app-misc/pax-utils:        1.3.3::gentoo
app-shells/bash:           5.1_p16::gentoo
dev-lang/perl:             5.34.0-r6::gentoo
dev-lang/python:           3.9.9::gentoo, 3.10.1-r1::gentoo
dev-util/cmake:            3.22.1::gentoo
dev-util/meson:            0.60.3::gentoo
sys-apps/baselayout:       2.8::gentoo
sys-apps/openrc:           0.44.10::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.71-r1::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.37_p1-r1::gentoo
sys-devel/binutils-config: 5.4::gentoo
sys-devel/gcc:             11.2.1_p20211127::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.6-r6::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.15-r3::gentoo (virtual/os-headers)
sys-libs/glibc:            2.34-r4::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo
    priority: -1000

genpi-tools
    location: /var/db/repos/genpi-tools
    sync-type: git
    sync-uri: https://github.com/GenPi64/genpi-tools.git
    masters: gentoo
    priority: 50

genpi64
    location: /var/db/repos/genpi64
    sync-type: git
    sync-uri: https://github.com/GenPi64/genpi64-overlay.git
    masters: gentoo
    priority: 100

Installed sets: @pi4, @standard
ACCEPT_KEYWORDS="arm64 ~arm64"
ACCEPT_LICENSE="@FREE curl"
CBUILD="aarch64-unknown-linux-gnu"
CFLAGS="-O2"
CHOST="aarch64-unknown-linux-gnu"
CONFIG_PROTECT="/boot/cmdline.txt /boot/config.txt /boot/startup.sh /etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--jobs=5 --load-average=4"
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_C
ONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles getbinpk
g ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms str
ict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2"
GENTOO_MIRRORS="http://gentoo.osuosl.org/ http://trumpetti.atm.tut.fi/gentoo/ http://distfiles.gentoo.org"
LANG="en_GB.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5 -l4"
PKGDIR="/var/cache/binpkgs"
PORTAGE_BINHOST="http://desna/aarch64-packages https://packages.genpi64.com/ https://fi.packages.genpi64.com/"
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 libglvnd libtirpc ncurses nls nptl openmp pam pcre readline seccomp split-usr ssl unicode xattr zlib" A
DA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_fil
e 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_fi
lter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vho
st_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_ARM="edsp thumb thumb2 v4 v5 v6 v7
 v8 vfp vfp-d32 vfpv3 vfpv4" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip na
vcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="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="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYT
HON_TARGETS="python3_9" RUBY_TARGETS="ruby26 ruby27" USERLAND="GNU" VIDEO_CARDS="fbdev vc4 v3d" 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, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTAL
L_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTA
GE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Viacheslav Gagara 2022-01-10 12:04:26 UTC
Created attachment 761774 [details]
build.log
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-01-11 05:38:08 UTC
No idea off the top of my head. Built fine here on arm64. Will need gyakovlev.

Can you share "env"?
Comment 3 Viacheslav Gagara 2022-01-11 08:18:29 UTC
# env
SHELL=/bin/bash
LESS=-R -M --shift 5
CONFIG_PROTECT_MASK=/etc/sandbox.d /etc/fonts/fonts.conf /etc/gentoo-release /etc/terminfo /etc/ca-certificates.conf /etc/revdep-rebuild
DISTCC_VERBOSE=0
EDITOR=vim
PWD=/root
CONFIG_PROTECT=/usr/share/gnupg/qualified.txt /boot/config.txt /boot/cmdline.txt /boot/startup.sh
LOGNAME=root
DISTCC_TCP_CORK=
MANPATH=/usr/share/gcc-data/aarch64-unknown-linux-gnu/11.2.1/man:/usr/share/binutils-data/aarch64-unknown-linux-gnu/2.37_p1/man:/usr/local/share/man:/usr/share/ma
n
UNCACHED_ERR_FD=
HOME=/root
LANG=en_GB.utf8
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;
42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01
;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01
;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*
.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm
=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;
35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:
*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01
;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.cfg=00;32:*.conf=00;32:*.diff=00;32:*.doc=00;32:*.ini=00;32:*.log=00;32:*.patch=00;32:*.pdf=00;32:*.ps=00;32:*.tex=00;32
:*.txt=00;32:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga
=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
OPENGL_PROFILE=xorg-x11
DISTCC_FALLBACK=1
DCC_EMAILLOG_WHOM_TO_BLAME=
QT_GRAPHICSSYSTEM=raster
INFOPATH=/usr/share/gcc-data/aarch64-unknown-linux-gnu/11.2.1/info:/usr/share/binutils-data/aarch64-unknown-linux-gnu/2.37_p1/info:/usr/share/info
TERM=xterm-256color
LESSOPEN=|lesspipe %s
USER=root
MANPAGER=manpager
SHLVL=1
DISTCC_SAVE_TEMPS=0
PAGER=/usr/bin/less
DISTCC_SSH=
XSESSION=Xfce4
GCC_SPECS=
DISTCC_ENABLE_DISCREPANCY_EMAIL=
LC_COLLATE=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin
_=/usr/bin/env
Comment 4 Georgy Yakovlev archtester gentoo-dev 2022-01-11 08:39:59 UTC
looks like your go is mis-behaving and somehow enters cross mode. but ofc it fails in CGO because no compiler available.


what version of dev-lang/go?
is it from ::gentoo repo?


please send output of the following commands:

go env

go version
Comment 5 Viacheslav Gagara 2022-01-11 08:52:30 UTC
# equery l dev-lang/go
 * Searching for go in dev-lang ...
[IP-] [  ] dev-lang/go-1.17.5:0/1.17.5

# go version
go version go1.17.5 linux/arm64

# go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_arm64"
GOVCS=""
GOVERSION="go1.17.5"
GCCGO="gccgo"
AR="ar"
CC="x86_64-pc-linux-gnu-gcc"
CXX="aarch64-unknown-linux-gnu-g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1470680700=/tmp/go-build -gno-record-gcc-s
witches"

Indeed this looks strange
>CC="x86_64-pc-linux-gnu-gcc"
>CXX="aarch64-unknown-linux-gnu-g++"

Let me try to rebuild go
Comment 6 Georgy Yakovlev archtester gentoo-dev 2022-01-11 10:07:59 UTC
yeah as you see CC="x86_64-pc-linux-gnu-gcc" somehow made it into go.
rebuild it without cross or distcc involved.

but docker is certainly fine on arm64 if go compiler does not do that =)

good luck.
Comment 7 Georgy Yakovlev archtester gentoo-dev 2022-01-11 10:22:04 UTC
you should be able to override it with 

go env -w "CC=aarch64-unknown-linux-gnu-gcc"

but only for user that runs it.
it writes own config to $HOME/.config/go/env

but since this is happening for you in portage too it indicates that wrong default value got in and was hardcoded.

it does react on changing CC from environment.

CC=fake go env CC
fake


does not look like it gets overridden wrongly by portage environment though, as otherwise it would not show up for you running go as root. so everything points to binary so far.
Comment 8 Viacheslav Gagara 2022-01-11 11:16:30 UTC
Indeed. I had broken go. It was installed from binary which was cross-compiled in x86_64.
Re-emerged go natively on arm64 and now docker build works fine.
Thanks a lot for helping!
Bug can be closed.
Comment 9 Georgy Yakovlev archtester gentoo-dev 2022-01-11 11:23:25 UTC
great to hear, you are welcome.