influxdata / pkg-config

PROTOTYPE: A pkg-config drop-in for compiling C libraries for InfluxData

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support static builds on ARM

danxmoran opened this issue · comments

We're testing a static build of InfluxDB OSS v2 on ARM, and seeing failures from pkg-config. One warning I saw in the build output was:

Unable to determine cargo target. Using the default.	{"target": "linux_arm64_static"}

This is because the logic for determining a cargo target includes cases for ARM, but only for non-static builds:

func (t Target) DetermineCargoTarget(logger *zap.Logger) string {
switch {
case t.OS == "linux" && t.Arch == "amd64" && t.Static:
return "x86_64-unknown-linux-musl"
case t.OS == "linux" && t.Arch == "amd64" && !t.Static:
return "x86_64-unknown-linux-gnu"
case t.OS == "linux" && t.Arch == "386" && !t.Static:
return "i686-unknown-linux-gnu"
case t.OS == "linux" && t.Arch == "arm" && t.Arm == "6" && !t.Static:
return "arm-unknown-linux-gnueabihf"
case t.OS == "linux" && t.Arch == "arm" && t.Arm == "7" && !t.Static:
return "armv7-unknown-linux-gnueabihf"
case t.OS == "linux" && t.Arch == "arm64" && !t.Static:
return "aarch64-unknown-linux-gnu"
case t.OS == "darwin" && t.Arch == "amd64":
return "x86_64-apple-darwin"
case t.OS == "windows" && t.Arch == "amd64":
return "x86_64-pc-windows-gnu"
default:
logger.Warn("Unable to determine cargo target. Using the default.", zap.String("target", t.String()))
return ""
}
}
.

We should add cases for static ARM builds. My best guesses for what those target should be are:

  • ARM64: aarch64-unknown-linux-musl
  • ARM 6: arm-unknown-linux-musleabihf
  • ARM 7: armv7-unknown-linux-musleabihf