Subject: bug#61988: error compiling emacs

From: Po Lu <[email-masked]>
Date: Tue, 07 Mar 2023 08:34:18 +0800

Eli Zaretskii <[email-masked]> writes:

> reopen 61988
> thanks
>
>> From: Po Lu <[email-masked]>
>> Cc: [email-masked],  [email-masked]
>> Date: Mon, 06 Mar 2023 21:43:06 +0800
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> 
>> >> From: Po Lu <[email-masked]>
>> >> Cc: [email-masked], Eli Zaretskii <[email-masked]>
>> >> Date: Mon, 06 Mar 2023 18:35:05 +0800
>> >> 
>> >> >> -      WEBP_MODULE="libwebpdemux >= $WEBP_REQUIRED"
>> >> >> +      WEBP_MODULE="libwebpdemux >= $WEBP_REQUIRED libwebpdecoder >= $WEBP_REQUIRED"
>> >> >>           EMACS_CHECK_MODULES([WEBP], [$WEBP_MODULE])
>> >> >>         AC_SUBST([WEBP_CFLAGS])
>> >> >>
>> >> >> Everyone else, make sure to link to *EVERYTHING* that you depend on, not
>> >> >> just one library that happens to link to everything you depend on.
>> >> >> Thanks.
>> >> 
>> >> Thanks.  Eli, is this safe for Emacs 29?
>> >
>> > Yes, thanks.
>> 
>> Thanks, I installed the patch and am closing this bug.
>
> Sorry, I wasn't paying close attention, and though that you are adding
> libwebpdemux.  With linwebpdecoder, the test fails on my system, since
> libwebpdecoder is not installed and neither is its pkg-config file.
> And is not needed: we don't use any API from that library, AFAICT.
>
> So I've reverted that change for now, and I'm reopening the bug.
>
> I'd like to know why requiring libwebpdecoder is essential for the
> build to work on the OP's system.  It isn't on mine, and if you look
> at init_webp_functions, you will see that on Windows we load functions
> only from libwebp and libwebpdemux.  Why is the third library needed?

It is here, because Emacs needs the function ``WebPGetInfo'', and on
GNU/Linux systems that function is in libwebpdecoder.so:

libwebpdecoder.so.3.1.5:     file format elf64-x86-64

[...]

000000000000a160 g    DF .text	00000000000000a1  Base        WebPGetInfo

and here, I have a pkg-config file named libwebpdecoder.pc

prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib64
includedir=${prefix}/include

Name: libwebpdecoder
Description: Library for the WebP graphics format (decode only)
Version: 1.2.4
Cflags: -I${prefix}/include
Libs: -L${prefix}/lib64 -lwebpdecoder
Libs.private: -lm  

while the pkg-config file for libwebpdemux only links to -lwebpdemux,
not -lwebpdecoder.

GNU ld does not allow you to link to symbols in dependencies of shared
libraries, so asking for libwebpdemux while using symbols in
libwebpdecoder does not work.