cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.84k stars 3.77k forks source link

bazel: build rules mistakenly depend on system-wide GNU make and do not honor `$MAKE` #74209

Open knz opened 2 years ago

knz commented 2 years ago

Describe the problem

The build rules for jemalloc require GNU make. However:

The result is this:

+ make -C /data/home/kena/.cache/bazel/_bazel_kena/9b9f53b7334495d6a871cbb472c466bb/sandbox/processwrapper-sandbox/596/execroot/cockroach/bazel-out/freebsd-fastbuild/bin/c-deps/libjemalloc.build_tmpdir build_lib_static
make: "/data/home/kena/.cache/bazel/_bazel_kena/9b9f53b7334495d6a871cbb472c466bb/sandbox/processwrapper-sandbox/596/execroot/cockroach/bazel-out/freebsd-fastbuild/bin/c-deps/libjemalloc.build_tmpdir/Makefile" line 3: Invalid line type
make: "/data/home/kena/.cache/bazel/_bazel_kena/9b9f53b7334495d6a871cbb472c466bb/sandbox/processwrapper-sandbox/596/execroot/cockroach/bazel-out/freebsd-fastbuild/bin/c-deps/libjemalloc.build_tmpdir/Makefile" line 4: Invalid line type
make: "/data/home/kena/.cache/bazel/_bazel_kena/9b9f53b7334495d6a871cbb472c466bb/sandbox/processwrapper-sandbox/596/execroot/cockroach/bazel-out/freebsd-fastbuild/bin/c-deps/libjemalloc.build_tmpdir/Makefile" line 72: Invalid line type
make: "/data/home/kena/.cache/bazel/_bazel_kena/9b9f53b7334495d6a871cbb472c466bb/sandbox/processwrapper-sandbox/596/execroot/cockroach/bazel-out/freebsd-fastbuild/bin/c-deps/libjemalloc.build_tmpdir/Makefile" line 74: Invalid line type
make: "/data/home/kena/.cache/bazel/_bazel_kena/9b9f53b7334495d6a871cbb472c466bb/sandbox/processwrapper-sandbox/596/execroot/cockroach/bazel-out/freebsd-fastbuild/bin/c-deps/libjemalloc.build_tmpdir/Makefile" line 75: Invalid line type
make: "/data/home/kena/.cache/bazel/_bazel_kena/9b9f53b7334495d6a871cbb472c466bb/sandbox/processwrapper-sandbox/596/execroot/cockroach/bazel-out/freebsd-fastbuild/bin/c-deps/libjemalloc.build_tmpdir/Makefile" line 77: Invalid line type
make: "/data/home/kena/.cache/bazel/_bazel_kena/9b9f53b7334495d6a871cbb472c466bb/sandbox/processwrapper-sandbox/596/execroot/cockroach/bazel-out/freebsd-fastbuild/bin/c-deps/libjemalloc.build_tmpdir/Makefile" line 79: Invalid line type
[...]
make: Fatal errors encountered -- cannot continue
make: stopped in /data/home/kena/.cache/bazel/_bazel_kena/9b9f53b7334495d6a871cbb472c466bb/sandbox/processwrapper-sandbox/596/execroot/cockroach/bazel-out/freebsd-fastbuild/bin/c-deps/libjemalloc.build_tmpdir
_____ END BUILD LOGS _____
rules_foreign_cc: Build wrapper script location: bazel-out/freebsd-fastbuild/bin/c-deps/libjemalloc_foreign_cc/wrapper_build_script.sh
rules_foreign_cc: Build script location: bazel-out/freebsd-fastbuild/bin/c-deps/libjemalloc_foreign_cc/build_script.sh
rules_foreign_cc: Build log location: bazel-out/freebsd-fastbuild/bin/c-deps/libjemalloc_foreign_cc/Configure.log

Target //pkg/cmd/cockroach-short:cockroach-short failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 22.642s, Critical Path: 20.47s
INFO: 1225 processes: 54 internal, 1171 processwrapper-sandbox.
FAILED: Build did NOT complete successfully

To Reproduce

Have a non-GNU make called make, then run dev build.

Expected behavior

The thing works, either:

Epic CRDB-17171 Jira issue: CRDB-11972

knz commented 2 years ago

edit: this doesn't work

~I was able to work around by:~

this is a bit too quirky and I'd like a better solution

knz commented 2 years ago

NB: this issue does not exist with make build (started as gmake build) because GNU make ensures that the path to the make executable is properly inherited into sub-makefiles.

knz commented 2 years ago

ok so the workaround above doesn't work unfortunately

knz commented 2 years ago

ok, I hve retried tis week, and soemthing is different with build_cc because now the symlink problem disappears again (i.e. I can use a symlink)

So I have a workaround, and the priority of this is lowered.

github-actions[bot] commented 4 months ago

We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!