diff --git a/Makefile b/Makefile index d1588420fc..c1af379fcb 100644 --- a/Makefile +++ b/Makefile @@ -106,6 +106,9 @@ $(BUILD_DIR)/macos-arm64/crc: $(SOURCES) $(BUILD_DIR)/linux-amd64/crc: $(SOURCES) GOOS=linux GOARCH=amd64 go build -tags "$(BUILDTAGS)" -ldflags="$(LDFLAGS)" -o $@ $(GO_EXTRA_BUILDFLAGS) ./cmd/crc +$(BUILD_DIR)/linux-arm64/crc: $(SOURCES) + GOOS=linux GOARCH=arm64 go build -tags "$(BUILDTAGS)" -ldflags="$(LDFLAGS)" -o $@ $(GO_EXTRA_BUILDFLAGS) ./cmd/crc + $(BUILD_DIR)/windows-amd64/crc.exe: $(SOURCES) GOARCH=amd64 GOOS=windows go build -tags "$(BUILDTAGS)" -ldflags="$(LDFLAGS)" -o $@ $(GO_EXTRA_BUILDFLAGS) ./cmd/crc diff --git a/packaging/rpm/crc.spec.in b/packaging/rpm/crc.spec.in index ed0f80387b..9fbbce248a 100644 --- a/packaging/rpm/crc.spec.in +++ b/packaging/rpm/crc.spec.in @@ -19,6 +19,12 @@ CRC's main executable} %global golicenses LICENSE %global godocs *.md +%ifarch x86_64 +%global gohostarch amd64 +%endif +%ifarch aarch64 +%global gohostarch arm64 +%endif Name: %{goname} Release: 1%{?dist} @@ -65,7 +71,7 @@ make COMMIT_SHA=__COMMIT_SHA__ GO_EXTRA_LDFLAGS="-B 0x$(head -c20 /dev/urandom|o %install # with fedora macros: gopkginstall install -m 0755 -vd %{buildroot}%{_bindir} -install -m 0755 -vp %{gobuilddir}/src/%{goipath}/out/linux-amd64/crc %{buildroot}%{_bindir}/ +install -m 0755 -vp %{gobuilddir}/src/%{goipath}/out/linux-%{gohostarch}/crc %{buildroot}%{_bindir}/ install -d %{buildroot}%{_datadir}/%{name}-redistributable/{linux,macos,windows} install -m 0755 -vp %{gobuilddir}/src/%{goipath}/release/* %{buildroot}%{_datadir}/%{name}-redistributable/linux/ diff --git a/pkg/crc/preflight/preflight_checks_unix.go b/pkg/crc/preflight/preflight_checks_unix.go index 254681989e..9498a9efc0 100644 --- a/pkg/crc/preflight/preflight_checks_unix.go +++ b/pkg/crc/preflight/preflight_checks_unix.go @@ -139,9 +139,18 @@ func fixAdminHelperExecutableCached() error { func checkSupportedCPUArch() error { logging.Debugf("GOARCH is %s GOOS is %s", runtime.GOARCH, runtime.GOOS) - // Only supported arches are amd64, and arm64 on macOS - if runtime.GOARCH == "amd64" || (runtime.GOARCH == "arm64" && runtime.GOOS == "darwin") { + // Only supported arches are amd64, and arm64 on macOS & Linux + switch runtime.GOARCH { + case "amd64": return nil + case "arm64": + if runtime.GOOS == "darwin" { + return nil + } + if runtime.GOOS == "linux" { + logging.Warnf("CRC is not officially supported on ARM64 CPUs for Linux.") + return nil + } } return fmt.Errorf("CRC can only run on AMD64/Intel64 CPUs and Apple silicon") }