Having a bit of trouble building APK on Ubuntu

Lubomir I. Ivanov neolit123 at gmail.com
Fri May 11 03:42:04 PDT 2018

CC-ing the developer mailing list

On 11 May 2018 at 13:08, 'Stephen Goodall' via Subsurface Divelog
<subsurface-divelog at googlegroups.com> wrote:
> Hi all,
> I've been trying to get the APK to build on Ubuntu and it's almost got to the end of the build.sh script. I got some errors that I think are c++ related, I have no experience with c++ so thought I'd check if there might be an obvious reason for the error. I think the warnings are ok, it's the undefined reference to stdout and mmap64 that have me puzzled:
> [ 68%] Building CXX object CMakeFiles/subsurface-mobile.dir/mobile-widgets/qmlmanager.cpp.o
> [ 68%] Building CXX object CMakeFiles/subsurface-mobile.dir/mobile-widgets/qmlprofile.cpp.o
> [ 69%] Building CXX object CMakeFiles/subsurface-mobile.dir/mobile-widgets/qml/kirigami/src/kirigamiplugin.cpp.o
> [ 70%] Building CXX object CMakeFiles/subsurface-mobile.dir/mobile-widgets/qml/kirigami/src/settings.cpp.o
> [ 70%] Building CXX object CMakeFiles/subsurface-mobile.dir/mobile-widgets/qml/kirigami/src/enums.cpp.o
> [ 71%] Building CXX object CMakeFiles/subsurface-mobile.dir/mobile-widgets/qml/kirigami/src/formlayoutattached.cpp.o
> [ 71%] Building CXX object CMakeFiles/subsurface-mobile.dir/mobile-widgets/qml/kirigami/src/mnemonicattached.cpp.o
> [ 72%] Building CXX object CMakeFiles/subsurface-mobile.dir/mobile-widgets/qml/kirigami/src/delegaterecycler.cpp.o
> [ 73%] Building CXX object CMakeFiles/subsurface-mobile.dir/mobile-widgets/qml/kirigami/src/desktopicon.cpp.o
> /home/stephen/src/subsurface/mobile-widgets/qml/kirigami/src/desktopicon.cpp: In member function 'virtual QSGNode* DesktopIcon::updatePaintNode(QSGNode*, QQuickItem::UpdatePaintNodeData*)':
> /home/stephen/src/subsurface/mobile-widgets/qml/kirigami/src/desktopicon.cpp:307:47: warning: conversion to 'int' from 'qreal {aka double}' may alter its value [-Wfloat-conversion]
>          const QSize itemSize(width(), height());
>                                                ^
> /home/stephen/src/subsurface/mobile-widgets/qml/kirigami/src/desktopicon.cpp:307:47: warning: conversion to 'int' from 'qreal {aka double}' may alter its value [-Wfloat-conversion]
> /home/stephen/src/subsurface/mobile-widgets/qml/kirigami/src/desktopicon.cpp: In member function 'void DesktopIcon::handleReadyRead(QNetworkReply*)':
> /home/stephen/src/subsurface/mobile-widgets/qml/kirigami/src/desktopicon.cpp:421:55: warning: conversion to 'int' from 'qreal {aka double}' may alter its value [-Wfloat-conversion]
>              const QSize size = QSize(width(), height()) * (window() ? window()->devicePixelRatio() : qApp->devicePixelRatio());
>                                                        ^
> /home/stephen/src/subsurface/mobile-widgets/qml/kirigami/src/desktopicon.cpp:421:55: warning: conversion to 'int' from 'qreal {aka double}' may alter its value [-Wfloat-conversion]
> [ 73%] Building CXX object CMakeFiles/subsurface-mobile.dir/mobile-widgets/qml/kirigami/src/libkirigami/basictheme.cpp.o
> [ 74%] Building CXX object CMakeFiles/subsurface-mobile.dir/mobile-widgets/qml/kirigami/src/libkirigami/kirigamipluginfactory.cpp.o
> [ 75%] Building CXX object CMakeFiles/subsurface-mobile.dir/mobile-widgets/qml/kirigami/src/libkirigami/platformtheme.cpp.o
> [ 75%] Building CXX object CMakeFiles/subsurface-mobile.dir/subsurface-mobile-main.cpp.o
> [ 76%] Building CXX object CMakeFiles/subsurface-mobile.dir/subsurface-mobile-helper.cpp.o
> [ 77%] Building CXX object CMakeFiles/subsurface-mobile.dir/qrc_mobile-resources.cpp.o
> [ 77%] Building CXX object CMakeFiles/subsurface-mobile.dir/qrc_kirigami.cpp.o
> [ 78%] Building CXX object CMakeFiles/subsurface-mobile.dir/subsurface-mobile_autogen/mocs_compilation.cpp.o
> [ 79%] Linking CXX shared library libsubsurface-mobile.so
> /home/stephen/src/libgit2-0.26.0/src/diff_print.c:739: error: undefined reference to 'stdout'
> /home/stephen/src/libgit2-0.26.0/src/unix/map.c:52: error: undefined reference to 'mmap64'
> collect2: error: ld returned 1 exit status
> make[2]: *** [libsubsurface-mobile.so] Error 1
> make[1]: *** [CMakeFiles/subsurface-mobile.dir/all] Error 2
> make: *** [all] Error 2
> I made a slight change to the script, is it worth raising a pull request to get that put in? Just a simple addition to the wget so it follows the GitHub redirect from API

AFAIK you are experiencing the problem of using GCC from the NDK
without defining some crazy pre-processor macros that the Android
developers though make sense to "enable" standard library symbols like
stdout, rand() mmap64. you could try Clang as from my experience these
types of errors were gone with Clang (but other things started

here are my recent attempts to get it building on the latest NDK with Clang:

i gave up and we went to the old NDK and BTW we reverted away from
Ubuntu Bionic as that was part of the problem.


More information about the subsurface mailing list