<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>14116</bug_id>
          
          <creation_ts>2020-11-05 02:18:05 +0000</creation_ts>
          <short_desc>Go cannot compile on target</short_desc>
          <delta_ts>2022-06-14 20:30:50 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>3.4</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.99</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ross Burton">ross.burton</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>mark.asselstine</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>88549</commentid>
    <comment_count>0</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2020-11-05 02:18:05 +0000</bug_when>
    <thetext>Building Go code on the target fails because `go env` contains CC assignments which include --sysroot:

go build runtime/cgo: arm-poky-linux-gnueabi-gcc -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a8 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/andy/yocto/build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/go/1.14.7-r0/recipe-sysroot: fork/exec arm-poky-linux-gnueabi-gcc -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a8 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/andy/yocto/build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/go/1.14.7-r0/recipe-sysroot: no such file or directory

That&apos;s the build sysroot, so obviously shouldn&apos;t be used on target.

https://github.com/golang/go/issues/8161 is a related upstream bug, but appears to be saying &quot;the user should work around this&quot; instead of actually fixing the bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90944</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-07-15 15:13:51 +0000</bug_when>
    <thetext>Not much call for using go on target.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93505</commentid>
    <comment_count>2</comment_count>
    <who name="Mark">mark.asselstine</who>
    <bug_when>2022-06-14 20:03:07 +0000</bug_when>
    <thetext>Ross, it appears we can close this issue. I just did a build on master of core-image-minimal with &quot;go&quot; and &quot;go-dev&quot; added to the image. I haven&apos;t dug around to see what has changed but to help cleanup the bug backlog when you have a chance could you retest and withdraw the bug if you get similar results?

---
root@qemux86-64:~# cat main.go
package main
import &quot;fmt&quot;
func main() {
    fmt.Println(&quot;hello world&quot;)
}
root@qemux86-64:~# go build main.go 
root@qemux86-64:~# ./main 
hello world
root@qemux86-64:~# go env
GO111MODULE=&quot;&quot;
GOARCH=&quot;amd64&quot;
GOBIN=&quot;&quot;
GOCACHE=&quot;/root/.cache/go-build&quot;
GOENV=&quot;/root/.config/go/env&quot;
GOEXE=&quot;&quot;
GOEXPERIMENT=&quot;&quot;
GOFLAGS=&quot;&quot;
GOHOSTARCH=&quot;amd64&quot;
GOHOSTOS=&quot;linux&quot;
GOINSECURE=&quot;&quot;
GOMODCACHE=&quot;/root/go/pkg/mod&quot;
GONOPROXY=&quot;&quot;
GONOSUMDB=&quot;&quot;
GOOS=&quot;linux&quot;
GOPATH=&quot;/root/go&quot;
GOPRIVATE=&quot;&quot;
GOPROXY=&quot;https://proxy.golang.org,direct&quot;
GOROOT=&quot;/usr/lib64/go&quot;
GOSUMDB=&quot;sum.golang.org&quot;
GOTMPDIR=&quot;&quot;
GOTOOLDIR=&quot;/usr/lib64/go/pkg/tool/linux_amd64&quot;
GOVCS=&quot;&quot;
GOVERSION=&quot;go1.18.2&quot;
GCCGO=&quot;gccgo&quot;
GOAMD64=&quot;v1&quot;
AR=&quot;ar&quot;
CC=&quot;gcc&quot;
CXX=&quot;g++&quot;
CGO_ENABLED=&quot;1&quot;
GOMOD=&quot;/dev/null&quot;
GOWORK=&quot;&quot;
CGO_CFLAGS=&quot;-g -O2&quot;
CGO_CPPFLAGS=&quot;&quot;
CGO_CXXFLAGS=&quot;-g -O2&quot;
CGO_FFLAGS=&quot;-g -O2&quot;
CGO_LDFLAGS=&quot;-g -O2&quot;
PKG_CONFIG=&quot;pkg-config&quot;
GOGCCFLAGS=&quot;-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2590820835=/tmp/go-build -gno-record-gcc-switches&quot;
root@qemux86-64:~#
---</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93506</commentid>
    <comment_count>3</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2022-06-14 20:30:50 +0000</bug_when>
    <thetext>Good enough for me, thanks Mark.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>