xaptum / xaptum-buildroot

External Buildroot tree for Xaptum hardware
GNU General Public License v2.0
0 stars 0 forks source link

Seperate Go support conditionals #40

Closed dberliner closed 5 years ago

dberliner commented 5 years ago

Referencing the changes in https://patchwork.ozlabs.org/patch/962489/

Currently Go support uses a single variable to deice host and target support. We need to separate the functionality to provide individual variables for both cases.

drbild commented 5 years ago

Here’s what I think is happening, based on the two documents I’ll link below.

When building the Go toolchain (i.e., running main.bash):

When building a program using that toolchain (i.e., running go build ...):

So for buildroot, this means:

The latter two are what Mirza’s patch does (https://patchwork.ozlabs.org/patch/962489/), which definitely works.

So the only cleanup that should be necessary is

Sources:

dberliner commented 5 years ago

This looks about right. When I remove the GOARCH variable the output is

Building packages and commands for linux/amd64.
---
Installed Go for linux/amd64 in /home/vagrant/xaptum-buildroot/tpmbuild/gotest2/build/host-go-1.10.2
Installed commands in /home/vagrant/xaptum-buildroot/tpmbuild/gotest2/build/host-go-1.10.2/bin

With the variables in

Building packages and commands for host, linux/amd64.
Building packages and commands for target, linux/arm.
---
Installed Go for linux/arm in /home/vagrant/xaptum-buildroot/tpmbuild/gotest2/build/host-go-1.10.2
Installed commands in /home/vagrant/xaptum-buildroot/tpmbuild/gotest2/build/host-go-1.10.2/bin

Knowing this I should be able to move forward tomorrow.

drbild commented 5 years ago

Nice!! That does seem to confirm it.

dberliner commented 5 years ago

Something didn't quite sit right so I kept digging and I figured out why that guy on stackoverflow kept insisting those variables were for the toolchain target. Go is written in Go so it needs to bootstrap and has 3 stages. If we are going to get a compiler for a foreign architecture we need to have one in the host first, the executable I was looking at (bin/go) was an intermediate step for bin/linux_arm/go which looks like a go compiler for the target architecture.

drbild commented 5 years ago

Fixed by #54