Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need Clarity: why need gspt.SetProcTitle(os.Args[0] + " server") when server run #4500

Closed
xiaods opened this issue Nov 15, 2021 · 3 comments
Closed

Comments

@xiaods
Copy link
Contributor

xiaods commented Nov 15, 2021

I am reading the source code for k3s, I don't know why need this line
gspt.SetProcTitle(os.Args[0] + " server")

anyone know it and give some hints.

@xiaods
Copy link
Contributor Author

xiaods commented Nov 15, 2021

I'm try build cross compile based on AMD64 image. but it block by this line:
https://github.com/k3s-io/k3s/blob/master/scripts/build#L106

CGO_ENABLED=1 "${GO}" build -tags "$TAGS" -ldflags "$VERSIONFLAGS $LDFLAGS $STATIC_SQLITE" -o bin/containerd ./cmd/server/main.go

CGO_ENABLED=1 will block cross compile. so I search and found only gspt.SetProcTitle use C func.

@xiaods
Copy link
Contributor Author

xiaods commented Nov 15, 2021

CGO_ENABLED=1 go build -trimpath -tags "apparmor seccomp selinux netgo osusergo" -ldflags "-extldflags -static -X main.gitCommit=v1.0.2-0-g52b36a2d -X main.version=1.0.2 -w -s" -o runc .

@brandond
Copy link
Member

K3s must be built with CGO_ENABLED:

k3s/scripts/build

Lines 105 to 106 in 535a919

echo Building server
CGO_ENABLED=1 "${GO}" build -tags "$TAGS" -ldflags "$VERSIONFLAGS $LDFLAGS $STATIC_SQLITE" -o bin/containerd ./cmd/server/main.go

The reason for calling setproctitle is discussed at #2014

@k3s-io k3s-io locked and limited conversation to collaborators Nov 15, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants