I have some trouble,I don’t know how it is?
I want to build source file.
directory:
go
-src
-lib
greet.go
-main
main.go
I use the command like this:
cd go;
go build -o lib.a -x -v src/lib/greet.go
the compiler does:
WORK=/tmp/go-build656288917
command-line-arguments
mkdir -p $WORK/b001/
cat >$WORK/b001/importcfg << ‘EOF’ # internal
import config
packagefile fmt=/usr/local/go/pkg/linux_amd64/fmt.a
EOF
cd /tmp/go/src/lib
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/b001/pkg.a -trimpath “$WORK/b001=>” -p command-line-arguments -complete -buildid rP94e3iTbzSluHW4oK35/rP94e3iTbzSluHW4oK35 -goversion go1.15.6 -D _/tmp/go/src/lib -importcfg $WORK/b001/importcfg -pack ./greet.go
/usr/local/go/pkg/tool/linux_amd64/buildid -w $WORK/b001/pkg.a # internal
cp $WORK/b001/pkg.a /root/.cache/go-build/04/04c8eab7a53e72ca62bc5f1ffd46a09eb7c7706d1aad671b93b2784fbe44edf9-d # internal
mv $WORK/b001/pkg.a lib.a
I found command-line-arguments in this command, “-p command-line-arguments”
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/b001/pkg.a -trimpath “$WORK/b001=>” -p command-line-arguments -complete -buildid rP94e3iTbzSluHW4oK35/rP94e3iTbzSluHW4oK35 -goversion go1.15.6 -D _/tmp/go/src/lib -importcfg $WORK/b001/importcfg -pack ./greet.go
then I continue:
go tool compile -I . src/main/main.go //get main.o
go tool link -L . main.o
main…inittask: relocation target lib…inittask not defined
I found it is cause by “-p command-line-arguments”
why? command-line-arguments is a function ? return what? is a common string?
in the command:
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/b001/pkg.a -trimpath “$WORK/b001=>” -p command-line-arguments -complete -buildid rP94e3iTbzSluHW4oK35/rP94e3iTbzSluHW4oK35 -goversion go1.15.6 -D _/tmp/go/src/lib -importcfg $WORK/b001/importcfg -pack ./greet.go
-p command-line-arguments in acture instead of what?