Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Dec 2024 09:23:08 +0100
From:      Robert Clausecker <fuz@freebsd.org>
To:        Koichiro Iwao <meta@freebsd.org>
Cc:        ports@freebsd.org, go@freebsd.org
Subject:   Re: go: exec go1.22.6: permission denied
Message-ID:  <Z1ARbNCa3o69DyH7@fuz.su>
In-Reply-To: <zlkvoroky3ytxgvzdtbdmq75fv7h6pxwzpijvsmptj5x4j7rja@crfppwz756kq>
References:  <zlkvoroky3ytxgvzdtbdmq75fv7h6pxwzpijvsmptj5x4j7rja@crfppwz756kq>

next in thread | previous in thread | raw e-mail | index | archive | help
Am Wed, Dec 04, 2024 at 11:36:23AM +0900 schrieb Koichiro Iwao:
> Hello folks,
> 
> I got the following error when trying to build some go packages. I found
> the cause so I'd like to share it if this help someone.
> 
> # portmaster www/gohugo
> ===>  License APACHE20 accepted by the user
> ===>   gohugo-0.139.3,1 depends on file: /usr/local/sbin/pkg - found
> ===>   gohugo-0.139.3,1 depends on file: /usr/local/bin/go121 - found
> ===>   gohugo-0.139.3,1 depends on package: ca_root_nss>0 - found
> ===> Fetching all distfiles required by gohugo-0.139.3,1 for building
> ===> Fetching github.com/gohugoio/hugo dependencies
> go: exec go1.22.6: permission denied
> *** Error code 1
> 
> Stop.
> make[1]: stopped in /usr/ports/www/gohugo
> 
> It turns out this was because I had dropped exec bit on
> zroot/usr/ports/distfiles a decade ago according to the previously
> recommended filesystem layout.
> >  zfs create -o exec=off -o setuid=off zroot/usr/ports/distfiles
> https://wiki.freebsd.org/RootOnZFS/PoolLayout
> 
> After I turn on exec bit unser distfiles directory, it works
> perfectly.
> > zfs set exec=on zroot/usr/ports/distfiles

The reason for this is that your package requires Go 1.22 to build, but
Go 1.21 has been configured as the toolchain to use for this package.
Go helpfully downloads a Go 1.22 toolchain and tries to use that to build
the package, which fails as the distfiles are not executable.

We should avoid this scenario by setting GOTOOLCHAIN=local in the
environment when building Go ports.  This forces Go to always use the
installed Go toolchain instead of trying to download a different one.

See https://go.dev/doc/toolchain#select for how this mechanism works.

As a maintainer, you should set USES=go:1.22 when this happens, forcing
the Go toolchain to at least 1.22.

Yours,
Robert Clausecker

-- 
()  ascii ribbon campaign - for an encoding-agnostic world
/\  - against html email  - against proprietary attachments




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Z1ARbNCa3o69DyH7>