Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: release job issue #145

Merged
merged 6 commits into from
Nov 2, 2023
Merged

fix: release job issue #145

merged 6 commits into from
Nov 2, 2023

Conversation

leovct
Copy link
Member

@leovct leovct commented Nov 2, 2023

Description

  • Remove darwin builds because they caused the issue and were not used.
  • Add dynamic linking to remove warnings when cross compiling.
  • Add version flags to dev builds.

Jira / Linear Tickets

Testing

Before

$ make cross
mkdir -p ./out
echo "Building linux-arm64-polycli..."
Building linux-arm64-polycli...
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build \
		-ldflags "-X github.com/maticnetwork/polygon-cli/cmd/version.Version=v0.1.35-3-g4b91df1 -X github.com/maticnetwork/polygon-cli/cmd/version.Commit=4b91df14 -X github.com/maticnetwork/polygon-cli/cmd/version.Date=1698940046 -X github.com/maticnetwork/polygon-cli/cmd/version.BuiltBy=makefile -s -w -extldflags=-static" \
		-tags netgo \
		-o ./out/linux-arm64-polycli \
		main.go
# command-line-arguments
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /tmp/go-link-1773102642/000064.o: in function `mygetgrouplist':
/_/GOROOT/src/os/user/getgrouplist_unix.go:15: warning: Using 'getgrouplist' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /tmp/go-link-1773102642/000063.o: in function `mygetgrgid_r':
/_/GOROOT/src/os/user/cgo_lookup_cgo.go:45: warning: Using 'getgrgid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /tmp/go-link-1773102642/000063.o: in function `mygetgrnam_r':
/_/GOROOT/src/os/user/cgo_lookup_cgo.go:54: warning: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /tmp/go-link-1773102642/000063.o: in function `mygetpwnam_r':
/_/GOROOT/src/os/user/cgo_lookup_cgo.go:36: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /tmp/go-link-1773102642/000063.o: in function `mygetpwuid_r':
/_/GOROOT/src/os/user/cgo_lookup_cgo.go:27: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
echo "Building linux-amd64-polycli..."
Building linux-amd64-polycli...
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \
		-ldflags "-X github.com/maticnetwork/polygon-cli/cmd/version.Version=v0.1.35-3-g4b91df1 -X github.com/maticnetwork/polygon-cli/cmd/version.Commit=4b91df14 -X github.com/maticnetwork/polygon-cli/cmd/version.Date=1698940046 -X github.com/maticnetwork/polygon-cli/cmd/version.BuiltBy=makefile -s -w -extldflags=-static" \
		-tags netgo \
		-o ./out/linux-amd64-polycli \
		main.go
# command-line-arguments
/usr/bin/ld: /tmp/go-link-389677798/000064.o: in function `mygetgrouplist':
/_/GOROOT/src/os/user/getgrouplist_unix.go:15: warning: Using 'getgrouplist' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /tmp/go-link-389677798/000063.o: in function `mygetgrgid_r':
/_/GOROOT/src/os/user/cgo_lookup_cgo.go:45: warning: Using 'getgrgid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /tmp/go-link-389677798/000063.o: in function `mygetgrnam_r':
/_/GOROOT/src/os/user/cgo_lookup_cgo.go:54: warning: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /tmp/go-link-389677798/000063.o: in function `mygetpwnam_r':
/_/GOROOT/src/os/user/cgo_lookup_cgo.go:36: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /tmp/go-link-389677798/000063.o: in function `mygetpwuid_r':
/_/GOROOT/src/os/user/cgo_lookup_cgo.go:27: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

After

$ make cross
mkdir -p ./out
echo "Building linux-arm64-polycli..."
Building linux-arm64-polycli...
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build \
		-ldflags "-X github.com/maticnetwork/polygon-cli/cmd/version.Version=v0.1.35-4-g0debfd7 -X github.com/maticnetwork/polygon-cli/cmd/version.Commit=0debfd70 -X github.com/maticnetwork/polygon-cli/cmd/version.Date=1698940109 -X github.com/maticnetwork/polygon-cli/cmd/version.BuiltBy=makefile -s -w -linkmode external -extldflags "-static-libgo"" \
		-tags netgo \
		-o ./out/linux-arm64-polycli \
		main.go
echo "Building linux-amd64-polycli..."
Building linux-amd64-polycli...
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \
		-ldflags "-X github.com/maticnetwork/polygon-cli/cmd/version.Version=v0.1.35-4-g0debfd7 -X github.com/maticnetwork/polygon-cli/cmd/version.Commit=0debfd70 -X github.com/maticnetwork/polygon-cli/cmd/version.Date=1698940109 -X github.com/maticnetwork/polygon-cli/cmd/version.BuiltBy=makefile -s -w -linkmode external -extldflags "-static-libgo"" \
		-tags netgo \
		-o ./out/linux-amd64-polycli \
		main.go

@leovct leovct requested review from praetoriansentry and a team November 2, 2023 15:58
Copy link
Contributor

@rebelArtists rebelArtists left a comment

Choose a reason for hiding this comment

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

nice cleanups!

@leovct leovct merged commit 7ca79c0 into main Nov 2, 2023
@leovct leovct deleted the fix/release-job branch November 2, 2023 21:14
This was referenced Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants