Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: improve cross compilation setup #22804

Merged
merged 8 commits into from
May 4, 2021
Merged

Conversation

fjl
Copy link
Contributor

@fjl fjl commented May 3, 2021

This PR cleans up the CI build system and fixes a couple of issues.

  • The go tool launcher code has been moved to internal/build. With the new
    toolchain functions, the environment of the host Go (i.e. the one that built
    ci.go) and the target Go (i.e. the toolchain downloaded by -dlgo) are isolated
    more strictly. This is important to make cross compilation and -dlgo work
    correctly in more cases.
  • The -dlgo option now skips the download and uses the host Go if the running Go
    version matches dlgoVersion exactly.
  • The 'test' command now supports -dlgo, -cc and -arch. Running unit tests with
    foreign GOARCH is occasionally useful. For example, it can be used to run
    32-bit tests on Windows. It can also be used to run darwin/amd64 tests on
    darwin/arm64 using Rosetta 2.
  • The 'aar', 'xcode' and 'xgo' commands now use a slightly different method to
    install external tools. They previously used go get, but this comes with the
    annoying side effect of modifying go.mod. They now use go install instead,
    which is the recommended way of installing tools without modifying the local
    module.
  • The old build warning about outdated Go version has been removed because we're
    much better at keeping backwards compatibility now.

fjl added 8 commits May 3, 2021 12:06
This avoids slowing down the local builds on darwin/arm64.
This is an improved version of the cross-compiler setup code and Go
binary download from build/ci.go.
This fixes a couple of issues in the ci.go script:

- The cross-compiler setup is now handled by internal/build.GoToolchain.
- The 'test' command now supports -dlgo, -cc, and -arch. Running unit tests
  with foreign GOARCH is occasionally useful. For example, it can be
  used to run 32-bit tests on Windows.
- The 'aar', 'xcode' and 'xgo' commands now use a slightly different
  method to install external tools. They previously used 'go get', but
  this comes with the annoying side effect of modifying go.mod. We now
  use 'go install' instead, which is the recommended way of installing
  tools without modifying the local module.
Also remove note about nodejs because it is no longer needed.
We used nodejs to compile the dashboard frontend, but the dashboard
code was deleted a long time ago.
Copy link
Member

@karalabe karalabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My approval is on the PR.

@fjl fjl merged commit effaf18 into ethereum:master May 4, 2021
@fjl fjl added this to the 1.10.3 milestone May 4, 2021
fjl added a commit that referenced this pull request May 4, 2021
This fixes a regression introduced in #22804.
atif-konasl pushed a commit to frozeman/pandora-execution-engine that referenced this pull request Oct 15, 2021
This PR cleans up the CI build system and fixes a couple of issues.

- The go tool launcher code has been moved to internal/build. With the new
  toolchain functions, the environment of the host Go (i.e. the one that built
  ci.go) and the target Go (i.e. the toolchain downloaded by -dlgo) are isolated
  more strictly. This is important to make cross compilation and -dlgo work
  correctly in more cases.
- The -dlgo option now skips the download and uses the host Go if the running Go
  version matches dlgoVersion exactly.
- The 'test' command now supports -dlgo, -cc and -arch. Running unit tests with
  foreign GOARCH is occasionally useful. For example, it can be used to run
  32-bit tests on Windows. It can also be used to run darwin/amd64 tests on
  darwin/arm64 using Rosetta 2.
- The 'aar', 'xcode' and 'xgo' commands now use a slightly different method to
  install external tools. They previously used `go get`, but this comes with the
  annoying side effect of modifying go.mod. They now use `go install` instead,
  which is the recommended way of installing tools without modifying the local
  module.
- The old build warning about outdated Go version has been removed because we're
  much better at keeping backwards compatibility now.
atif-konasl pushed a commit to frozeman/pandora-execution-engine that referenced this pull request Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants