Skip to content
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

[Feature] Improve the compilation of skywalking-rover #12789

Open
3 tasks done
tsint opened this issue Nov 21, 2024 · 3 comments
Open
3 tasks done

[Feature] Improve the compilation of skywalking-rover #12789

tsint opened this issue Nov 21, 2024 · 3 comments
Assignees
Labels
agent Language agent related. feature New feature Rover eBPF agent

Comments

@tsint
Copy link

tsint commented Nov 21, 2024

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Description

When compiling skywalking-rover, add buildvcs=false to prevent compilation failures caused by Git in container environments. Additionally, include the flags -tags osusergo,netgo to achieve fully static compilation, avoiding runtime issues caused by incompatible versions of the glibc library.

For more infomation, see:

Use case

No response

Related issues

No response

Are you willing to submit a pull request to implement this on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

@tsint tsint added the feature New feature label Nov 21, 2024
@wu-sheng wu-sheng added agent Language agent related. Rover eBPF agent labels Nov 21, 2024
@mrproliu
Copy link
Contributor

  1. For buildvcs=false, could you describe the scenario when it would cause failure? We already use volume mount when building the binary in the container.
  2. For the -tags osusergo,netgo, we already disable the gclib library in https://github.com/apache/skywalking-rover/blob/main/docker/Dockerfile.build#L26. So I think these two tags are not necessary.

@tsint
Copy link
Author

tsint commented Nov 22, 2024

  1. For buildvcs=false, could you describe the scenario when it would cause failure? We already use volume mount when building the binary in the container.
  2. For the -tags osusergo,netgo, we already disable the gclib library in https://github.com/apache/skywalking-rover/blob/main/docker/Dockerfile.build#L26. So I think these two tags are not necessary.
  1. Many scenarios could lead to issues, such as the code directory not being set as a safe.directory, a change in the directory owner. Or the presence of a .git directory in a parent directory, or corruption of the .git directory itself. In short, setting this causes no harm and helps avoid unnecessary compilation failures.
  2. Based on my actual execution of the ldd command, it does not appear to be as you described.
$ ldd bin/skywalking-rover-latest-linux-amd64
        linux-vdso.so.1 (0x00007ffc287e8000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007faeb7800000)
        /lib64/ld-linux-x86-64.so.2 (0x00007faeb7b93000)

If go tags are added, it becomes noticeably different.

$ ldd bin/skywalking-rover-latest-linux-amd64
        not a dynamic executable

Setting ENV CGO_ENABLED=0 has no effect on Docker's RUN command. Moreover, if CGO_ENABLED=0 is added to the compilation command, importing "c" will result in a compilation failure.

@mrproliu
Copy link
Contributor

Many scenarios could lead to issues, such as the code directory not being set as a safe.directory, a change in the directory owner. Or the presence of a .git directory in a parent directory, or corruption of the .git directory itself. In short, setting this causes no harm and helps avoid unnecessary compilation failures.

Make sense to me, please add this parameter.

Setting ENV CGO_ENABLED=0 has no effect on Docker's RUN command. Moreover, if CGO_ENABLED=0 is added to the compilation command, importing "c" will result in a compilation failure.

Then, we should consider why the CGO_ENABLED is not working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent Language agent related. feature New feature Rover eBPF agent
Projects
None yet
Development

No branches or pull requests

3 participants