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

Document how to reproduce our binaries #779

Open
bradfitz opened this issue Sep 23, 2020 · 4 comments
Open

Document how to reproduce our binaries #779

bradfitz opened this issue Sep 23, 2020 · 4 comments
Labels
L2 Few Likelihood P1 Nuisance Priority level T4 Docs Issue type

Comments

@bradfitz
Copy link
Member

(Forking off @Foxboron's request at #81 (comment) for instructions on how to reproduce our official Linux binaries)

$ cat ver.go
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build redo

package version

const LONG = "1.1.425-g3f107922c"
const SHORT = "1.1.425"
  • Go is run like:
redo  out/x86_64-linux/oss/cmd/tailscale/tailscale (resumed)
#!/bin/sh -e
# Per-platform settings for the go compiler.
# Auto-generated by go.od. Do not edit!
S='/home/bradfitz/src/tailscale.io'
export GO='/home/bradfitz/.cache/tailscale-go/bin/go'
export CC='cc'
export CFLAGS=''
export GO_LDFLAGS='-extldflags ""'
export GOOS=''
export GOARCH=''
export GOARM=''
export CGO_ENABLED='0'

# Necessary because CI forces GOROOT and we need
# to override it back.
export GOROOT=
redo    (../../../../../oss/version/all)                                                                                                                                            
redo    (../../../../../oss/version/version.h)
redo    oss/version/describe.txt
redo    oss/version/describe.txt (done)                                                                                                                                             

redo  out/x86_64-linux/oss/cmd/tailscale/tailscale (done)                                                                                                                           

....

        '$GO' build \\
            -v -trimpath -tags=redo,tailscale_go \\
            -ldflags "\$GO_LDFLAGS" \\
            -o "\$t" \\
            "\$pkg"

To close this issue we should:

  1. make sure this is reproducible
  2. document it somewhere
@danderson
Copy link
Member

Trying to reproduce our binaries now, and yeah, this is hard/impossible right now because of weirdnesses in our build system. Making this a tracking bug for the things I find.

@danderson
Copy link
Member

build_dist.sh should probably set CGO_ENABLED=0, to match our corp build system. This is a major source of diffoscope noise, since build_dist.sh ends up building a dynamically linked binary otherwise.

@danderson
Copy link
Member

CGO_ENABLED=0 ./build_dist.sh -trimpath -o ../tailscale_cli tailscale.com/cmd/tailscale is where I'm at right now. Diffoscope still shows mass diffs, seemingly caused by our go.mod replace clauses in the corp repo, which change the package's recorded name in the binaries even though the submodule is at the same revision as the OSS-only build. The different names also causes file offsets to get bumped, causing mass diffs everywhere else.

@DentonGentry
Copy link
Contributor

As of Tailscale 1.42, ./cmd/dist is used to build most platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L2 Few Likelihood P1 Nuisance Priority level T4 Docs Issue type
Projects
None yet
Development

No branches or pull requests

3 participants