Both go build and go install need to be compiled using source code. But sometimes we only have. A or. So files. We can’t get the source code of the third-party library. At this time, we need to compile the static link library;
Above is the file distribution before the experiment.
To compile a command using a static link library:
➜ src go tool compile -I ../pkg/darwin_amd64/ callyx.go ➜ src go tool link -o call2 -L ../pkg/darwin_amd64/ callyx.o
Post experiment file distribution:
As we can see from the figure, the executable is generated.
Resources come from the network. If it helps you, please pay attention to cnblogs.com/xuyaowen