Skip to contentSkip to conversation

why is blktap statically linking it's drivers?

DISCUSSION Sean Dague 5 participants 5 messages Aug 4, 2006 – Aug 8, 2006

lore
Share & tools
lore

Sean Dague

author
#0 lore raw

It took me a bit to realize that the issue I was having with blktap compiling in xen-unstable is that it is statically linking libcrypto and libc into all of the executables in: xen-unstable/tools/blktap/drivers

Is there a reason for this? It means that every one of those executables ends up at > 1 MB, which seems quite excessive. It also means that you need static-devel packages on some distros, which tend to not be installed by default.

-Sean

Signature · 3 lines
Sean Dague
IBM Linux Technology Center                     email: [email protected]
Open Hypervisor Team                           alt: [email protected]

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 8 lines · Sean Dague

It took me a bit to realize that the issue I was having with blktap compiling in xen-unstable is that it is statically linking libcrypto and libc into all of the executables in: xen-unstable/tools/blktap/drivers

Is there a reason for this? It means that every one of those executables ends up at > 1 MB, which seems quite excessive. It also means that you need static-devel packages on some distros, which tend to not be installed by default.

I *think* the intention is to statically link to our own copy of libaio, but the -static flag causes us to statically link against all libraries. The correct thing might be to explicitly link in libaio.a and remove -static, but Julian will know better than me.

-- Keir

#2 lore raw
Quoted 12 lines · Keir Fraser
Quoted 8 lines · Sean Dague

It took me a bit to realize that the issue I was having with blktap compiling in xen-unstable is that it is statically linking libcrypto and libc into all of the executables in: xen-unstable/tools/blktap/drivers

Is there a reason for this? It means that every one of those executables ends up at > 1 MB, which seems quite excessive. It also means that you need static-devel packages on some distros, which tend to not be installed by default.

Quoted 5 lines

I *think* the intention is to statically link to our own copy of libaio, but the -static flag causes us to statically link against all libraries. The correct thing might be to explicitly link in libaio.a and remove -static,
but Julian will know better than me.

Yep that's correct, we wanted to avoid libaio conflicts. I'll push an update to the Makefile today.

- Julian

Quoted 9 lines

-- Keir

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
In reply to Sean Dague
Quoted 8 lines · Sean Dague

It took me a bit to realize that the issue I was having with blktap compiling in xen-unstable is that it is statically linking libcrypto and libc into all of the executables in: xen-unstable/tools/blktap/drivers

Is there a reason for this? It means that every one of those executables ends up at > 1 MB, which seems quite excessive. It also means that you need static-devel packages on some distros, which tend to not be installed by default.

I am a great fan of static linking, because it is the only simple solution to 'DLL hell' (which I find to be a greater problem on Linux now than on Windows), and because it allows simple installation of binaries to remote machines and places where I do not have root-access. Most commercial software also comes in static versions, as this is the only reasonable way to deal with the n-distros problem. Finally, statically linked applications load faster because all the linking has been done ahead of time.

Unfortunately GNU ld does a very poor job of eliminating unreachable code, and when combined with the bloated glibc you end up with such enourmous binaries. Other linkers, e.g. Microsoft's linker on Windows and SN System's own linker which is used by most game developers prove that it is possible to perform much better than ld. Another option is to shun glibc in favor of a stripped-down libc such as uClibc, newlib or dietlibc. I recently played with uClibc for my own tools, and one went from 500kB down to 22kB just by replacing glibc with uclibc's version.

I hope that in the future GNU ld will improve (or perhaps the OpenWatcom linker may be used instead), and that distro maintainers will remember to ship .a versions of libraries, so that static linking keeps being an option.

Regards,
Jacob

#4 lore raw
Quoted 5 lines · Jacob Gorm Hansen

I hope that in the future GNU ld will improve (or perhaps the OpenWatcom linker may be used instead), and that distro maintainers will remember to ship .a versions of libraries, so that static linking keeps being an option.

Wow, Watcom takes me back to my netware days, although we used the phar lap linker back then.

Mike