Issue 612 in webp: CMake enhancement: skip PNG JPEG TIFF dependency

瀏覽次數:203 次
跳到第一則未讀訊息

benni… via monorail

未讀,
2023年5月24日 上午9:58:172023/5/24
收件者:webp-d...@webmproject.org
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 612 by benni...@gmail.com: CMake enhancement: skip PNG JPEG TIFF dependency
https://bugs.chromium.org/p/webp/issues/detail?id=612

WebP does not allow control over which attachments to use. What is found is used.

https://chromium.googlesource.com/webm/libwebp/+/refs/tags/v1.3.0/cmake/deps.cmake#87

I currently build my libraries myself on Windows. Depending on the order in which I install, the configuration changes. That means I always have to delete all installed data first and reinstall the desired dependencies from WebP before building it.

I suggest to add a skip variable for control:

--- a/libwebp-1.3.0/cmake/deps.cmake
+++ b/libwebp-1.3.0/cmake/deps.cmake
@@ -85,6 +85,10 @@ endif()
set(WEBP_DEP_IMG_LIBRARIES)
set(WEBP_DEP_IMG_INCLUDE_DIRS)
foreach(I_LIB PNG JPEG TIFF)
+ if(WEBP_SKIP_${I_LIB})
+ continue()
+ endif()
+
# Disable tiff when compiling in static mode as it is failing on Ubuntu.
if(WEBP_LINK_STATIC AND ${I_LIB} STREQUAL "TIFF")
message("TIFF is disabled when statically linking.")

This includes only PNG, JPEG and TIFF. The SKIP should also be implemented for other dependencies. (GIF) (I didn't add that, because it doesn't matter for my case and so I can not test it.)

--
You received this message because:
1. The project was configured to send all issue notifications to this address

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

vrab… via monorail

未讀,
2023年5月24日 上午11:29:012023/5/24
收件者:webp-d...@webmproject.org

Comment #1 on issue 612 by vra...@google.com: CMake enhancement: skip PNG JPEG TIFF dependency
https://bugs.chromium.org/p/webp/issues/detail?id=612#c1

How do you find_package your dependencies in the first place ? Or do you set library variables by hand ? Skipping would only work if it works in a first pass right ?

benni… via monorail

未讀,
2023年5月25日 凌晨4:21:032023/5/25
收件者:webp-d...@webmproject.org

Comment #3 on issue 612 by benni...@gmail.com: CMake enhancement: skip PNG JPEG TIFF dependency
https://bugs.chromium.org/p/webp/issues/detail?id=612#c3

In my case I build via CMake several libraries. zlib, libjpeg_turbo, zstd, xz, png, webp.

The build tree looks like this:

libtiff
|
+-- zstd
|
+-- xz
|
+-- webp
|
+-- libjpeg_turbo
|
+-- png
|
+ zlib

libtiff depends on WebP, but WebP also depends on libtiff. I generally want to build WebP without libtiff and libtiff with WebP.

With new library versions, I occasionally need to patch libraries, currently in libtiff. That means I call my build script multiple times. On the second run, WebP finds the installation of libtiff from the first run and of course tries to build against it. The only way to prevent this is to delete the install target folder before each run.

I find it generally inconvenient that I can only influence the optional dependencies used by the state of the filesystem. The skip option would make this explicitly configurable.

----

An even more common use case exists on Linux. There libraries are found in the standard paths. If I build WebP on one computer and then move it to another, I may have libtiff (or png, jpeg, gif ...) installed on the build computer and not on the target computer. But my built WebP does not need TIFF support (or png, jpeg, gif ...). So I want to be able to build it explicitly without these dependencies without having to worry about the environment I'm building in.

benni… via monorail

未讀,
2023年5月25日 凌晨4:31:012023/5/25
收件者:webp-d...@webmproject.org

Comment #4 on issue 612 by benni...@gmail.com: CMake enhancement: skip PNG JPEG TIFF dependency
https://bugs.chromium.org/p/webp/issues/detail?id=612#c4

I just had a look at the dependencies of the DLLs:

