Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ endif
export TARGET_ARCH
export CGO_ENABLED = 0
export GOARCH = $(TARGET_ARCH)
export CC = $(ARCH_PREFIX)-linux-gnu-gcc
export OBJCOPY = $(ARCH_PREFIX)-linux-gnu-objcopy
export CC = $(shell command -v $(ARCH_PREFIX)-linux-gnu-gcc || command -v $(ARCH_PREFIX)-unknown-linux-gnu-gcc)
export OBJCOPY = $(shell command -v $(ARCH_PREFIX)-linux-gnu-objcopy || command -v $(ARCH_PREFIX)-unknown-linux-gnu-objcopy)
Comment on lines +32 to +33
Copy link
Member

@christos68k christos68k Oct 20, 2025

Choose a reason for hiding this comment

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

I think we don't use these when building the artifacts (as we dropped CGo), they're only used in tests where we explicitly enable CGo. In which case, shouldn't we just run the tests through the Docker image as well for reproducibility (and also avoiding adding environment-specific fallbacks)?

One issue with this implementation is that if no compiler is found, the errors read weird as CC is empty:

test.c -g -o with-debug-syms
make[1]: test.c: No such file or directory
make[1]: *** [Makefile:21: with-debug-syms] Error 127
make[1]: *** Waiting for unfinished jobs....
/bin/sh: 1: test.c: not found

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are also used when running make generate.

Copy link
Member

@christos68k christos68k Oct 20, 2025

Choose a reason for hiding this comment

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

They are also used when running make generate.

I missed this because make generate doesn't fail when the command -v invocations don't find a compiler (make test will however fail as shown in my previous comment):

$ (cd ./support; CC=$(command -v false) ./generate.sh)
$ (cd ./support; CC=$(command -v foo) ./generate.sh)
types_gen.go

strace is showing Go searching for and executing gcc when CC=. So essentially, there are multiple points of discussion here:

  1. We want make to fail when no compiler matching our criteria is found instead of introducing indeterminism.
  2. Rather than adding environment-specific fallbacks (Guix, Nix, ..), we should probably strive for a cleaner Makefile and strongly recommend people use our build container.


BRANCH = $(shell git rev-parse --abbrev-ref HEAD | tr -d '-' | tr '[:upper:]' '[:lower:]')
COMMIT_SHORT_SHA = $(shell git rev-parse --short=8 HEAD)
Expand Down