tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: go package build problem: go: cannot find GOROOT directory: 'go' binary is trimmed and GOROOT is not set



On Sun, Nov 19, 2023 at 11:58:46PM +0100, Thomas Klausner wrote:
> On Sun, Nov 19, 2023 at 11:38:37PM +0100, Benny Siegert wrote:
> > > Am 19.11.2023 um 23:30 schrieb Thomas Klausner <wiz%netbsd.org@localhost>:
> > > 
> > > 'go121 help' works fine.
> > > 
> > > Manually running (in ${WRKSRC}):
> > > 
> > > # go121 build
> > > go: cannot find GOROOT directory: 'go' binary is trimmed and GOROOT is not set
> > 
> > I have not seen this error message before. 
> > What does "go env" output?
> 
> # go env
> ksh: go: not found
> # go121 env
> go: cannot find GOROOT directory: 'go' binary is trimmed and GOROOT is not set
> 
> > Does setting GOROOT=/usr/pkg/go121 work around the issue?
> 
> This patch makes it work, yes:
> 
> Index: go-module.mk
> ===================================================================
> RCS file: /cvsroot/pkgsrc/lang/go/go-module.mk,v
> retrieving revision 1.10
> diff -u -r1.10 go-module.mk
> --- go-module.mk        6 Jun 2023 12:41:44 -0000       1.10
> +++ go-module.mk        19 Nov 2023 22:58:04 -0000
> @@ -43,6 +43,7 @@
>  
>  MAKE_ENV+=     GO111MODULE=on GOPATH=${WRKDIR}/.gopath GOPROXY=file://${WRKDIR}/.goproxy
>  MAKE_ENV+=     GOCACHE=${WRKDIR}/.cache/go-build
> +MAKE_ENV+=     GOROOT=/usr/pkg/go121
>  
>  .if !target(do-build)
>  do-build:

This is also happening on 9.3, and the above patch does not seem like
the correct solution, especially for hardcoding the path, but also
because it would seem that setting GOROOT to begin with is not "normal",
and it also does not seem "right" that the user would need to set GOROOT
before ever running go121 from the command line.

Go 1.18 works. I notice that it is also dynamically linked, while Go
1.21 is not.

    equinoxe[nb9-amd64]:~> file /usr/pkg/go14/bin/go /usr/pkg/go118/bin/go /usr/pkg/go121/bin/go
    /usr/pkg/go14/bin/go:  ELF 64-bit LSB executable, x86-64, version 1 (NetBSD), statically linked, for NetBSD 5.99, with debug_info, not stripped
    /usr/pkg/go118/bin/go: ELF 64-bit LSB executable, x86-64, version 1 (NetBSD), dynamically linked, interpreter /usr/libexec/ld.elf_so, for NetBSD 7.0, Go BuildID=yFjC4jbgBYclil_BQRoL/LHfn5NZeIscXqiPSQxDP/pzS8RtoevdGiqaDDjXkB/4kQ9Deq8e8wT_IChSE1U, not stripped
    /usr/pkg/go121/bin/go: ELF 64-bit LSB executable, x86-64, version 1 (NetBSD), statically linked, for NetBSD 7.0, Go BuildID=mo50fM8sZlZR88Jureo8/O2bSbSoGqJGrLiXu92BK/ahn4FIgsuwkF5KdCurHl/ko2Vgte_5K4OA3mfqV8V, not stripped

    equinoxe[nb9-amd64]:~> /usr/pkg/go14/bin/go version
    go version go1.4.3 netbsd/amd64
    equinoxe[nb9-amd64]:~> go118 version
    go version go1.18.10 netbsd/amd64
    equinoxe[nb9-amd64]:~> go121 version
    go: cannot find GOROOT directory: 'go' binary is trimmed and GOROOT is not set

If that last one had worked, it should have shown 1.21.5.

How can we get go121 working again?

As an aside, I also found it surprising that pkg_alternatives will point
"go" at the older version:

    equinoxe[nb9-amd64]:~> go version
    go version go1.18.10 netbsd/amd64

Kind regards,
+ Kimmo


Home | Main Index | Thread Index | Old Index