[Development] Android missing SONAME in lib's causes

Simon Lees simon.lees at codan.com.au
Wed Jul 17 06:31:07 CEST 2013


On 07/12/2013 11:24 AM, Simon Lees wrote:
> On 07/11/2013 10:11 PM, Rafael Roquetto wrote:
>> On Thu, Jul 11, 2013 at 09:14:39AM -0300, Rafael Roquetto wrote:
>>> On Thu, Jul 11, 2013 at 10:31:30AM +0930, Simon Lees wrote:
>>>> Hi,
>>>>
>>>> I have tried adding
>>>> set (CMAKE_SHARED_LIBRARY_SONAME_C_FLAG
>>>> "${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG} -soname")
>>>> and alternatively
>>>> set (CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-soname")
>>>> To both my CMakeLists.txt and the toolchain file (One at a time) Neither
>>>> have helped, is this what you meant? If it is can you send me a copy of
>>>> your config files so i can look for differences. I am using the android
>>>> toolchain file from the same location as Stephen.
>>>
> I had a play with the android mkspecs the other day, but didn't get
> anywhere. This is probably due to my very limited understanding of the
> Qt build system, i'll have another play today if anyone has suggestions
> i'd love to here them, i'm also sitting around on irc as Simotek-Work
>
> Cheers
>
> Simon
> .
>
Hi All,
i have come up with a solution that works, it's by no means great and i 
am wondering if anyone can give us some improvements.
Firstly i added the following two lines to the android mkspecs
QMAKE_LFLAGS_SONAME     = -Wl,-soname=
QMAKE_LFLAGS_RPATH         = -Wl,-rpath=/system/lib

this embeds SONAME libQt5x.so.5 into the Qt Libraries and NEEDED 
libQt5Core.so.5 this is a good start as it removes the fixed path from 
the needed line. It still causes issues on android however, as it tries 
to load libQt5Core.so.5 etc that does not exist.

I was unable to find a nice way to work around this and i would 
appreciate help if anyone can provide it. The process i ended up taking 
was to modify the makefiles so that they contained in the LFLAGS 
'-soname=libQt5x.so' instead of '-soname=libQt5x.so.5' .

To do this first i created the make files by configuring then running 
'make qmake_all' after that i ran the following command in the top level 
dir to modify all the makefiles.

find . -name "Makefile" -exec perl -pe "if (m/^LFLAG/) { s/.so.5/.so/; 
}" -F -i '{}' \;

i then ran 'make' to build all the Qt libraries. When i use cmake to 
build a application against these libraries i end up with NEEDED 
libQt5Core.so in my shared library which works fine on android.

Cheers,
Simon




More information about the Development mailing list