You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
在编译参数 CGO_ENABLED=0 的情况下,lima 虚拟机内的 dae 始终 hang 在:
$ sudo ./dae run -c /etc/dae/config.dae
[Jun 21 02:00:36] INFO Include config files: [/etc/dae/config.dae]
[Jun 21 02:00:36] INFO Waiting for network...
编译参数 CGO_ENABLED=1 时一切正常。这可能是 go resolver 不支持 /etc/nsswitch.conf 导致的。
$ sudo ./dae run -c /etc/dae/config.dae
[Jun 21 02:25:30] INFO Include config files: [/etc/dae/config.dae]
[Jun 21 02:25:30] INFO Waiting for network...
[Jun 21 02:25:31] INFO Network online.
[Jun 21 02:25:31] INFO Fetching subscriptions...
[Jun 21 02:25:32] INFO Loading eBPF programs and maps into the kernel...
[Jun 21 02:25:32] INFO The loading process takes about 120MB free memory, which will be released after loading. Insufficient memory will cause loading failure.
[Jun 21 02:25:33] INFO Loaded eBPF programs and maps
Proposal
在编译参数 CGO_ENABLED=0 的情况下,lima 虚拟机内的 dae 始终 hang 在:
编译参数 CGO_ENABLED=1 时一切正常。这可能是 go resolver 不支持 /etc/nsswitch.conf 导致的。
Use Cases
一些特殊场景(例如 DNS 特异环境),提高兼容性。
Potential Benefits
避免一些异常的 go resolver 行为。
Scope
No response
Reference
No response
Implementation
最简单地,可开启 CGO_ENABLED=1,使得 DNS 工作正常:
这也是打包时的建议方案,因此建议修改 Makefile 默认 CGO_ENABLED=1。
为了提高基础库版本兼容性,可使用 musl-gcc 来尽可能开启 CGO 的情况下保持静态编译:
CI 里可以利用 zig 编译器来支持交叉编译:https://hrishikeshpathak.com/tips/build-static-binary-cross-compile-cgo-project-zig-compiler/
The text was updated successfully, but these errors were encountered: