subsurface-mobile build error undefined reference to 'rand'

Dirk Hohndel dirk at hohndel.org
Wed Jun 21 21:34:09 PDT 2017


> On Jun 20, 2017, at 5:10 AM, Anton Lundin <glance at acc.umu.se> wrote:
> 
> On 20 June, 2017 - Rick Walsh wrote:
> 
>> On 20 June 2017 at 05:59, Anton Lundin <glance at acc.umu.se> wrote:
>> 
>>> The gcc toolchain we're using in the ndk is about to be deprecated, so
>>> we should focus on trying to switch over to clang.
>>> 
>>> In NDK 15 GCC is no longer supported:
>>> https://developer.android.com/ndk/downloads/revision_history.html
>> 
>> That sounds like a substantial change and I wish I could offer some help.
>> I'm not sure the problem with my setup is due to the gcc toolchain so much
>> as the ndk configuration.
>> 
> 
> Its about a jay big patch:
> 
> diff --git i/android-mobile/AndroidManifest.xml w/android-mobile/AndroidManifest.xml
> index ee035c1e..fe65502f 100644
> --- i/android-mobile/AndroidManifest.xml
> +++ w/android-mobile/AndroidManifest.xml
> @@ -127,8 +128,8 @@ export BUILDROOT=$PWD
> export PATH=${BUILDROOT}/ndk-$ARCH/bin:$PATH
> export PREFIX=${BUILDROOT}/ndk-$ARCH/sysroot/usr
> export PKG_CONFIG_LIBDIR=$PREFIX/lib/pkgconfig
> -export CC=${BUILDROOT}/ndk-$ARCH/bin/${BUILDCHAIN}-gcc
> -export CXX=${BUILDROOT}/ndk-$ARCH/bin/${BUILDCHAIN}-g++
> +export CC=${BUILDROOT}/ndk-$ARCH/bin/${BUILDCHAIN}-clang
> +export CXX=${BUILDROOT}/ndk-$ARCH/bin/${BUILDCHAIN}-clang++
> # autoconf seems to get lost without this
> export SYSROOT=${BUILDROOT}/ndk-$ARCH/sysroot
> export CFLAGS=--sysroot=${SYSROOT}
> 
> 
> 
> The only bits that doesn't build with clang is openssl. As far as I
> managed to google yesterday, it's fixed in openssl master, but I haven't
> tested that and I'm not sure we should go that path.
> 
> I haven't either checked if Qt will play nice with a something newer
> than openssl 1.0.
> 
> 
> One first step is to build everything else with clang, and continue
> building openssl with gcc.

Or, we could stay with gcc and just patch the stupid call to rand()
to instead call (int)lrand48() - that seemed So. Much. Easier.

Changes are pushed to master. A complete clean build from scratch
with latest master has been confirmed to work, and the latest APK
is actually build upon those latest sources:

http://subsurface-divelog.org/downloads/test/Subsurface-mobile-4.6.4.248-arm.apk

This one also adds another fix - adding white space at the bottom
of the DiveDetails view so that the action button no longer always
covers part of the notes.

We have made a lot of progress  :-)

(46 commits from me in the past week... vacation is a wonderful thing)

/D


More information about the subsurface mailing list