Bug 428995 - CMAKE_FIND_ROOT_PATH is not passed properly to 3rdparty projects in androidbuild.sh
Summary: CMAKE_FIND_ROOT_PATH is not passed properly to 3rdparty projects in androidbu...
Status: RESOLVED LATER
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: git master (please specify the git hash!)
Platform: Compiled Sources Android 9.x
: NOR normal
Target Milestone: ---
Assignee: sh_zam
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-11 23:44 UTC by amyspark
Modified: 2022-10-05 14:59 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description amyspark 2020-11-11 23:44:17 UTC
SUMMARY

In androidbuild.sh and the corresponding 3rdparty CMake config, we use CMAKE_FIND_ROOT_PATH to tell CMake where to look for the libraries.
However, when CMake finds the semicolons in the variable contents (as expected; it's a list after all), it treats the first item only as its contents; the rest are silently passed as individual arguments, and therefore discarded.

This issue does not break deps build because the only affected dependency is ext_frameworks, which is not used in Android; but it'd be wise to fix it up, so that I can take advantage of it to bundle my GMic plugin.

STEPS TO REPRODUCE
1. Compile dependencies with androidbuild.sh
2. Grep for "CMAKE_FIND_ROOT_PATH" in $BUILD_ROOT/b.

OBSERVED RESULT
The build.make commands include the first item only of CMAKE_FIND_ROOT_PATH.

EXPECTED RESULT
Check that the build.make commands include the whole contents of the list.

SOFTWARE/OS VERSIONS
Windows: N/A
macOS: N/A
Linux/KDE Plasma: N/A
(available in About System)
KDE Plasma Version: N/A
KDE Frameworks Version: 5.76.0
Qt Version: 5.12.9

ADDITIONAL INFORMATION
NDK: r21b
Comment 1 sh_zam 2020-11-12 08:45:47 UTC
yes, you're right. Things seem fine with krita/3rdparty/CMakeLists.txt, but once we assign the variable to GLOBAL_PROFILE, because of quotes/no-quotes the list somehow gets expanded. I did try a few combination with quotes, no quotes and escaping but nothing seemed to work :/

```
  set (GLOBAL_PROFILE ${GLOBAL_PROFILE}
                     -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
                     -DANDROID_PLATFORM=${ANDROID_PLATFORM}
                     -DANDROID_ABI=${ANDROID_ABI}
                     -DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH})
```
Comment 2 sh_zam 2020-11-12 09:36:47 UTC
a related thread https://cmake.org/Bug/view.php?id=16137
Comment 3 amyspark 2021-08-17 16:35:59 UTC
Git commit 2e0c862adb2856067fcf6c7cf4a6a546896a4f73 by L. E. Segovia.
Committed on 17/08/2021 at 16:34.
Pushed by lsegovia into branch 'master'.

Android: enable building GMic as a plugin

This commit adds a *completely optional* step to build GMic as a plugin
for Android. It also adds a workaround to ensure that its project
can pick CMAKE_FIND_ROOT_PATH up.

CCMAIL: kimageshop@kde.org

M  +10   -1    3rdparty/CMakeLists.txt
M  +11   -1    3rdparty_plugins/CMakeLists.txt
M  +1    -0    3rdparty_plugins/ext_gmic/CMakeLists.txt
M  +11   -0    CMakeLists.txt
M  +43   -1    packaging/android/androidbuild.sh

https://invent.kde.org/graphics/krita/commit/2e0c862adb2856067fcf6c7cf4a6a546896a4f73
Comment 4 amyspark 2022-05-15 15:21:45 UTC
This bug has started affecting Android deps build with NDK 21.4.7075529 (android-28).

CMake started detecting this issue in 3.23: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6882
Comment 5 amyspark 2022-05-23 16:41:11 UTC
This bug doesn't affect r21b, so let's close it.
Comment 6 amyspark 2022-10-02 03:07:13 UTC
Git commit ca68a68a052b5acbcf86bb8d27ed01aa60151d3a by L. E. Segovia, on behalf of Ivan Yossi.
Committed on 02/10/2022 at 02:16.
Pushed by lsegovia into branch 'master'.

3rdparty: ensure the correct macOS architecture is built

Some packages need an explicit value of CMAKE_OSX_ARCHITECTURES to be
sent to allow a correct build. This is a bit of a hacky way of
achieving this. Currently CMake is able to properly build fat binaries
if "x86_64;arm64" flag is sent, however, internally CMake represents
lists as semicolon separated strings which makes it complicated to pass
the entire arch value to ExternalProject without turning into a list
in the process.

M  +3    -1    3rdparty/CMakeLists.txt
M  +1    -7    3rdparty/ext_ocio/CMakeLists.txt
M  +7    -0    packaging/macos/osxbuild.sh

https://invent.kde.org/graphics/krita/commit/ca68a68a052b5acbcf86bb8d27ed01aa60151d3a
Comment 7 amyspark 2022-10-05 14:59:16 UTC
Git commit f4558eb2ce102cb0091e1ba559e301ac55239213 by L. E. Segovia, on behalf of Ivan Yossi.
Committed on 05/10/2022 at 14:57.
Pushed by lsegovia into branch 'krita/5.1'.

3rdparty: ensure the correct macOS architecture is built

Some packages need an explicit value of CMAKE_OSX_ARCHITECTURES to be
sent to allow a correct build. This is a bit of a hacky way of
achieving this. Currently CMake is able to properly build fat binaries
if "x86_64;arm64" flag is sent, however, internally CMake represents
lists as semicolon separated strings which makes it complicated to pass
the entire arch value to ExternalProject without turning into a list
in the process.
(cherry picked from commit ca68a68a052b5acbcf86bb8d27ed01aa60151d3a)

M  +4    -1    3rdparty/CMakeLists.txt
M  +1    -7    3rdparty/ext_ocio/CMakeLists.txt
M  +7    -0    packaging/macos/osxbuild.sh

https://invent.kde.org/graphics/krita/commit/f4558eb2ce102cb0091e1ba559e301ac55239213