简体   繁体   中英

What is the meaning of `-static` in `go build -ldflags`'s arguments?

What is the meaning of -static in go build -ldflags 's arguments?

go build -a -v -ldflags "-linkmode external -extldflags \"-static -L /usr/lib -ltensorflow\" -s -w -X main.version=${IDE_DATE}-${IDE_VERSION}-${IDE_OS}-${IDE_ARCH}" -o $2 cmd/backend.go

Where can I find the documentatuion about -static ?

Assuming that your go enviroment is using gcc compiler:

https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html

-static

On systems that support dynamic linking, this overrides -pie and prevents linking with the shared libraries. On other systems, this option has no effect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM