Skip to content
Merged
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
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,17 @@ ifeq ($(GOOS),darwin)
to_uname_m = $(foreach arch,$(1),$(shell echo $(arch) | sed 's/amd64/x86_64/'))
else ifeq ($(GOOS),linux)
# CC is required for cross-compiling on Linux.
CC = $(call to_uname_m,$(GOARCH))-linux-gnu-gcc
# On Debian, Ubuntu, and related distributions, compilers are named like x86_64-linux-gnu-gcc
# On Fedora, RHEL, and related distributions, the equivalent is x86_64-redhat-linux-gcc
# On openSUSE and as a generic fallback, gcc is used
Copy link
Member

Choose a reason for hiding this comment

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

nit: cc could be a better generic fallback

CC := $(shell \
if command -v $(call to_uname_m,$(GOARCH))-redhat-linux-gcc >/dev/null 2>&1; then \
echo $(call to_uname_m,$(GOARCH))-redhat-linux-gcc; \
elif command -v $(call to_uname_m,$(GOARCH))-linux-gnu-gcc >/dev/null 2>&1; then \
echo $(call to_uname_m,$(GOARCH))-linux-gnu-gcc; \
else \
echo gcc; \
fi)
else ifeq ($(GOOS),windows)
# artifact in zip format also provided for Windows.
ARTIFACT_FILE_EXTENSIONS += .zip
Expand Down
Loading