$ ldd libwebp*
libwebp.dll:
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ffea7030000)
hmpalert.dll => /c/Windows/system32/hmpalert.dll (0x7ffea4260000)
KERNEL32.dll => /c/Windows/System32/KERNEL32.dll (0x7ffea6490000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ffea4a00000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ffea58c0000)
libsharpyuv.dll => /c/Temp/lib/win_x86_64_debug/bin/libsharpyuv.dll (0x7ffe93cf0000)
VCRUNTIME140D.dll => /c/Windows/SYSTEM32/VCRUNTIME140D.dll (0x7ffe918c0000)
ucrtbased.dll => /c/Windows/SYSTEM32/ucrtbased.dll (0x7ffe8ddb0000)
libwebpdecoder.dll:
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ffea7030000)
hmpalert.dll => /c/Windows/system32/hmpalert.dll (0x7ffea4260000)
KERNEL32.dll => /c/Windows/System32/KERNEL32.dll (0x7ffea6490000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ffea4a00000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ffea58c0000)
VCRUNTIME140D.dll => /c/Windows/SYSTEM32/VCRUNTIME140D.dll (0x7ffe93ce0000)
ucrtbased.dll => /c/Windows/SYSTEM32/ucrtbased.dll (0x7ffe8ddb0000)
libwebpdemux.dll:
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ffea7030000)
hmpalert.dll => /c/Windows/system32/hmpalert.dll (0x7ffea4260000)
KERNEL32.dll => /c/Windows/System32/KERNEL32.dll (0x7ffea6490000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ffea4a00000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ffea58c0000)
libwebp.dll => /c/Temp/lib/win_x86_64_debug/bin/libwebp.dll (0x7ffe91ed0000)
VCRUNTIME140D.dll => /c/Windows/SYSTEM32/VCRUNTIME140D.dll (0x7ffe918c0000)
ucrtbased.dll => /c/Windows/SYSTEM32/ucrtbased.dll (0x7ffe8ddb0000)
libsharpyuv.dll => /c/Temp/lib/win_x86_64_debug/bin/libsharpyuv.dll (0x7ffe91e70000)
libwebpmux.dll:
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ffea7030000)
hmpalert.dll => /c/Windows/system32/hmpalert.dll (0x7ffea4260000)
KERNEL32.dll => /c/Windows/System32/KERNEL32.dll (0x7ffea6490000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ffea4a00000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ffea58c0000)
libwebp.dll => /c/Temp/lib/win_x86_64_debug/bin/libwebp.dll (0x7ffe91ed0000)
VCRUNTIME140D.dll => /c/Windows/SYSTEM32/VCRUNTIME140D.dll (0x7ffe918c0000)
ucrtbased.dll => /c/Windows/SYSTEM32/ucrtbased.dll (0x7ffe8ddb0000)
libsharpyuv.dll => /c/Temp/lib/win_x86_64_debug/bin/libsharpyuv.dll (0x7ffe91e70000)
$ ldd libsharpyuv.dll
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ffea7030000)
hmpalert.dll => /c/Windows/system32/hmpalert.dll (0x7ffea4260000)
KERNEL32.dll => /c/Windows/System32/KERNEL32.dll (0x7ffea6490000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ffea4a00000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ffea58c0000)
VCRUNTIME140D.dll => /c/Windows/SYSTEM32/VCRUNTIME140D.dll (0x7ffe91f80000)
ucrtbased.dll => /c/Windows/SYSTEM32/ucrtbased.dll (0x7ffe8ddb0000)

None of them depends on JPEG, PNG or ZLIB. What are these dependencies used for in the build?

For libtiff this looks different:

$ ldd tiffd.dll
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ffea7030000)
hmpalert.dll => /c/Windows/system32/hmpalert.dll (0x7ffea4260000)
KERNEL32.dll => /c/Windows/System32/KERNEL32.dll (0x7ffea6490000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ffea4a00000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ffea58c0000)
zlibd.dll => /c/Temp/lib/win_x86_64_debug/bin/zlibd.dll (0x7ffe91f70000)
jpeg62.dll => /c/Temp/lib/win_x86_64_debug/bin/jpeg62.dll (0x7ffe8de50000)
liblzma.dll => /c/Temp/lib/win_x86_64_debug/bin/liblzma.dll (0x7ffe91ef0000)
zstd.dll => /c/Temp/lib/win_x86_64_debug/bin/zstd.dll (0x7ffe8dcb0000)
libwebp.dll => /c/Temp/lib/win_x86_64_debug/bin/libwebp.dll (0x7ffe8ee00000)
VCRUNTIME140D.dll => /c/Windows/SYSTEM32/VCRUNTIME140D.dll (0x7ffe93ce0000)
ucrtbased.dll => /c/Windows/SYSTEM32/ucrtbased.dll (0x7ffe7dca0000)
libsharpyuv.dll => /c/Temp/lib/win_x86_64_debug/bin/libsharpyuv.dll (0x7ffe91ed0000)

