We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4038

Summary: [cmake] Fix installation of shared library for Android
Product: SDL Reporter: Boris Pek <tehnick-8>
Component: buildAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: tehnick-8
Version: HG 2.1   
Hardware: All   
OS: Android (All)   
Attachments: fix installation of shared library for Android

Description Boris Pek 2018-01-10 16:46:23 UTC
See attached patch.

Without patch for -DCMAKE_BUILD_TYPE="Release" build:

boris@Tehnick:~/Opt/aplump__work/android-ndk-extra-libs/platforms/android-16/arch-arm$ LC_ALL=C ls -lp usr/lib/
total 12
drwxr-xr-x 3 boris boris 4096 Jan 10 19:44 cmake/
lrwxrwxrwx 1 boris boris   14 Jan 10 19:44 libSDL2.so -> libSDL2-2.0.so
-rw-r--r-- 1 boris boris 1430 Jan 10 19:44 libSDL2main.a
drwxr-xr-x 2 boris boris 4096 Jan 10 19:44 pkgconfig/


Without patch for -DCMAKE_BUILD_TYPE="Debug" build:

boris@Tehnick:~/Opt/aplump__work/android-ndk-extra-libs/platforms/android-16/arch-arm$ LC_ALL=C ls -lp usr/lib/
total 2572
drwxr-xr-x 3 boris boris    4096 Jan 10 19:43 cmake/
lrwxrwxrwx 1 boris boris      14 Jan 10 19:43 libSDL2.so -> libSDL2-2.0.so
-rw-r--r-- 1 boris boris 2618072 Jan 10 19:43 libSDL2d.so
-rw-r--r-- 1 boris boris    1430 Jan 10 19:43 libSDL2maind.a
drwxr-xr-x 2 boris boris    4096 Jan 10 19:43 pkgconfig/


With patch for -DCMAKE_BUILD_TYPE="Release" build:

boris@Tehnick:~/Opt/aplump__work/android-ndk-extra-libs/platforms/android-16/arch-arm$ LC_ALL=C ls -lp usr/lib/
total 3092
drwxr-xr-x 3 boris boris    4096 Jan 10 19:18 cmake/
-rw-r--r-- 1 boris boris 3152452 Jan 10 19:18 libSDL2.so
-rw-r--r-- 1 boris boris    1430 Jan 10 19:17 libSDL2main.a
drwxr-xr-x 2 boris boris    4096 Jan 10 19:18 pkgconfig/


With patch for -DCMAKE_BUILD_TYPE="Debug" build:

boris@Tehnick:~/Opt/aplump__work/android-ndk-extra-libs/platforms/android-16/arch-arm$ LC_ALL=C ls -lp usr/lib/
total 2572
drwxr-xr-x 3 boris boris    4096 Jan 10 19:41 cmake/
-rw-r--r-- 1 boris boris 2618072 Jan 10 19:41 libSDL2d.so
-rw-r--r-- 1 boris boris    1430 Jan 10 19:41 libSDL2maind.a
drwxr-xr-x 2 boris boris    4096 Jan 10 19:41 pkgconfig/


Tested using aplump project (https://github.com/sibuserv/aplump).
Comment 1 Boris Pek 2018-01-10 17:24:01 UTC
As a side note: why the size of shared library for release build is bigger than for debug one? Probably you forgot to use 'strip' tool or to use '-s' option in CFLAGS.
Comment 2 Boris Pek 2018-01-10 21:31:14 UTC
Created attachment 3130 [details]
fix installation of shared library for Android
Comment 3 Alex Szpakowski 2018-01-11 12:07:09 UTC
I don't have an Android device or do any Android development personally, so assigning the bug to me probably won't speed up the process of getting it addressed.
Comment 4 Boris Pek 2018-01-11 12:10:13 UTC
Sorry. I have misinterpreted your recent commit related to Android.
Comment 5 Boris Pek 2018-01-23 15:31:16 UTC
Probably initial description is not enough clear... Currently cmake build for Android generates symlink to non-existent file, which forcibly replace the real shared library with the same name. Thus the "Release" build of shared library is could not be produced. My simple patch solves the issue.
Comment 6 Sam Lantinga 2018-02-07 22:03:47 UTC
Added, thanks!