Building a statically linked dbus-daemon

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Feb 6 14:02:15 CET 2014


On 06/02/14 02:46, Thiago Macieira wrote:
> Em qua 05 fev 2014, às 16:02:11, Jonathan Nichols escreveu:
>>     We would like to build a version of the dbus-daemon binary that is
>> 100% statically linked.
[...]
>>     Does anyone have any advice on how to do this?

My advice is "don't". You have some problem that you're trying to solve
with a static dbus-daemon binary; I would suggest identifying that
problem, and trying to solve it differently. [1] is an interesting
approach, although perhaps it has other flaws.

If you must use a static binary, dbus is an ordinary Autotools package,
so the process should be the same as any other Autotools package,
whatever that is. Assuming gcc, configuring with "LDFLAGS=-Wl,-static"
to link static versions of dependencies, and "--enable-static
--disable-shared" to compile and link a static version of libdbus[2],
might be involved; if overriding LDFLAGS doesn't work, CC='gcc
-Wl,-static' might (if so, please report that as a bug).

Also, what Thiago said.

Regards,
    S

[1]
http://joeyh.name/blog/entry/completely_linux_distribution-independent_packaging/
[2] dbus-daemon actually statically links a differently-compiled variant
of libdbus anyway, but "--enable-static --disable-shared" will affect
how smaller tools like dbus-monitor are linked



More information about the dbus mailing list