[mythtv] Android 32bit build

Peter Bennett pb.mythtv at gmail.com
Sat Aug 11 03:49:51 UTC 2018



On 08/10/2018 06:45 PM, Mark Spieth wrote:
> On 8/11/2018 7:11 AM, Peter Bennett wrote:
>>
>>
>>
>> On 08/09/2018 06:26 PM, Mark Spieth wrote:
>>> On 8/10/2018 7:27 AM, Peter Bennett wrote:
>>>>
>>>>
>>>>
>>>> On 08/08/2018 08:14 PM, Mark Spieth wrote:
>>>>> On 09/08/18 08:37, Peter Bennett wrote:
>>>>>> I am trying to build the libraries for 32bit.
>>>>>>
>>>>>> liblzo fails in the configure "C compiler cannot create executables"
>>>>>>
>>>>>> makelibs.sh has, for 32bit,     CPU="armv7-a"
>>>>>>
>>>>>> The configure runs this
>>>>>>
>>>>>> /home/peter/android/android-ndk/my-android-toolchain/bin/arm-linux-androideabi-gcc 
>>>>>> -isysroot 
>>>>>> /home/peter/android/android-ndk/my-android-toolchain/sysroot 
>>>>>> -mcpu=armv7-a   conftest.c
>>>>>>
>>>>>> The error is
>>>>>>
>>>>>> arm-linux-androideabi-gcc: error: unrecognized argument in option 
>>>>>> '-mcpu=armv7-a'
>>>>>> arm-linux-androideabi-gcc: note: valid arguments to '-mcpu=' are: 
>>>>>> arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi 
>>>>>> arm1136j-s arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s 
>>>>>> arm1176jzf-s arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 
>>>>>> arm7 arm70 arm700 arm700i arm710 arm7100 arm710c arm710t arm720 
>>>>>> arm720t arm740t arm7500 arm7500fe arm7d arm7di arm7dm arm7dmi 
>>>>>> arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920 arm920t arm922t 
>>>>>> arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e arm9tdmi 
>>>>>> cortex-a12 cortex-a15 cortex-a15.cortex-a7 cortex-a5 cortex-a53 
>>>>>> cortex-a57 cortex-a57.cortex-a53 cortex-a7 cortex-a8 cortex-a9 
>>>>>> cortex-m0 cortex-m0plus cortex-m1 cortex-m3 cortex-m4 cortex-r4 
>>>>>> cortex-r4f cortex-r5 cortex-r7 ep9312 fa526 fa606te fa626 fa626te 
>>>>>> fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 marvell-pj4 mpcore 
>>>>>> mpcorenovfp native strongarm strongarm110 strongarm1100 
>>>>>> strongarm1110 xscale
>>>>>>
>>>>>> I tried changing CPU to use generic-armv7-a which is one of the 
>>>>>> "valid" arguments according to above message. That gives the same 
>>>>>> error, but this time not even displaying the list of "valid 
>>>>>> arguments".
>>>>>>
>>>>>> ndk is android-ndk-r13b
>>>>>>
>>>>>> Any suggestions?
>>>>>>
>>>>> try this.
>>>>>
>>>>> diff --git a/android/makelibs.sh b/android/makelibs.sh
>>>>> index 9d737b2..8c54895 100755
>>>>> --- a/android/makelibs.sh
>>>>> +++ b/android/makelibs.sh
>>>>> @@ -1179,17 +1179,15 @@ OPATH=$PATH
>>>>>  #              ;;
>>>>>  #      *)
>>>>>  #END
>>>>> +export PATH="$PATH:$CROSSPATH"
>>>>>  ./configure \
>>>>> -       CFLAGS="-isysroot $SYSROOT -mcpu=$CPU" \
>>>>> -       CXXFLAGS="-isysroot $SYSROOT -mcpu=$CPU" \
>>>>> -       CC="$CROSSPATH/$MY_ANDROID_NDK_TOOLS_PREFIX-gcc" \
>>>>> -       CXX="$CROSSPATH/$MY_ANDROID_NDK_TOOLS_PREFIX-g++" \
>>>>> -       CPP="$CROSSPATH/$MY_ANDROID_NDK_TOOLS_PREFIX-cpp" \
>>>>> -       --host=arm-linux-androideabi \
>>>>> +       --host=$MY_ANDROID_NDK_TOOLS_PREFIX \
>>>>>         --prefix=$INSTALLROOT \
>>>>>         --enable-shared \
>>>>>         --enable-static && \
>>>>>  make clean && \
>>>>> +CFLAGS="-isysroot $SYSROOT -mcpu=$CPU" \
>>>>> +CXXFLAGS="-isysroot $SYSROOT -mcpu=$CPU" \
>>>>>  make -j$NCPUS src/liblzo2.la && \
>>>>>  make install-libLTLIBRARIES install-data-am
>>>>>  ERR=$?
>>>>>
>>>>> builds for me both 32 and 64 but untested on targets.
>>>>>
>>>>> Mark
>>>>>
>>>>>
>>>> Thank you, it now builds and installs on my 32-bit tablet. However 
>>>> it does not run.
>>>>
>>>> D/dalvikvm( 6836): Trying to load lib 
>>>> /data/data/org.mythtv.mythfrontend/lib/libQt5Core.so 0x4199b580
>>>> E/dalvikvm( 6836): 
>>>> dlopen("/data/data/org.mythtv.mythfrontend/lib/libQt5Core.so") 
>>>> failed: Cannot load library: soinfo_relocate(linker.cpp:976): 
>>>> cannot locate symbol "srand" referenced by "libQt5Core.so"...
>>>> W/System.err( 6836): java.lang.reflect.InvocationTargetException
>>>> ...
>>>> W/System.err( 6836): Caused by: java.lang.UnsatisfiedLinkError: 
>>>> Cannot load library: soinfo_relocate(linker.cpp:976): cannot locate 
>>>> symbol "srand" referenced by "libQt5Core.so"...
>>>>
>>>> Some internet links about this -
>>>>
>>>> /For those stumbling onto this thread while having trouble with 
>>>> srand/atof on NDK r10c: Make sure you set your android target to 
>>>> 19. Your app should then work on Android 5 (21) as well as all 
>>>> lower versions.//
>>>> /
>>>> /if i use Android 19 to compile the codes that invoke srand(), 
>>>> because srand() is a static inline function, so it will invoke 
>>>> srand48 instead, which means cocos2d-x depends on srand48 instead 
>>>> of srand. srand48 is defined in all Android versions, so there is 
>>>> not problem.//
>>>> //i using Android 21+ to compiling the codes, srand() is defined 
>>>> like void srand(unsigned int);, so cocos2d-x depends on srand. 
>>>> Because srand is not defined below Android 21, so it will have 
>>>> problem if running on Android version below 21.//
>>>> /
>>>> My tablet has android 4.2.2, which should be ok with api version 
>>>> 21, I would think.
>>> Ah 4.2.2.
>>>
>>> I have a "special" build mode.
>>>
>>> ./makelibs.sh --oldarm all
>>> ./mythbuild --oldarm
>>>
>>> It did work for me for 4.2.2 and 4.4 like my projector and my TV. 32 
>>> bit only build too.
>>>
>>> I just noticed that there may be some inconsistencies between 
>>> makelibs and mythbuild for ANDROID_NATIVE_API_LEVEL.
>>> That may (or not) need to be resolved.
>>>
>>> Also this is untested with newer lib additions as yet.
>>>
>>> HTH
>>> Mark
>>>
>> Hi Mark
>>
>> --oldarm successfully compiled and installed after a couple of tweaks.
>>
>> Now it fails with
>>
>> D/dalvikvm( 9979): Trying to load lib 
>> /data/data/org.mythtv.mythfrontend/qt-reserved-files/plugins/platforms/android/libqtforandroid.so 
>> 0x4212fc50
>> E/dalvikvm( 9979): 
>> dlopen("/data/data/org.mythtv.mythfrontend/qt-reserved-files/plugins/platforms/android/libqtforandroid.so") 
>> failed: Cannot load library: soinfo_link_image(linker.cpp:1636): 
>> could not load library "libfreetype.so" needed by 
>> "libqtforandroid.so"; caused by load_library(linker.cpp:746): library 
>> "libfreetype.so" not found
>>
>> I checked, libfreetype.so does exist in 
>> /data/data/org.mythtv.mythfrontend/lib/
>> It is the correct file type
>> peter at andromeda:~$ file 
>> '/home/peter/proj/github.com/MythTV/packaging/android/mythinstallold/libs/armeabi-v7a/libfreetype.so'
>> /home/peter/proj/github.com/MythTV/packaging/android/mythinstallold/libs/armeabi-v7a/libfreetype.so: 
>> ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), 
>> dynamically linked, interpreter /system/bin/linker, stripped
>>
>> Perhaps it is supposed to be in directory 
>> /data/data/org.mythtv.mythfrontend/qt-reserved-files/plugins/platforms/android/ 
>> where that libqtforandroid.so is found.
>>
>> Adding to my confusion is the fact that in the apk we do not deploy a 
>> file called 
>> qt-reserved-files/plugins/platforms/android/libqtforandroid.so - we 
>> actually deploy 
>> lib/armeabi-v7a/libplugins_platforms_android_libqtforandroid.so and 
>> by some magic it maybe gets renamed and moved, or possibly just linked.
>>
>> On android the file 
>> /data/data/org.mythtv.mythfrontend/libplugins_platforms_android_libqtforandroid.so 
>> exists and can be listed.
>> I am unable to list 
>> /data/data/org.mythtv.mythfrontend/qt-reserved-files/plugins/platforms/android/, 
>> I get Permission denied.
>>
>> If you don't know what is going on here, no worry this is not 
>> important, just something I am trying for interest and learning.
> On android you cant have a deep lib directory. I has to be 
> shallow/flat. So I came up with the above flattening schema to allow 
> plugins to be distinct (also filters).
> However freetype should be there since it's build and deployed.
> I havent build oldarm for a while esp. since the external lib 
> refactor. Ill investigate.
>
> Note: I am learning too. I haven't done much of importance/large with 
> android except this. If it looks like I know what I'm doing then I've 
> pulled the wool over your eyes well.
>
> Mark

I did have to remove "android:banner="@drawable/banner" from the 
Manifest to get it to create the package with --oldarm
See attached patch.

Peter

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20180810/458d01e6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20180810_android_old_package.patch
Type: text/x-patch
Size: 841 bytes
Desc: not available
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20180810/458d01e6/attachment.bin>


More information about the mythtv-dev mailing list