Closed tsint closed 1 hour ago
buildvcs=false
, could you describe the scenario when it would cause failure? We already use volume mount when building the binary in the container. -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.
- 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.- 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.
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.
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?
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?
Sorry, I found that it was my mistake about failure to build a static executable file.
I manually executed make linux
inside the container because I didn't want to create an image and push it to the local Docker repository, and also to speed up the compilation process.
Although setting ENV CGO_ENABLED=0
is fine, I would like to add CGO_ENABLED=0
to the build command and also add a generate
dependency to the build process. This would make it easier to compile manually inside the container.
Search before asking
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?
Code of Conduct