From 452c1fbfd471f275d83f030a1e1134f509ce428f Mon Sep 17 00:00:00 2001 From: xushiwei Date: Sun, 16 Jun 2024 00:31:25 +0800 Subject: [PATCH] build: use -dead_strip to reduce app size --- internal/build/build.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/build/build.go b/internal/build/build.go index f283130a..c8744e42 100644 --- a/internal/build/build.go +++ b/internal/build/build.go @@ -286,11 +286,14 @@ func linkMainPkg(pkg *packages.Package, pkgs []*aPackage, runtimeFiles []string, if app == "" { app = filepath.Join(conf.BinPath, name+conf.AppExt) } - const N = 3 + const N = 5 args := make([]string, N, len(pkg.Imports)+len(runtimeFiles)+(N+1)) args[0] = "-o" args[1] = app args[2] = "-Wno-override-module" + args[3] = "-Xlinker" + args[4] = "-dead_strip" + //args[5] = "-O2" needRuntime := false needPyInit := false packages.Visit([]*packages.Package{pkg}, nil, func(p *packages.Package) {