Skip to content

Commit

Permalink
Merge pull request #1779 from rqlite/log-compiler
Browse files Browse the repository at this point in the history
Log compiler
  • Loading branch information
otoolep committed May 10, 2024
2 parents 84db47a + 463fd00 commit c411e93
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build.sh
Expand Up @@ -38,7 +38,6 @@ buildtime=`date +%Y-%m-%dT%T%z`
# Prepare linker flags
STRIP_SYMBOLS="-w -s"
LINKER_PKG_PATH=github.com/rqlite/rqlite/v8/cmd
LDFLAGS="$STATIC $STRIP_SYMBOLS -X $LINKER_PKG_PATH.Version=$VERSION -X $LINKER_PKG_PATH.Branch=$branch -X $LINKER_PKG_PATH.Commit=$commit -X $LINKER_PKG_PATH.Buildtime=$buildtime"

declare -A archs
archs=(
Expand All @@ -59,7 +58,14 @@ for arch in "${!archs[@]}"; do
for compiler in $compilers; do
echo "Building for $arch using $compiler..."

CGO_ENABLED=1 GOARCH=$arch CC=$compiler go install -a -tags sqlite_omit_load_extension -ldflags="$LDFLAGS" ./...
LDFLAGS="$STRIP_SYMBOLS -X $LINKER_PKG_PATH.CompilerCommand=$compiler -X $LINKER_PKG_PATH.Version=$VERSION -X $LINKER_PKG_PATH.Branch=$branch -X $LINKER_PKG_PATH.Commit=$commit -X $LINKER_PKG_PATH.Buildtime=$buildtime"
# Statically link for amd64, since we can.
if [ "$arch" == "amd64" ]; then
STATIC="-extldflags=-static"
else
STATIC=""
fi
CGO_ENABLED=1 GOARCH=$arch CC=$compiler go install -a -tags sqlite_omit_load_extension -ldflags="$LDFLAGS $STATIC" ./...

# Special case for musl-gcc, keep legacy naming.
if [ "$compiler" == "musl-gcc" ]; then
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,9 @@
## 8.24.6 (May 10th 2024)
Reinstates static linking for amd64 builds on Linux during the official release process.

### Implementation changes and bug fixes
- [PR #1779](https://github.com/rqlite/rqlite/pull/1779): Log more information about compilation.

## 8.24.5 (May 10th 2024)
There are no changes in this release relative to 8.24.2. However this release remove static linking for all architecture types, since it can be problematic in the long run.

Expand Down
15 changes: 8 additions & 7 deletions cmd/rqlited/main.go
Expand Up @@ -72,8 +72,8 @@ func main() {
fmt.Print(logo)

// Configure logging and pump out initial message.
log.Printf("%s starting, version %s, SQLite %s, commit %s, branch %s, compiler %s", name, cmd.Version,
db.DBVersion, cmd.Commit, cmd.Branch, runtime.Compiler)
log.Printf("%s starting, version %s, SQLite %s, commit %s, branch %s, compiler (toolchain) %s, compiler (command) %s",
name, cmd.Version, db.DBVersion, cmd.Commit, cmd.Branch, runtime.Compiler, cmd.CompilerCommand)
log.Printf("%s, target architecture is %s, operating system target is %s", runtime.Version(),
runtime.GOARCH, runtime.GOOS)
log.Printf("launch command: %s", strings.Join(os.Args, " "))
Expand Down Expand Up @@ -346,11 +346,12 @@ func startHTTPService(cfg *Config, str *store.Store, cltr *cluster.Client, credS
s.DefaultQueueTimeout = cfg.WriteQueueTimeout
s.DefaultQueueTx = cfg.WriteQueueTx
s.BuildInfo = map[string]interface{}{
"commit": cmd.Commit,
"branch": cmd.Branch,
"version": cmd.Version,
"compiler": runtime.Compiler,
"build_time": cmd.Buildtime,
"commit": cmd.Commit,
"branch": cmd.Branch,
"version": cmd.Version,
"compiler_toolchain": runtime.Compiler,
"compiler_command": cmd.CompilerCommand,
"build_time": cmd.Buildtime,
}
s.SetAllowOrigin(cfg.HTTPAllowOrigin)
return s, s.Start()
Expand Down
3 changes: 3 additions & 0 deletions cmd/version.go
Expand Up @@ -14,4 +14,7 @@ var (

// Buildtime is the timestamp when the build took place.
Buildtime = "unknown"

// CompilerCommand is the compiler used to build the binary.
CompilerCommand = "unknown"
)

0 comments on commit c411e93

Please sign in to comment.