[go-nuts] Re: Go 1.22 binary size improvements?

2024-02-09 Thread 'Brian Candler' via golang-nuts
Sorry you're right, it's "otool -L" for macOS. And you say that if you cross-compile from Linux with 1.22.0 to build a macOS binary, you get a size approx 93.8MB as well? Very odd. On Friday 9 February 2024 at 14:43:35 UTC cpu...@gmail.com wrote: > Yes, CGO is disabled. ldd doesn't seem to

[go-nuts] Re: Go 1.22 binary size improvements?

2024-02-09 Thread cpu...@gmail.com
Yes, CGO is disabled. ldd doesn't seem to exist on MacOS: make build && ls -la ./evcc && otool -L ./evcc 1.21.7 CGO_ENABLED=0 go build -v -tags=release -trimpath -ldflags='-X github.com/evcc-io/evcc/server.Version=0.124.1 -X github.com/evcc-io/evcc/server.Commit=596071b42 -s -w' -rwxr-xr-x 1

[go-nuts] Re: Go 1.22 binary size improvements?

2024-02-09 Thread 'Brian Candler' via golang-nuts
Have you at any point set CGO_ENABLED=0 ? What does "ldd /path/to/binary" show on both the old (larger) and new (smaller) binaries? Maybe one is dynamically linked and the other statically linked? -- You received this message because you are subscribed to the Google Groups "golang-nuts"

[go-nuts] Re: Go 1.22 binary size improvements?

2024-02-09 Thread cpu...@gmail.com
Just gave it another try cross-compiling to Arm on Linux. This time binary size stays the same. Sorry if my excitement was too premature. On Friday, February 9, 2024 at 2:11:25 PM UTC+1 cpu...@gmail.com wrote: > It's really surprising (positively). Compiling with -ldflags='-s -w' if > anyone

[go-nuts] Re: Go 1.22 binary size improvements?

2024-02-09 Thread cpu...@gmail.com
It's really surprising (positively). Compiling with -ldflags='-s -w' if anyone wants to try this. On Friday, February 9, 2024 at 1:23:20 PM UTC+1 qiulaidongfeng wrote: > Quick search to find go1.22 as follows CL like > https://go-review.googlesource.com/c/go/+/521615 reduces binary size.

[go-nuts] Re: Go 1.22 binary size improvements?

2024-02-09 Thread 'qiulaidongfeng' via golang-nuts
Quick search to find go1.22 as follows CL like https://go-review.googlesource.com/c/go/+/521615 reduces binary size. However, from 93MB to 81MB, I think it is most likely the result of the joint efforts of many CLs. On Friday, February 9, 2024 at 7:46:48 PM UTC+8 cpu...@gmail.com wrote: