Issue 610 in webp: Hard coded WebP_INCLUDE_DIRS after install makes installation un-relocatable

162 views
Skip to first unread message

benni… via monorail

unread,
May 16, 2023, 12:14:53 PM5/16/23
to webp-d...@webmproject.org
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 610 by benni...@gmail.com: Hard coded WebP_INCLUDE_DIRS after install makes installation un-relocatable
https://bugs.chromium.org/p/webp/issues/detail?id=610

https://github.com/webmproject/libwebp/blob/2d547e24dcf29c085dc55c769aa76428335ff5c6/cmake/WebPConfig.cmake.in#L13

```
set(WebP_INCLUDE_DIRS "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
```

This evaluates to an absolute path durring CMake install which makes the resulting install un-relocatable. Can that be changed? I didn't test, but I belive that the corresponding targets don't have that issue.

--
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

jz… via monorail

unread,
May 16, 2023, 6:43:59 PM5/16/23
to webp-d...@webmproject.org

Comment #1 on issue 610 by jz...@google.com: Hard coded WebP_INCLUDE_DIRS after install makes installation un-relocatable
https://bugs.chromium.org/p/webp/issues/detail?id=610#c1

This likely came from the simple example for configure_package_config_file() [1].

Looking at a few cmake files from packages I have installed on Debian I see a few like this and others with some variation of:

```
# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
# Use original install prefix when loaded through a
# cross-prefix symbolic link such as /lib -> /usr/lib.
get_filename_component(_realCurr "${_IMPORT_PREFIX}" REALPATH)
get_filename_component(_realOrig "/usr/lib/x86_64-linux-gnu/cmake/zstd" REALPATH)
if(_realCurr STREQUAL _realOrig)
set(_IMPORT_PREFIX "/usr/lib/x86_64-linux-gnu/cmake/zstd")
endif()
unset(_realOrig)
unset(_realCurr)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
endif()
```

Another simply has:

```
get_filename_component(prefix "${CMAKE_CURRENT_LIST_DIR}/../../../.." ABSOLUTE)
```

[1] https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html#command:configure_package_config_file

jz… via monorail

unread,
May 16, 2023, 6:44:28 PM5/16/23
to webp-d...@webmproject.org
Updates:
Cc: vra...@google.com
Status: Accepted

Comment #2 on issue 610 by jz...@google.com: Hard coded WebP_INCLUDE_DIRS after install makes installation un-relocatable
https://bugs.chromium.org/p/webp/issues/detail?id=610#c2

(No comment was entered for this change.)

jz… via monorail

unread,
May 16, 2023, 7:48:16 PM5/16/23
to webp-d...@webmproject.org

Comment #3 on issue 610 by jz...@google.com: Hard coded WebP_INCLUDE_DIRS after install makes installation un-relocatable
https://bugs.chromium.org/p/webp/issues/detail?id=610#c3

The example I gave from zstd is actually from its auto-generated zstdTargets.cmake file which the config includes.

jz… via monorail

unread,
May 16, 2023, 8:42:28 PM5/16/23
to webp-d...@webmproject.org
Updates:
Owner: jz...@google.com
Status: Started

Comment #4 on issue 610 by jz...@google.com: Hard coded WebP_INCLUDE_DIRS after install makes installation un-relocatable
https://bugs.chromium.org/p/webp/issues/detail?id=610#c4

If you can give https://chromium-review.googlesource.com/c/webm/libwebp/+/4539409 a try to make sure it works for you. This resolves correctly in my testing with the default CMAKE_INSTALL_INCLUDEDIR.

benni… via monorail

unread,
May 17, 2023, 4:50:05 AM5/17/23
to webp-d...@webmproject.org

Comment #5 on issue 610 by benni...@gmail.com: Hard coded WebP_INCLUDE_DIRS after install makes installation un-relocatable
https://bugs.chromium.org/p/webp/issues/detail?id=610#c5

https://chromium-review.googlesource.com/c/webm/libwebp/+/4539409 worked for me, thanks!

jz… via monorail

unread,
May 17, 2023, 5:00:37 PM5/17/23
to webp-d...@webmproject.org
Updates:
Labels: v1.3.1

Comment #6 on issue 610 by jz...@google.com: Hard coded WebP_INCLUDE_DIRS after install makes installation un-relocatable
https://bugs.chromium.org/p/webp/issues/detail?id=610#c6

Thanks for testing it. I'll submit this soon and it will be a part of the 1.3.1 release.
Reply all
Reply to author
Forward
0 new messages