If these are only needed for the build of tools, a skip option would also be useful.

vrab… via monorail

未讀,
2023年5月25日 上午11:08:322023/5/25
收件者:webp-d...@webmproject.org

Comment #5 on issue 612 by vra...@google.com: CMake enhancement: skip PNG JPEG TIFF dependency
https://bugs.chromium.org/p/webp/issues/detail?id=612#c5

PNG and such are only used to fill WEBP_DEP_IMG_LIBRARIES which is only used in examples (e.g. cwebp and dwebp).
You can disable those here and that should solve your problem: https://chromium.googlesource.com/webm/libwebp/+/refs/tags/v1.3.0/CMakeLists.txt#38

benni… via monorail

未讀,
2023年5月25日 上午11:19:162023/5/25
收件者:webp-d...@webmproject.org

Comment #6 on issue 612 by benni...@gmail.com: CMake enhancement: skip PNG JPEG TIFF dependency
https://bugs.chromium.org/p/webp/issues/detail?id=612#c6

Okay, that's good to know, thanks for pointing it out!

In fact, I have already turned that off. I had assumed that the dependencies were needed, since they were searched and found anyway. Would it be possible to search the dependencies only if `WEBP_BUILD_CWEBP=ON`? That would also shorten the configuration time a little bit.

Also, it is currently the case that the library is unnecessarily rebuilt if one of the dependencies is found during a second CMake run. This is not critical, as it only happens in edge cases like mine, but it is still unnecessary.

benni… via monorail

未讀,
2023年5月25日 下午2:07:112023/5/25
收件者:webp-d...@webmproject.org

Comment #7 on issue 612 by benni...@gmail.com: CMake enhancement: skip PNG JPEG TIFF dependency
https://bugs.chromium.org/p/webp/issues/detail?id=612#c7

If I remove line 101 `include(cmake/deps.cmake)` it does what I want.

https://chromium.googlesource.com/webm/libwebp/+/refs/tags/v1.3.0/CMakeLists.txt#101

I think that should only be included if the example(s) requiring the dependencies are enabled.

jz… via monorail

未讀,
2023年5月25日 下午4:54:262023/5/25
收件者:webp-d...@webmproject.org
Updates:
Owner: vra...@google.com
Status: Accepted

Comment #8 on issue 612 by jz...@google.com: CMake enhancement: skip PNG JPEG TIFF dependency
https://bugs.chromium.org/p/webp/issues/detail?id=612#c8

Thanks for working through this. I think refining when the checks are done makes sense. Another refinement might be to be able to disable the individual codecs, we allow for this in autoconf (--disable-png, --disable-tiff, etc.).

Git Watcher via monorail

未讀,
2023年5月26日 下午4:56:092023/5/26
收件者:webp-d...@webmproject.org

Comment #9 on issue 612 by Git Watcher: CMake enhancement: skip PNG JPEG TIFF dependency
https://bugs.chromium.org/p/webp/issues/detail?id=612#c9

The following revision refers to this bug:
https://chromium.googlesource.com/webm/libwebp/+/709ec152dfee669a992416e6769ff621cadd8ac7

commit 709ec152dfee669a992416e6769ff621cadd8ac7
Author: Vincent Rabaud <vra...@google.com>
Date: Thu May 25 22:14:05 2023

Do not find_package image libraries if not needed.

This can be tested by running:
cmake ../ -DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF -DWEBP_BUILD_EXTRAS=OFF

Bug: webp:612

Change-Id: Ie06d8f0535676d6d31ff0047ff7a6c026e16118e

[modify] https://crrev.com/709ec152dfee669a992416e6769ff621cadd8ac7/CMakeLists.txt
[modify] https://crrev.com/709ec152dfee669a992416e6769ff621cadd8ac7/cmake/deps.cmake

jz… via monorail

未讀,
2023年5月26日 晚上10:02:562023/5/26
收件者:webp-d...@webmproject.org
Updates:
Labels: -Needs-Feedback
Status: Started

Comment #10 on issue 612 by jz...@google.com: CMake enhancement: skip PNG JPEG TIFF dependency
https://bugs.chromium.org/p/webp/issues/detail?id=612#c10

(No comment was entered for this change.)
回覆所有人
回覆作者
轉寄
0 則新訊息