-
Notifications
You must be signed in to change notification settings - Fork 63
Update ipvsadm binary to a static/dynamic mix-compiled version #265
Conversation
| cp busybox /tmp/hyperstart-rootfs/sbin/ | ||
| cp iptables /tmp/hyperstart-rootfs/sbin/ | ||
| cp ipvsadm /tmp/hyperstart-rootfs/sbin/ | ||
| cp libm.so.6 /tmp/hyperstart-rootfs/lib64/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libm is still being used by iptables
ldd build/iptables
linux-vdso.so.1 => (0x00007ffdfbbf8000)
libm.so.6 => /lib64/libm.so.6 (0x00007fe2be9a1000)
libc.so.6 => /lib64/libc.so.6 (0x00007fe2be5e0000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe2becb0000)
build/make-initrd.sh
Outdated
| for bin in ${LDD_BINARIES[@]} | ||
| do | ||
| ldd /tmp/hyperstart-rootfs/${bin} | while read line | ||
| do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix the indent
|
|
||
| ldd /tmp/hyperstart-rootfs/init | while read line | ||
| LDD_BINARIES=(/init /sbin/ipvsadm /sbin/iptables) | ||
| for bin in ${LDD_BINARIES[@]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is recommended to use the libs provided by the src-tree or built from the src-tree.
currently /init use the host libs, it will be also fixed later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this because I meet some inconsistent issue when using libc(libc-2.23.so) on my host. Since All of them will be carried by hyperstart, it should be fine.
Just please include pthread.so, it's needed by ipvsadm.
Signed-off-by: Crazykev <crazykev@zju.edu.cn>
Signed-off-by: Crazykev <crazykev@zju.edu.cn>
|
@laijs updated. |
|
retest this please, hykins |
Previous ipvsadm binary is fully static built, while static linking of glibc has some bad effect. And libraries also used by
initandiptablesbinary like libm.so and libc.so should be shared.To solve this, I try to link libraries like libnl and popt statically, glibc like libm/libc/libpthread dynamically. See Dockerfile and build script from https://github.com/Crazykev/dev-tools/tree/master/ipvsadm-static, and ipvsadm source code from https://github.com/Crazykev/ipvsadm.
To get this binary, you can use build a image with Dockerfile and build script from here, and run
hyperctl run --rm -v [ipvsadm-dir]:/data ipvsadm-staticThis will reduce the size of hyperstart image from 5.4M to 5.1M in my environment.