Skip to contentSkip to conversation

package/go-bin: new package

PATCH Christian Stewart via buildroot 2 participants 12 messages Oct 17, 2022 – Oct 18, 2022 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi all,

This looks interesting, one request though...

Review

Quoted 4 lines · Thomas Perale
(quoted diff) +3 -0
+       # Default to host-go-bin
 
+       default "host-go-bin" if BR2_PACKAGE_HOST_GO_BIN
+       default "host-go" if BR2_PACKAGE_HOST_GO

Please don't default to downloading something predompiled. Especially when the behavior currently defaults to compiling everything from source.

Thanks,
Christian Stewart

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Christian, All,

On 2022-10-17 09:05 -0700, Christian Stewart via buildroot spake thusly:

Quoted 11 lines

Hi all,
This looks interesting, one request though...

Quoted 1 line · Thomas Perale

+       # Default to host-go-bin

+       default "host-go-bin" if BR2_PACKAGE_HOST_GO_BIN +       default "host-go" if BR2_PACKAGE_HOST_GO

Please don't default to downloading something predompiled. Especially when the behavior currently defaults to compiling everything from source.

Agreed. The default should be to build everything from source when sources are available. The pre-built packages are only a fallback as a convenience for those that are too much in a hurry.

Regards,
Yann E. MORIN.

Quoted 10 lines

Thanks,
Christian Stewart

Links:
1. mailto:[email protected]

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw
Quoted 3 lines · On Mon, 17 Oct 2022 20:03:50 +0200 "Yann E. MORIN" <[email protected]>…

Agreed. The default should be to build everything from source when sources are available. The pre-built packages are only a fallback as a convenience for those that are too much in a hurry.

Except we do exactly the opposite for Rust, and I'm not sure for the host compiler of those languages it is a good idea to cause such a major impact on the default build time faced by our users. I clearly understand the need to be able from source and appreciate how important it is, but I'm not so sure the default should be to build all those compilers from source.

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

Thomas,

Quoted 8 lines · Thomas Petazzoni
Quoted 3 lines · On Mon, 17 Oct 2022 20:03:50 +0200 "Yann E. MORIN" <[email protected]>…

Agreed. The default should be to build everything from source when sources are available. The pre-built packages are only a fallback as a convenience for those that are too much in a hurry.

Quoted 6 lines

Except we do exactly the opposite for Rust, and I'm not sure for the host compiler of those languages it is a good idea to cause such a major impact on the default build time faced by our users. I clearly understand the need to be able from source and appreciate how important it is, but I'm not so sure the default should be to build all those compilers from source.

As you mentioned in a reply on the other email thread-

The main thing that takes time with host-go from source is building the C toolchain.

Provided that the C toolchain is pre-compiled, building host-go doesn't take long (~1-2 mins).

Best regards,
Christian Stewart
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

Re: [Buildroot] [PATCH 1/4] package/goc: new virtual package

Hi Thomas,

Quoted 5 lines · Thomas Perale

This virtual package implement the already existing go compiler compiled from source and shows it on the host package menu.

The usage of a virtual package on top of the go compiler enable the supports of for multiple providers for the Go compiler.

Is it not possible to continue using the existing host-go target and simply add a parameter which enables downloading the precompiled version instead?

Rather than add a new package.

Thanks,
Christian Stewart

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#8 lore raw

Re: [Buildroot] [PATCH 1/4] package/goc: new virtual package

Christian, All,

On 2022-10-17 09:06 -0700, Christian Stewart spake thusly:

Quoted 9 lines · Thomas Perale

This virtual package implement the already existing go compiler compiled from source and shows it on the host package menu.
The usage of a virtual package on top of the go compiler enable the supports of for multiple providers for the Go compiler.
Is it not possible to continue using the existing host-go target and simply add a parameter which enables downloading the precompiled version instead?
Rather than add a new package.

In fact, we want to have a similar implementation for rust, go, nodejs, so (without looking at the details of this series), I guess Thomas Perale took the same approach as the existing rust situation, like Thomas Petazzoni did in the recent host-nodejs series:

    https://patchwork.ozlabs.org/project/buildroot/list/?series=319967

Regards,
Yann E. MORIN.

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#9 lore raw

Re: [Buildroot] [PATCH 1/4] package/goc: new virtual package

Yann,

Quoted 14 lines · Yann E. MORIN

Christian, All,

On 2022-10-17 09:06 -0700, Christian Stewart spake thusly:

Quoted 9 lines · Thomas Perale

