On Thu, Sep 09, 2021 at 12:39:23PM +0200, Laszlo Ersek wrote:
On 09/08/21 17:48, Richard W.M. Jones wrote:
> On Wed, Sep 08, 2021 at 03:27:57PM +0200, Laszlo Ersek wrote:
>> This static-only linking allows the libguestfs daemon ("guestfsd") to
>> launch in the appliance, without unresolved hivex symbols, when libguestfs
>> is built against the hivex build dir. (Libguestfs's automatic *package*
>> collection for the appliance, based on the shared library requirements of
>> "guestfsd", cannot cover hivex when hivex is provided by a local
build
>> directory.)
>>
>> Linking hivex statically into *host-side* C programs that are compiled
>> against the hivex build dir is only a small penalty.
>>
>> Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
>> ---
>> lib/local/hivex.pc.in | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/local/hivex.pc.in b/lib/local/hivex.pc.in
>> index d899cb01a282..6f0b5bb44237 100644
>> --- a/lib/local/hivex.pc.in
>> +++ b/lib/local/hivex.pc.in
>> @@ -32,4 +32,4 @@ Version: @VERSION@
>> Description: Read and write Windows Registry Hive files.
>> Requires:
>> Cflags: -I${includedir}
>> -Libs: -L${libdir} -lhivex
>> +Libs: -L${libdir} -l:libhivex.a
>
> Worth a comment here in the .pc.in file? I was previously not aware
> this magic was possible.
How about squashing this:
> diff --git a/lib/local/hivex.pc.in b/lib/local/hivex.pc.in
> index 6f0b5bb44237..941638939fa3 100644
> --- a/lib/local/hivex.pc.in
> +++ b/lib/local/hivex.pc.in
> @@ -32,4 +32,8 @@ Version: @VERSION@
> Description: Read and write Windows Registry Hive files.
> Requires:
> Cflags: -I${includedir}
> +# The colon notation forces an exact filename search when linking; here
> +# effectively disabling shared library lookup. (Refer to "--library" in
ld(1).)
> +# Statically linking hivex matters mainly for "guestfsd", which runs in
the
> +# appliance.
> Libs: -L${libdir} -l:libhivex.a
Looks good, thanks.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v