Building influxdb from a release source tarballs

I’m trying to build influxdb 2.0.2 from a release tarball (https://github.com/influxdata/influxdb/archive/v2.0.2.tar.gz), with these commands:

  export GO111MODULE=on
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  make

but it fails complaining that there’s no git repository. is compiling from a source tarball supported?

==> Starting build()...
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Makefile:89: warning: overriding recipe for target 'bin/linux/influx'
Makefile:86: warning: ignoring old recipe for target 'bin/linux/influx'
make -C http all
make[1]: Entering directory '/tmp/x/src/influxdb-2.0.2/http'
go generate -x
go: downloading github.com/influxdata/flux v0.95.0
# get https://proxy.golang.org/github.com/influxdata/flux/@v/v0.95.0.zip
# get https://proxy.golang.org/github.com/influxdata/flux/@v/v0.95.0.zip: 200 OK (0.647s)
env GO111MODULE=on go run github.com/kevinburke/go-bindata/go-bindata -o swagger_gen.go -tags assets -nocompress -pkg http ./swagger.yml
make[1]: Leaving directory '/tmp/x/src/influxdb-2.0.2/http'
make -C ui all
make[1]: Entering directory '/tmp/x/src/influxdb-2.0.2/ui'
yarn install
yarn install v1.22.10
warning You don't appear to have an internet connection. Try the --offline flag to use the cache for registry queries.
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
warning monaco-languageclient@0.11.0: The engine "vscode" appears to be invalid.
warning vscode-languageclient@5.3.0-next.9: The engine "vscode" appears to be invalid.
info fsevents@1.2.12: The platform "linux" is incompatible with this module.
info "fsevents@1.2.12" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.0.7: The platform "linux" is incompatible with this module.
info "fsevents@2.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > connected-react-router@6.8.0" has unmet peer dependency "react-router@^4.3.1 || ^5.0.0".
warning Workspaces can only be enabled in private projects.
[5/5] Building fresh packages...
Done in 14.41s.
yarn build
yarn run v1.22.10
warning You don't appear to have an internet connection. Try the --offline flag to use the cache for registry queries.
$ yarn install --silent && yarn build:ci
warning You don't appear to have an internet connection. Try the --offline flag to use the cache for registry queries.
warning You don't appear to have an internet connection. Try the --offline flag to use the cache for registry queries.
$ yarn generate && yarn build:vendor && webpack --config webpack.prod.ts --bail
warning You don't appear to have an internet connection. Try the --offline flag to use the cache for registry queries.
$ oats ../http/swagger.yml > ./src/client/generatedRoutes.ts
warning You don't appear to have an internet connection. Try the --offline flag to use the cache for registry queries.
$ webpack --config webpack.vendor.ts
Hash: 2a8b5684d35004117057
Time: 4198ms
Built at: 19/11/2020 20:42:59
           Asset      Size  Chunks                    Chunk Names
vendor.bundle.js  15.2 MiB  vendor  [emitted]  [big]  vendor
     1.bundle.js  1.57 MiB       1  [emitted]  [big]  
     2.bundle.js   921 KiB       2  [emitted]  [big]  
  json.worker.js   898 KiB          [emitted]  [big]  
editor.worker.js   472 KiB          [emitted]  [big]  
     3.bundle.js   464 KiB       3  [emitted]  [big]  
     4.bundle.js  63.7 KiB       4  [emitted]         
    55.bundle.js  33.7 KiB      55  [emitted]         
    38.bundle.js  30.5 KiB      38  [emitted]         
    35.bundle.js  25.4 KiB      35  [emitted]         
    53.bundle.js  23.2 KiB      53  [emitted]         
    30.bundle.js  21.4 KiB      30  [emitted]         
    37.bundle.js  21.1 KiB      37  [emitted]         
    11.bundle.js  20.2 KiB      11  [emitted]         
    47.bundle.js  19.5 KiB      47  [emitted]         
    34.bundle.js  18.1 KiB      34  [emitted]         
    45.bundle.js  17.7 KiB      45  [emitted]         
    43.bundle.js  14.4 KiB      43  [emitted]         
    36.bundle.js  13.9 KiB      36  [emitted]         
     5.bundle.js  13.2 KiB       5  [emitted]         
    59.bundle.js  12.5 KiB      59  [emitted]         
    56.bundle.js  12.2 KiB      56  [emitted]         
    51.bundle.js  11.4 KiB      51  [emitted]         
    20.bundle.js  10.8 KiB      20  [emitted]         
     0.bundle.js  10.8 KiB       0  [emitted]         
    40.bundle.js  10.5 KiB      40  [emitted]         
    60.bundle.js  9.86 KiB      60  [emitted]         
    61.bundle.js  9.66 KiB      61  [emitted]         
     7.bundle.js  9.27 KiB       7  [emitted]         
    13.bundle.js  8.88 KiB      13  [emitted]         
    27.bundle.js   8.8 KiB      27  [emitted]         
    21.bundle.js  8.66 KiB      21  [emitted]         
    29.bundle.js  8.42 KiB      29  [emitted]         
    15.bundle.js  8.23 KiB      15  [emitted]         
    63.bundle.js  7.95 KiB      63  [emitted]         
    12.bundle.js  7.85 KiB      12  [emitted]         
    39.bundle.js  7.79 KiB      39  [emitted]         
     6.bundle.js  7.76 KiB       6  [emitted]         
    41.bundle.js  7.75 KiB      41  [emitted]         
    46.bundle.js  7.54 KiB      46  [emitted]         
    48.bundle.js   7.5 KiB      48  [emitted]         
    57.bundle.js  7.49 KiB      57  [emitted]         
    25.bundle.js  7.19 KiB      25  [emitted]         
    42.bundle.js  7.12 KiB      42  [emitted]         
    24.bundle.js  7.11 KiB      24  [emitted]         
    44.bundle.js  6.92 KiB      44  [emitted]         
    52.bundle.js  6.91 KiB      52  [emitted]         
    58.bundle.js  6.77 KiB      58  [emitted]         
    18.bundle.js  6.71 KiB      18  [emitted]         
    23.bundle.js  6.64 KiB      23  [emitted]         
    17.bundle.js  6.44 KiB      17  [emitted]         
    54.bundle.js  6.41 KiB      54  [emitted]         
    32.bundle.js  6.37 KiB      32  [emitted]         
    28.bundle.js  6.15 KiB      28  [emitted]         
    31.bundle.js  6.04 KiB      31  [emitted]         
    19.bundle.js  5.94 KiB      19  [emitted]         
    26.bundle.js  5.25 KiB      26  [emitted]         
    10.bundle.js  5.07 KiB      10  [emitted]         
    33.bundle.js  5.05 KiB      33  [emitted]         
    16.bundle.js  4.96 KiB      16  [emitted]         
    49.bundle.js  4.59 KiB      49  [emitted]         
     9.bundle.js  4.55 KiB       9  [emitted]         
    50.bundle.js  4.35 KiB      50  [emitted]         
    62.bundle.js  4.35 KiB      62  [emitted]         
    22.bundle.js   3.3 KiB      22  [emitted]         
    14.bundle.js  3.27 KiB      14  [emitted]         
     8.bundle.js   2.9 KiB       8  [emitted]         
 + 1 hidden asset
Entrypoint vendor [big] = vendor.bundle.js
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Error: Command failed: git rev-parse HEAD
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

    at checkExecSyncError (node:child_process:636:11)
    at Object.execSync (node:child_process:672:15)
    at /tmp/x/src/influxdb-2.0.2/ui/src/utils/env.ts:5:8
    at Object.<anonymous> (/tmp/x/src/influxdb-2.0.2/ui/src/utils/env.ts:62:3)
    at Module._compile (/tmp/x/src/influxdb-2.0.2/ui/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Module.m._compile (/tmp/x/src/influxdb-2.0.2/ui/node_modules/ts-node/src/index.ts:473:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Object.require.extensions.<computed> [as .ts] (/tmp/x/src/influxdb-2.0.2/ui/node_modules/ts-node/src/index.ts:476:12)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Module.require (node:internal/modules/cjs/loader:991:19)
    at require (/tmp/x/src/influxdb-2.0.2/ui/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/tmp/x/src/influxdb-2.0.2/ui/webpack.common.ts:13:5)
    at Module._compile (/tmp/x/src/influxdb-2.0.2/ui/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Module.m._compile (/tmp/x/src/influxdb-2.0.2/ui/node_modules/ts-node/src/index.ts:473:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Object.require.extensions.<computed> [as .ts] (/tmp/x/src/influxdb-2.0.2/ui/node_modules/ts-node/src/index.ts:476:12)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Module.require (node:internal/modules/cjs/loader:991:19)
    at require (/tmp/x/src/influxdb-2.0.2/ui/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/tmp/x/src/influxdb-2.0.2/ui/webpack.prod.ts:4:16)
    at Module._compile (/tmp/x/src/influxdb-2.0.2/ui/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Module.m._compile (/tmp/x/src/influxdb-2.0.2/ui/node_modules/ts-node/src/index.ts:473:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Object.require.extensions.<computed> [as .ts] (/tmp/x/src/influxdb-2.0.2/ui/node_modules/ts-node/src/index.ts:476:12)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Module.require (node:internal/modules/cjs/loader:991:19)
    at require (/tmp/x/src/influxdb-2.0.2/ui/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
make[1]: *** [Makefile:16: build] Error 1
make[1]: Leaving directory '/tmp/x/src/influxdb-2.0.2/ui'
make: *** [Makefile:80: ui] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

Hi @gdamjan, the influxdb Makefile uses git to set main.version and main.commit in the -ldflags argument to go. To build from the tarball, I think you’ll need to edit the Makefile to replace those calls with hard-coded values.

typically a release tarball shouldn’t depend on git. maybe there should be a fallback?

btw, the above error is from yarn, not Go

ok, make INFLUXDB_SHA=fake-sha works for that one

1 Like