You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "tsint (via GitHub)" <gi...@apache.org> on 2024/11/21 13:42:16 UTC

[I] [Feature] Improve the compilation of skywalking-rover [skywalking]

tsint opened a new issue, #12789:
URL: https://github.com/apache/skywalking/issues/12789

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) 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:  
   - [Google Groups: golang-nuts](https://groups.google.com/g/golang-nuts/c/LZbM2WlZoJM)  
   - [Radhifadlillah Blog: Build Go Statically](https://radhifadlillah.com/blog/2020-09-10-build-go-statically/)  
   
   
   ### Use case
   
   _No response_
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a pull request to implement this on your own?
   
   - [X] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature] Improve the compilation of skywalking-rover [skywalking]

Posted by "mrproliu (via GitHub)" <gi...@apache.org>.
mrproliu commented on issue #12789:
URL: https://github.com/apache/skywalking/issues/12789#issuecomment-2492664940

   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. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature] Improve the compilation of skywalking-rover [skywalking]

Posted by "tsint (via GitHub)" <gi...@apache.org>.
tsint commented on issue #12789:
URL: https://github.com/apache/skywalking/issues/12789#issuecomment-2493727335

   > > 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature] Improve the compilation of skywalking-rover [skywalking]

Posted by "mrproliu (via GitHub)" <gi...@apache.org>.
mrproliu closed issue #12789: [Feature] Improve the compilation of skywalking-rover
URL: https://github.com/apache/skywalking/issues/12789


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature] Improve the compilation of skywalking-rover [skywalking]

Posted by "tsint (via GitHub)" <gi...@apache.org>.
tsint commented on issue #12789:
URL: https://github.com/apache/skywalking/issues/12789#issuecomment-2492690953

   > 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.
   ```bash
   $ 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.
   ```bash
   $ 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature] Improve the compilation of skywalking-rover [skywalking]

Posted by "mrproliu (via GitHub)" <gi...@apache.org>.
mrproliu commented on issue #12789:
URL: https://github.com/apache/skywalking/issues/12789#issuecomment-2492706259

   > 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? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org