This virtual package implement the already existing go compiler compiled from source and shows it on the host package menu.
The usage of a virtual package on top of the go compiler enable the supports of for multiple providers for the Go compiler.
Is it not possible to continue using the existing host-go target and simply add a parameter which enables downloading the precompiled version instead?
Rather than add a new package.

Quoted 6 lines

In fact, we want to have a similar implementation for rust, go, nodejs, so (without looking at the details of this series), I guess Thomas Perale took the same approach as the existing rust situation, like Thomas Petazzoni did in the recent host-nodejs series:

    https://patchwork.ozlabs.org/project/buildroot/list/?series=319967

Thomas changed host-nodejs to be a metapackage:

https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

This is not what this series does, which is to add a new host-goc package and refactor all Go packages to point to this new one.

Sidenote: having a rust-bin and nodejs-bin makes sense, as those take a /very long/ time to compile. Having a go-bin on the other hand does not make as much sense, because compiling the Go compiler is fast (about 1 minute vs. Rust's 1 hour).

In my opinion:

- Do not add a new host-goc package.
- Add parameter to host-go to select which compiler to use:
- bin
- src
- host go compiler (see patch linked below)
- If src is buildable: default to it
- If src is not buildable: default to host Go compiler
- Or if the parameter is set: use bin download

This patch already solves the issue of selecting when to use the host go compiler or not:

https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

... it would be straightforward to add the Config parameter + binary download to host-go after applying that commit.

My reasoning for why:

- Avoid refactoring all Go packages across the tree.
- Avoid confusing "goc" name (not used in Go ecosystem)
- Backwards compatible with existing configs.
- Fewer packages to maintain, easier to understand structure.

I'll have a look at submitting a RFC series adjusting this one to the above structure.

Thanks,
Christian Stewart
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#10 lore raw

Re: [Buildroot] [PATCH 1/4] package/goc: new virtual package

Dear Christian, Yann,

Thank you for responses.

As Yann said my idea behing "goc" was to keep the structure the same as the already existing case of 'rustc'. But I do agree with you Christian the 'goc' name is confusing and don't make much sense. Right now I'm already working on a second patch that will put every "go" related packages in a sub-directory:

Quoted 7 lines

package/

├─ go/
│  ├─ go/
│  ├─ go-bin/
│  ├─ go-bootstrap/
│  ├─ go.mk
│  ├─ Config.in

This will remove the dependency to 'goc' virtual package because I will move it to 'package/go/go.mk' with the common variable between every 'go*' package. I just want to keep the same structure as Rust from now and if I do the modification of moving it to a subdir I also want to do the modification for rust packages.

PERALE Thomas

Quoted 59 lines · Christian Stewart

Yann,

Quoted 12 lines · Yann E. MORIN

Christian, All,

On 2022-10-17 09:06 -0700, Christian Stewart spake thusly:

Quoted 9 lines · Thomas Perale

This virtual package implement the already existing go compiler compiled from source and shows it on the host package menu.
The usage of a virtual package on top of the go compiler enable the supports of for multiple providers for the Go compiler.
Is it not possible to continue using the existing host-go target and simply add a parameter which enables downloading the precompiled version instead?
Rather than add a new package.

Quoted 6 lines

In fact, we want to have a similar implementation for rust, go, nodejs, so (without looking at the details of this series), I guess Thomas Perale took the same approach as the existing rust situation, like Thomas Petazzoni did in the recent host-nodejs series:

    https://patchwork.ozlabs.org/project/buildroot/list/?series=319967

Thomas changed host-nodejs to be a metapackage:

https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

This is not what this series does, which is to add a new host-goc package and refactor all Go packages to point to this new one.

Sidenote: having a rust-bin and nodejs-bin makes sense, as those take a /very long/ time to compile. Having a go-bin on the other hand does not make as much sense, because compiling the Go compiler is fast (about 1 minute vs. Rust's 1 hour).

In my opinion:

- Do not add a new host-goc package.
- Add parameter to host-go to select which compiler to use:
- bin
- src
- host go compiler (see patch linked below)
- If src is buildable: default to it
- If src is not buildable: default to host Go compiler
- Or if the parameter is set: use bin download

This patch already solves the issue of selecting when to use the host go compiler or not:

https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

... it would be straightforward to add the Config parameter + binary download to host-go after applying that commit.

My reasoning for why:

- Avoid refactoring all Go packages across the tree.
- Avoid confusing "goc" name (not used in Go ecosystem)
- Backwards compatible with existing configs.
- Fewer packages to maintain, easier to understand structure.

Quoted 5 lines

I'll have a look at submitting a RFC series adjusting this one to the above structure.

Thanks,
Christian Stewart

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#11 lore raw

Re: [Buildroot] [PATCH 1/4] package/goc: new virtual package

In reply to Christian Stewart via buildroot

Christian, All,

On 2022-10-17 11:10 -0700, Christian Stewart spake thusly:

Quoted 16 lines · Yann E. MORIN
Quoted 15 lines

On 2022-10-17 09:06 -0700, Christian Stewart spake thusly:

Quoted 9 lines · Thomas Perale

This virtual package implement the already existing go compiler compiled from source and shows it on the host package menu.
The usage of a virtual package on top of the go compiler enable the supports of for multiple providers for the Go compiler.
Is it not possible to continue using the existing host-go target and simply add a parameter which enables downloading the precompiled version instead?
Rather than add a new package.

In fact, we want to have a similar implementation for rust, go, nodejs, so (without looking at the details of this series), I guess Thomas Perale took the same approach as the existing rust situation, like Thomas Petazzoni did in the recent host-nodejs series:

Quoted 5 lines
Quoted 1 line
    https://patchwork.ozlabs.org/project/buildroot/list/?series=319967

Thomas changed host-nodejs to be a metapackage:

https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

That patch does:
- move the current host-nodejs package to host-nodejs-src as a host-generic-pacakge,
- changes the existing host-nodejs from a host-generic-package to a host-virtual-package

(there is no such notion as a meta-package in Buildroot)

Quoted 2 lines

This is not what this series does, which is to add a new host-goc package and refactor all Go packages to point to this new one.

I had a quick look, and it is indeed not what I expected it to be.

Quoted 4 lines

Sidenote: having a rust-bin and nodejs-bin makes sense, as those take a /very long/ time to compile. Having a go-bin on the other hand does not make as much sense, because compiling the Go compiler is fast (about 1 minute vs. Rust's 1 hour).

It takes a bit longer here, as host-go-bootstrap depends on the toolchain. So, running "make foo-legal-info" to check a go package, does take ages.

Quoted 5 lines

In my opinion:
- Do not add a new host-goc package.
- Add parameter to host-go to select which compiler to use:
- bin
- src

I am not sure I follow what you are saying. If you are sayng that it should be as rust currently is, and as the nodejs proposal is, then I agree. ;-)

Quoted 1 line

- host go compiler (see patch linked below)

If we have a pre-built host-go in the tree, thetre is then no reason to be able to use the host system go compiler, is there?

Quoted 7 lines

- If src is buildable: default to it
- If src is not buildable: default to host Go compiler
- Or if the parameter is set: use bin download

This patch already solves the issue of selecting when to use the host go compiler or not:

Quoted 8 lines

https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

... it would be straightforward to add the Config parameter + binary download to host-go after applying that commit.

My reasoning for why:

- Avoid refactoring all Go packages across the tree.

Agreed. This should be transparent to packages.

Quoted 1 line

- Avoid confusing "goc" name (not used in Go ecosystem)

Agreed.

Quoted 1 line

- Backwards compatible with existing configs.

If that is possible, then agreed; if it is not, then use sensible defaults (like build from source by default).

Quoted 1 line

- Fewer packages to maintain,

Not too much of a headache...

Quoted 1 line

easier to understand structure.

I am afraid I have to agree on that part, as the existing host-rust strucutre bit me not too long ago...

Quoted 2 lines

I'll have a look at submitting a RFC series adjusting this one to the above structure.

I would emphasize that we do want to have an similar implementation for go that we have for rust, and as was proposed for node.

Regards,
Yann E. MORIN.

Quoted 2 lines

Thanks,
Christian Stewart

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#12 lore raw

Re: [Buildroot] [PATCH 1/4] package/goc: new virtual package

Hi Yann,

Just to reply to that one question on why a host go compiler is useful-

Quoted 4 lines · Yann E. MORIN
Quoted 1 line

- host go compiler (see patch linked below)

If we have a pre-built host-go in the tree, thetre is then no reason to be able to use the host system go compiler, is there?

The host Go compiler may be compiled from source (i.e. Gentoo) and the user (me) wants to trust the gentoo binary for Go over downloading another precompiled bin from the internet.

Thomas -

Quoted 9 lines · Thomas Petazzoni

- NodeJS (proposed by me)

   virtual package:             host-nodejs
   pre-compiled package:        host-nodejs-bin
   from source package:         host-nodejs-src

The odd thing here being that host-nodejs is a virtual package, but nodejs is a regular package building NodeJS from source for the target.

Quoted 8 lines

- Go (proposed by Thomas Perale)

   virtual package:             host-goc
   pre-compiled package:        host-go-bin
   from source package:         host-go

So Thomas aligned on the naming used in the Rust world. I must say I do have a preference for the naming I have chosen for NodeJS, which IMO is clearer.

I agree that the following would be preferable:

virtual package:             host-go
pre-compiled package:        host-go-bin
from source package:         host-go-src

... although I would submit that all 3 could live in a single host-go package.

Best,
Christian Stewart
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#13 lore raw

Re: [Buildroot] [PATCH 1/4] package/goc: new virtual package

Dear Christian, Thomas,

I also do agree renaming the 'go' package to 'go-src' is clearer. But then to not modify the content of package/pkg-golang.mk I will also need to move the variable used by package/pkg-golang.mk aswell as package/go-src/ go-src.mk to package/go/go.mk (for instance HOST_GO_COMMON_ENV, HOST_GO_TARGET_ENV, ...) or they will be renamed to HOST_GO_SRC_*. Correct me if I'm wrong but there is no way to predict the order of inclusion of '.mk' files, so package/go-src/go-src.mk might access to undefined variable.

This is why I think a next patch should propose the same structure for nodejs, rust, go using subdirectories:

package/

├─ go/
│  ├─ go-src/
│  ├─ go-bin/
│  ├─ go-bootstrap/
│  ├─ go.mk (<---- Contain the 'global' variable used by

pkg-golang.mk, go-src/go-src.mk, go-bin/go-bin.mk) │ ├─ Config.in

Where package/go/go.mk is a virtual package that include the go variants:

```
HOST_GO_TARGET_ENV = \
...

HOST_GO_HOST_ENV = \
...

$(eval $(host-virtual-package))

include $(sort $(wildcard package/go/*/*.mk))
```

This solution won't change pkg-golang.mk but since it introduce a new way to handle package variant I prefer to keep it for a next patch.

PERALE Thomas

Quoted 43 lines · Christian Stewart

Hi Yann,

Just to reply to that one question on why a host go compiler is useful-

Quoted 4 lines · Yann E. MORIN
Quoted 1 line

- host go compiler (see patch linked below)

If we have a pre-built host-go in the tree, thetre is then no reason to be able to use the host system go compiler, is there?

The host Go compiler may be compiled from source (i.e. Gentoo) and the user (me) wants to trust the gentoo binary for Go over downloading another precompiled bin from the internet.

Thomas -

Quoted 9 lines · Thomas Petazzoni

- NodeJS (proposed by me)

   virtual package:             host-nodejs
   pre-compiled package:        host-nodejs-bin
   from source package:         host-nodejs-src

The odd thing here being that host-nodejs is a virtual package, but nodejs is a regular package building NodeJS from source for the target.

Quoted 8 lines

- Go (proposed by Thomas Perale)

   virtual package:             host-goc
   pre-compiled package:        host-go-bin
   from source package:         host-go

So Thomas aligned on the naming used in the Rust world. I must say I do have a preference for the naming I have chosen for NodeJS, which IMO is clearer.

I agree that the following would be preferable:

virtual package:             host-go
pre-compiled package:        host-go-bin
from source package:         host-go-src
Quoted 6 lines

... although I would submit that all 3 could live in a single host-go package.

Best,
Christian Stewart

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#14 lore raw

Re: [Buildroot] [PATCH 1/4] package/goc: new virtual package

In reply to Yann E. MORIN
Quoted 6 lines · On Mon, 17 Oct 2022 19:55:00 +0200 "Yann E. MORIN" <[email protected]>…

In fact, we want to have a similar implementation for rust, go, nodejs, so (without looking at the details of this series), I guess Thomas Perale took the same approach as the existing rust situation, like Thomas Petazzoni did in the recent host-nodejs series:

    https://patchwork.ozlabs.org/project/buildroot/list/?series=319967

Yes and no, because Thomas Perale changed all packages using Go to use host-goc instead of host-go, while my series keeps host-nodejs but changes it from host-generic-package to host-virtual-package.

Also, I'd like to recap the naming we have:

- Rust (existing)
virtual package: host-rustc
pre-compiled package: host-rust-bin
from source package: host-rust

- NodeJS (proposed by me)

   virtual package:             host-nodejs
   pre-compiled package:        host-nodejs-bin
   from source package:         host-nodejs-src

The odd thing here being that host-nodejs is a virtual package, but nodejs is a regular package building NodeJS from source for the target.

- Go (proposed by Thomas Perale)
virtual package: host-goc
pre-compiled package: host-go-bin
from source package: host-go

So Thomas aligned on the naming used in the Rust world. I must say I do have a preference for the naming I have chosen for NodeJS, which IMO is clearer.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot