Bug 373702 - The android toolchain doesn't support locally built shared libraries
Summary: The android toolchain doesn't support locally built shared libraries
Status: RESOLVED WORKSFORME
Alias: None
Product: extra-cmake-modules
Classification: Frameworks and Libraries
Component: AndroidToolchain (other bugs)
Version First Reported In: unspecified
Platform: Other Android 5.x
: NOR normal
Target Milestone: ---
Assignee: Aleix Pol
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-15 19:42 UTC by Emmanuel Lepage Vallée
Modified: 2022-11-26 05:17 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Emmanuel Lepage Vallée 2016-12-15 19:42:18 UTC
When a .so library is added to the project using add_subdirectory, then it doesn't build for android because the RegEx used to convert the paths strip relative paths from the point of view of the build directory.

for example, the lib will be "Qt-Color-Widgets/foo.so" will be converted to  "/foo.so".

diff --git a/toolchain/specifydependencies.cmake b/toolchain/specifydependencies.cmake
index 65e875b..b2fc83e 100644
--- a/toolchain/specifydependencies.cmake
+++ b/toolchain/specifydependencies.cmake
@@ -2,7 +2,7 @@ file(READ "${TARGET_DIR}/CMakeFiles/${TARGET_NAME}.dir/link.txt" out)
 
 string(FIND "${out}" "-o ${TARGET_NAME}" POS) #we trim the initial arguments, we want the ones in the end. we find the target
 string(SUBSTRING "${out}" ${POS} -1 out) #we
-string(REGEX MATCHALL "(/|\\.\\./|\\./)[^ ]+\\.so" outout "${out}")
+string(REGEX MATCHALL "[^ ]+\\.so" outout "${out}")
 string(STRIP "${outout}" outout)
 string(REPLACE " /" ";/" outout "${outout}")
 
This patch remove the RegEx first group, as it seems useless and wrong. However if its there, I guess this it's no accident.
Comment 1 Aleix Pol 2016-12-16 00:28:45 UTC
Adding CoLa, this was introduced in:

commit c6ae4fa9008b0805f4358012040e67577ba31791
Author: Andreas Cord-Landwehr <cordlandwehr@kde.org>
Date:   Mon Jun 13 18:27:24 2016 +0200

    Integrate relative library paths to APK
    
    Needed for many unit tests to add them to APK files.
    
    REVIEW: 128175
Comment 2 Emmanuel Lepage Vallée 2016-12-16 00:45:43 UTC
What do you propose to fix the issue?

Here's a "test case"

https://github.com/Elv13/test-crosscompile

It is self contained, it will built its own version of the KF5 libraries, so (in theory), if you have both SDK and NDK environment variables set, it should compile and reproduce the problem
Comment 3 Justin Zobel 2022-10-27 02:48:56 UTC
Thank you for reporting this bug in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 4 Bug Janitor Service 2022-11-11 05:19:40 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Bug Janitor Service 2022-11-26 05:17:16 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!