From OpenSCADAWiki
Jump to: navigation, search
Name Founded Status Members Icon
OpenSCADA adaption to the software platform "Android" February 2017 Implemented in these packages of the irregular building by Roman Savochenko for the branch Work and LTS:
  • OpenSCADA-{N}.apk — Android >= 5 (ABI 21, NDKr13)
At.png It is installable up to Android 12 ignoring the warnings and works.
  • OpenSCADA-{N}-ABI19.apk — Android 4.4 only (ABI 19, CrystaxNDKr10)
Roman Savochenko Logo-Android.png
Description
Purpose of the sub-project is to adapt the project OpenSCADA to run on the software platform Android which wide used on many mobile, TV, SmartWatch and other devices.
  • Managing task: by the link
  • State of the support: packs manually to the APK signed packages by NDKr13 (ABI 21, Android >= 5) and CrystaxNDKr10 (ABI 19, Android = 4.4), starts and works for both Web and Qt5
    • the VCA primitive "Document" displays XHTML only by QTextBrowser due to WebKit and Qt WebEngine are not implemented for Android and QtWebView is complex and QML one.
  • Difficulty, spent [compensated] time: 19 (Android) + 6 (OpenSCADA and core libs) + 6(Qt5) [0.21] days
  • User projects directory: "/sdcard/.openscada"
  • Known issues and most actual tasks (To Do):
- update the building environment to Android 10, unify and archive the old environments (the first try in the chroot Android_5_TRY.txz), append the building procedures by targets of automatic building the Android packages;
- build Qt6 with WebEngine and Multimedia support;
- append all external windows of the runtime mode of the module Vision for items of their closing and for centring.

1 Introduction

Android is an operation system initially developed by Android Inc., which Google bought in 2005, Android was unveiled in 2007, along with the founding of the Open Handset Alliance — a consortium of hardware, software, and telecommunication companies devoted to advancing open standards for mobile devices.

Android's kernel is based on one of the Linux kernel's long-term support (LTS) branches. Since April 2014, Android devices mainly use versions 3.4, 3.10 or 3.18 of the Linux kernel.

Android is far away from a Linux distribution by it does not include the GNU C Library (it uses Bionic as an alternative C library) and some of other components typically found in Linux distributions. Moreover it has a graphical and application stack built on Java VM which excludes initially writing any other program than on the Java language. But in the performance reason JNI uses here to link external native libraries written on C/C++ by a native development kit (NDK). But the LibC Bionic and the core libraries are mostly POSIX compatible. Due many lacks and limitations in the original Android NDK there was used an user expanded one CrystaX NDK, but the last stable version of CrystaX NDK based on NDK r10 and on the task time there was available the original version r13, where many lacks resolved but the native functions of locales still lack.

For the developers Google provides Android software development kit (SDK). All projects written to build by Android Development Tools (ADT) and the IDE Eclipse allowed to the packages assemble from the command line and then can be automated, but new projects (see to the current samples) written on/for Android Studio can be built only from the environment and without the command line using. The sub-project was implemented and tested on Asus Nexus 7 II with the original Android 4.4.4 (Krait) then there was used Andoid-19 SDK version.

Before an action for same OpenSCADA adaption there were read some books, learned some links, created several examples and executed some tests, those are:

  • Read books:
  • Learned links:
  • Built examples from the books, links and Qt5:
    • By ADT in the command line or Eclipse IDE: "san-angeles" (sample), "Store", "DroidBlaster", "LiveCamera", "PortingExecutable", "PortingExecutableBuildSystem", PortingExecutableAUI
    • By Android Studio: "native-activity" (sample), "Store"
    • Qt5 examples: "analogclock", "calculator", "charactermap", "icons", "styles".
  • Built and executed for tests of features of the system:
    • arm_test.cpp — alignment tests of the ARM architecture;
    • locale_test.cpp — time tests with a time zone or UTC;
    • precision_test.cpp — tests for precision of the tasks scheduling (SCHED_RR) in realtime;
    • printf.cpp — tests for performance of different locks: direct RW lock to RD and RW, RW lock wrapped to an object, direct mutex, mutex wrapped to an object.
    • string.cpp — tests for some operations on STL string with exceptions processing.
    • task_test.cpp — tests for threads.

Due to the method of linking of native programs is the primarily and exclusively only through JNI by connecting a share library then all dependent code of the program must be placed and pre-loaded in shared libraries against the common one or builtin as the static parts to the common one. Placing and loading the dependent code as the shared libraries will cause to extra memory consumption since it will be exclusively the libraries of the program, So, compiling the dependent libraries of the program as the static ones is a preferred way for Android!

2 Android

The Android SDK+NDK deploying tree and environment are as follows:

\-- [HOME]/
    |-- .android/*      => generic Android configuration
       \-- {user}.jks   => key of the user for signing by jarsigner
    |-- Android/*       => main data with SDK and NDK
    \-- .profile        => the additional environments:
                           export ANDROID_SDK="~/Android/Sdk"
                           export ANDROID_NDK="~/Android/Ndk"
                           export PATH="${ANDROID_SDK}/tools:${ANDROID_SDK}/platform-tools:${ANDROID_NDK}:${PATH}"

From the additional packages there must be installed: JDK, ant

At.png To prevent errors "[javac] error: Source option 6 is no longer supported. Use 7 or later." with updating version JDK we need to rise it in file "Android/Sdk/tools/ant/build.xml" both for the "java.target" and "java.source" properties.

3 OpenSCADA

To simplify and early prepare OpenSCADA to JNI in all its parts there decided to build the program as a native executable and start it from the command-line. Then:

  • To prepare a standalone toolchain for CrystaxNDK r10 there is used the command:
    /home/roman/Android/Ndk/build/tools/make-standalone-toolchain.sh --platform=android-19 --install-dir=./TestTCH \
      --system=linux-x86_64 --arch=arm --toolchain=arm-linux-androideabi-5
    
    • To init the compiler and the linker there forms an environment preparing script with the SoftFloat and HardFloat flags:
      #!/bin/bash
      
      TARGET=arm-linux-androideabi
      PROJECT=TestTCH
      PRJROOT=/home/roman/Android/$PROJECT
      
      #Soft float
      #export CFLAGS="-O2 -ffunction-sections -funwind-tables -no-canonical-prefixes\
      # -march=armv5te -mfloat-abi=softfp -mfpu=neon -mthumb\
      # -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wa,--noexecstack -Wformat -Werror=format-security"
      #export LDFLAGS="-Wl,--fix-cortex-a8"
      #Hard float
      export CFLAGS="-O2 -ffunction-sections -funwind-tables -no-canonical-prefixes\
       -march=armv7-a -mfpu=neon -mhard-float\
       -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wa,--noexecstack -Wformat -Werror=format-security"
      export LDFLAGS="-llog -landroid -Wl,--no-warn-mismatch -lm_hard -Wl,--fix-cortex-a8"
      
      export CXXFLAGS="$CFLAGS -fexceptions -frtti"
      
      PREFIX=$PRJROOT
      export PKG_CONFIG_PATH=$PREFIX/sysroot/usr/lib/pkgconfig
      export PATH=$PREFIX/bin:$PATH
      
      #Extended for not autotool
      export CC=$TARGET-gcc
      export LD=$TARGET-ld
      export AS=$TARGET-as
      export AR=$TARGET-ar
      
  • To initiate the compiler directly in the CrystaxNDK r10 tree with the SoftFloat and HardFloat flags:
    #!/bin/bash
    
    NDK_PATH=/home/roman/Android/Ndk
    HOST=linux-x86_64
    TARGET=arm-linux-androideabi
    PLATFORM=android-19
    PLATFORM_LIB_VAR=armeabi-v7a
    TARGET_V=5
    PREFIX=$NDK_PATH/toolchains/$TARGET-$TARGET_V/prebuilt/$HOST
    
    #Soft float
    # -march=armv5te -mfloat-abi=softfp -mfpu=neon -mthumb\
    export CFLAGS="-O2 -ffunction-sections -funwind-tables -no-canonical-prefixes\
     -march=armv7-a -mfloat-abi=softfp -mfpu=vfp\
     -fno-builtin-memmove -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wa,--noexecstack -Wformat -Werror=format-security"
    export LDFLAGS="-llog -landroid -Wl,--fix-cortex-a8"
    #Hard float
    #export CFLAGS="-O2 -ffunction-sections -funwind-tables -no-canonical-prefixes\
    # -march=armv7-a -mfpu=vfp -mhard-float\
    # -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wa,--noexecstack -Wformat -Werror=format-security"
    #export LDFLAGS="-llog -landroid -Wl,--no-warn-mismatch -lm_hard -Wl,--fix-cortex-a8"
    # -Wl,--no-undefined"
    
    export CFLAGS="$CFLAGS --sysroot=$NDK_PATH/platforms/$PLATFORM/arch-arm/ -I$NDK_PATH/sources/crystax/include\
     -I$NDK_PATH/sources/pcre/include\
     -I$NDK_PATH/sources/openssl/include\
     -I$NDK_PATH/sources/expat/include\
     -I$NDK_PATH/sources/libpng/include\
     -I$NDK_PATH/sources/libjpeg/include\
     -I$NDK_PATH/sources/freetype/include\
     -I$NDK_PATH/sources/fontconfig/include\
     -I$NDK_PATH/sources/libgd2/include\
     -I$NDK_PATH/sources/fftw3/include\
     -I$NDK_PATH/sources/libiconv/include\
     -I$NDK_PATH/sources/gettext/include\
     -I$NDK_PATH/sources/sqlite/include"
    export LDFLAGS="$LDFLAGS -L$NDK_PATH/sources/crystax/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/pcre/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/openssl/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/expat/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/libpng/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/libjpeg/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/freetype/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/fontconfig/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/libgd2/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/fftw3/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/libiconv/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/gettext/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/sqlite/libs/$PLATFORM_LIB_VAR"
    export CXXFLAGS="$CFLAGS -std=c++11 -I$NDK_PATH/sources/cxx-stl/gnu-libstdc++/$TARGET_V/include\
     -I$NDK_PATH/sources/cxx-stl/gnu-libstdc++/$TARGET_V/libs/$PLATFORM_LIB_VAR/include\
     -L$NDK_PATH/sources/cxx-stl/gnu-libstdc++/$TARGET_V/libs/$PLATFORM_LIB_VAR -lgnustl_shared"
    #-lgnustl_static -fexceptions -frtti"
    
    # export PKG_CONFIG="pkg-config --static"
    export PKG_CONFIG_PATH=$NDK_PATH/sources/pkgconfig
    export PATH=$PREFIX/bin:$PATH
    
    #Extended for not autotool
    export CC=$TARGET-gcc
    export LD=$TARGET-ld
    export AS=$TARGET-as
    export AR=$TARGET-ar
    
  • To initate the compiler directly for NDK r13 tree with the SoftFloat and HardFloat flags:
    #!/bin/bash
    
    NDK_PATH=/home/roman/Android/Ndk
    HOST=linux-x86_64
    TARGET=arm-linux-androideabi
    PLATFORM=android-21
    PLATFORM_LIB_VAR=armeabi-v7a
    TARGET_V=4.9
    PREFIX=$NDK_PATH/toolchains/$TARGET-$TARGET_V/prebuilt/$HOST
    
    #Soft float
    # -march=armv5te -mfloat-abi=softfp -mfpu=neon -mthumb\
    export CFLAGS="-O2 -ffunction-sections -funwind-tables -no-canonical-prefixes\
     -march=armv7-a -mfloat-abi=softfp -mfpu=vfp\
     -fno-builtin-memmove -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wa,--noexecstack -Wformat -Werror=format-security"
    export LDFLAGS="-llog -landroid -lm -Wl,--fix-cortex-a8"
    #Hard float
    #export CFLAGS="-O2 -ffunction-sections -funwind-tables -no-canonical-prefixes\
    # -march=armv7-a -mfpu=vfp -mhard-float\
    # -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wa,--noexecstack -Wformat -Werror=format-security"
    #export LDFLAGS="-llog -landroid -Wl,--no-warn-mismatch -lm_hard -Wl,--fix-cortex-a8"
    # -Wl,--no-undefined"
    
    export CFLAGS="$CFLAGS --sysroot=$NDK_PATH/platforms/$PLATFORM/arch-arm/\
     -I$NDK_PATH/sources/pcre/include\
     -I$NDK_PATH/sources/openssl/include\
     -I$NDK_PATH/sources/expat/include\
     -I$NDK_PATH/sources/libpng/include\
     -I$NDK_PATH/sources/libjpeg/include\
     -I$NDK_PATH/sources/freetype/include\
     -I$NDK_PATH/sources/fontconfig/include\
     -I$NDK_PATH/sources/libgd2/include\
     -I$NDK_PATH/sources/fftw3/include\
     -I$NDK_PATH/sources/libiconv/include\
     -I$NDK_PATH/sources/gettext/include\
     -I$NDK_PATH/sources/sqlite/include"
    export LDFLAGS="$LDFLAGS\
     -L$NDK_PATH/sources/pcre/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/openssl/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/expat/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/libpng/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/libjpeg/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/freetype/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/fontconfig/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/libgd2/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/fftw3/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/libiconv/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/gettext/libs/$PLATFORM_LIB_VAR\
     -L$NDK_PATH/sources/sqlite/libs/$PLATFORM_LIB_VAR"
    export CXXFLAGS="$CFLAGS -std=c++11 -I$NDK_PATH/sources/cxx-stl/gnu-libstdc++/$TARGET_V/include\
     -I$NDK_PATH/sources/cxx-stl/gnu-libstdc++/$TARGET_V/libs/$PLATFORM_LIB_VAR/include\
     -L$NDK_PATH/sources/cxx-stl/gnu-libstdc++/$TARGET_V/libs/$PLATFORM_LIB_VAR -lgnustl_shared"
    
    # export PKG_CONFIG="pkg-config --static"
    export PKG_CONFIG_PATH=$NDK_PATH/sources/pkgconfig
    export PATH=$PREFIX/bin:$PATH
    
    #Extended for not autotool
    export CC=$TARGET-gcc
    export LD=$TARGET-ld
    export AS=$TARGET-as
    export AR=$TARGET-ar
    
  • Before same OpenSCADA compile we need compile:
    • the PCRE library by the command:
      ./configure --host=arm-linux-androideabi --disable-cpp --enable-utf8 --enable-pcre16 --enable-unicode-properties
      
    • the OpenSSL by the command:
      ./Configure -DOPENSSL_NO_HEARTBEATS no-shared no-idea no-mdc2 no-rc5 no-zlib enable-tlsext no-ssl2 no-ssl3 os/compiler:arm-linux-androideabi-
      make depend; make
      
  • Call and compile OpenSCADA configuration by the command:
    ./configure --host=arm-linux-androideabi --prefix=/data/data/org.oscada --bindir=/data/data/org.oscada/bin \
      --sysconfdir=/data/data/org.oscada --datarootdir=/data/data/org.oscada CoreLibNmToDlOpen=liboscada.so \
      --disable-CoreLibVersion --disable-AllModuls --enable-SQLite=incl --enable-DBF=incl --enable-Sockets=incl \
      --enable-Serial=incl --enable-SSL --enable-SelfSystem=incl --enable-UserProtocol=incl --enable-HTTP=incl \
      --enable-JavaLikeCalc=incl --enable-LogicLev=incl --enable-BlockCalc=incl --enable-System --enable-OPC_UA \
      --enable-DAQGate=incl --enable-ModBus=incl --enable-DCON=incl --enable-FSArch=incl --enable-DBArch=incl \
      --enable-VCAEngine --enable-WebCfg --enable-WebCfgD --enable-WebVision --enable-WebUser --enable-FLibSYS=incl \
      --enable-SystemTests --enable-FLibMath --enable-FLibComplex1 --with-qt5=yes --enable-QtMainThrd --enable-QTStarter \
      --enable-QTCfg --enable-Vision
    
  • Copy files "openscada", "liboscada.so.3", "libcrystax.so", "spec_SystemTests.so", "oscada.xml", "icons/*.png" to "/data/data/openscada/".
  • Start:
    LD_PRELOAD=./libcrystax.so LD_LIBRARY_PATH="./:${LD_LIBRARY_PATH}" ./openscada --config=./oscada.xml
    

Current compiling and adapting status of the OpenSCADA core, it parts and the dependent libraries condensed and placed to the next table:

Part

Compiling
standalone executable
Qt5 and JNI CrystaxNDKr10
Original NDK r13 ABI21
(Builtin for modules)

Tests Commentaries and problems
The dependent libraries
PCRE, for the core OK OK OK Configuring command:
./configure --host=arm-linux-androideabi --disable-cpp --enable-utf8 --enable-pcre16 \
  --enable-unicode-properties
OpenSSL, for: Transport.SSL, DAQ.OPC_UA, Special.FLibSYS (opt) OK OK OK Configuring command:
./Configure -DOPENSSL_NO_HEARTBEATS no-shared no-idea no-mdc2 no-rc5 no-zlib enable-tlsext \
  no-ssl2 no-ssl3 os/compiler:arm-linux-androideabi- ${CFLAGS} ${LDFLAGS}
make depend; make
LibGD, for: the core (opt), UI.WebCfgD (opt), UI.WebVision OK OK OK Dependent from: libpng, jpeg, freetype, fontconfig

Also has links to macro __GNUC_PREREQ which missed on Android => a workaround placed to "features.h":

#ifndef __GNUC_PREREQ
# define __GNUC_PREREQ(maj, min) 1
#endif

Configuring command:

./configure --host=arm-linux-androideabi --prefix=/usr --sysconfdir=/etc --without-vpx \
  --without-tiff --without-xpm
-> libpng OK OK OK A version of "libpng" used from CrystaX and built for Original NDK r13 by a configuring command:
./configure --host=arm-linux-androideabi --without-libpng-compat
-> jpeg OK OK OK A version of "libjpg" used from CrystaX. and built for Original NDK r13 by a configuring command:
./configure --host=arm-linux-androideabi
--> expat OK OK OK Configuring command:
./configure --host=arm-linux-androideabi
--> freetype OK OK OK Configuring command:
LIBPNG_LDFLAGS="-I/home/roman/Android/Ndk/sources/libpng/include/libpng16" \
  LIBPNG_LDFLAGS="-L/home/roman/Android/Ndk/sources/libpng/libs/armeabi-v7a -lpng -lm -lz" \
  ./configure --host=arm-linux-androideabi --without-bzip2 --disable-shared
-> fontconfig OK OK OK Configure for proper folders of the fonts. Configuring command:
./configure --host=arm-linux-androideabi --disable-docs --with-cache-dir=/cache/fontconfig \
  --with-default-fonts=/system/fonts
libfftw3, for UI.{Vision,WebVision} (opt), Special.FLibSYS (opt) OK OK OK Configuring command:
./configure --host=arm-linux-androideabi
libiconv, for the core (opt) OK OK OK Successful built and used an external library. Configuring command:
./configure --host=arm-linux-androideabi --enable-static

Builtin one in CrystaX is wrong and unfinished.

libintl (gettext), for the core (opt) OK OK OK configure.ac fixed for checking the symbol libintl_bindtextdomain in the library "libintl" and the symbol "libiconv_open" in the library "libiconv" checking before.

Successful built and used the external "libiconv".
Need for "iconv" implementation but it is broken in CrystaX:
CRYSTAX_PANI: issetugid() not implemented!!!
Configuring command:

./configure --host=arm-linux-androideabi --disable-java --disable-native-java \
  --disable-largefile --enable-threads=posix --disable-rpath --disable-c++ \
  --disable-libasprintf --disable-acl --disable-openmp --disable-curses
libcrypt (GlibC), for the core (opt)  ?
libQt5, for UI.{QTStarter,QTCfg,Vision} OK OK OK Too specific for configuration and have some building's bugs, then it has fixed and adapted to architecture "armeabi-v7a-hard", for details see here. Due the problems with armeabi-v7a-hard the building was fully switched to armeabi-v7a but with parameters "-march=armv7-a -mfloat-abi=softfp -mfpu=vfp"!

Configuring command (hard-float):

./configure -prefix /home/roman/Android/Ndk/sources/qt5 -recheck-all -opensource \
  -confirm-license -xplatform android-g++ -nomake tests -nomake examples \
  -android-ndk /home/roman/Android/Ndk -android-sdk /home/roman/Android/Sdk \
  -android-ndk-host linux-x86_64 -android-toolchain-version 5 -android-ndk-platform android-19 \
  -android-arch armeabi-v7a-hard -skip qttranslations -skip qtwebkit -skip qtserialport \
  -skip qtwebkit-examples -no-warnings-are-errors -system-libjpeg -system-libpng \
  -system-freetype -fontconfig

Most the patched problems of building Qt5 has for Crystax NDK r10 and has not for Original NDK r13.
ACTUAL for Qt5.11.3: Configuring command (soft-float):

# Obtaining
git clone git://code.qt.io/qt/qt5.git qt5.11
cd qt5.11
perl init-repository
git checkout v5.11.3
git submodule update --recursive
# Building
./configure -prefix /home/roman/Android/Ndk/sources/qt5 -recheck-all -opensource \
  -confirm-license -xplatform android-g++ -nomake tests -nomake examples \
  -android-ndk /home/roman/Android/Ndk -android-sdk /home/roman/Android/Sdk \
  -android-ndk-host linux-x86_64 -android-toolchain-version 4.9 \
  -android-ndk-platform android-19 -android-arch armeabi-v7a -skip qttranslations \
  -skip qtserialport -no-warnings-are-errors -no-pulseaudio -no-alsa -skip qtspeech
make; make install
OpenSCADA
Generic and the core library OK OK OK
  • Test for some different to C(EN) locale => successful for uk_UA.UTF-8.
  • Move the project AGLKS files to the device and try it from UI.WebVision.
  • Build mostly modules of OpenSCADA as separated "SO" and move them to a different folder.
  • Move all files of OpenSCADA to a separated folder. Prepare an environment to open external modules of OpenSCADA on an example of the module Special.SystemTests.
  • Performance tests executing for different options of the compiler.
  • Make the performance tests without "-mthumb".
  • Mostly modules included/builtin to the OpenSCADA core library.
  • The "pthread" library checking added by a macro AX_PTHREAD.
  • Core libraries moved from direct pointing to checking, for: -lm, -ldl, -lcrypt, -lz, -lpcre.
  • Some conditional definitions added for the program code:
    • ResAlloc: Checking and defininition "__GLIBC_PREREQ" due to in Android the LibC implementation Bionic is; pthread_condattr_setclock() disabled for Android;
    • SYS: Needed parts moved from ieee754.h to the same file.
    • SYS: Multi CPU management and pthread_attr_setinheritsched() disabled for Android.
    • Mess: Messages encoding disabled for charset "US-ASCII", it's default one on Android.
    • Security: libcrypt checking expanded for crypt.h and to locked using for the function crypt().
    • Schedule: The core library name is pointed straight in dlopen() for included/builtin modules due to Bionic is wrong for the typical "NULL" in GLibC, by the definition "CoreLibNmToDlOpen".
DB.SQLite OK OK OK
  • Execute the DB tests.
  • Configure to store configuration here.
A version of "libpng" used from CrystaX and built for Original NDK r13 by a configuring command for version 3.8.7.1:
./configure --host=arm-linux-androideabi --enable-threadsafe --disable-amalgamation \
  --enable-load-extension --disable-tcl --enable-static
DB.DBF OK OK OK Execute the DB tests.
DAQ.JavaLikeCalc OK OK OK Performance tests.
DAQ.LogicLev OK OK OK -
DAQ.BlockCalc OK OK OK -
DAQ.DAQGate OK OK OK -
DAQ.System OK OK OK (as a module) Create an automatic controller object and see for what sources are allowed. Allowed types of sensors: "CPU", "Net statistic", "Memory", "HDD statistic", "Up time".
DAQ.ModBus OK OK OK -
DAQ.DCON OK OK OK -
DAQ.OPC_UA OK OK OK (as a module) Create an input transport, an endpoint and connect remotely to it. Adapted to include/builtin in the OpenSCADA core.
Archive.FSArch OK OK OK -
Archive.DBArch OK OK OK -
Transport.Sockets OK OK OK Configure an input transport to remote connect to it. The function getservbyname_r() switched to getservbyname() for Android.
Transport.Serial OK OK OK (as a module) - Checking for linux/serial.h added and for linux/i2c-dev.h fixed.
Transport.SSL OK OK OK Configure an input transport to remote connect to it.
  • "/tmp" folder missed then we must use some other here but tmpnam() uses itself => switched to a local file for Android.
  • The function getservbyname_r() switched to getservbyname() for Android.
Protocol.SelfSystem OK OK OK Remote connect to it. The dependence to "libcrypto" of OpenSSL moved to be optional.
Protocol.UserProtocol OK OK OK -
Protocol.HTTP OK OK OK -
UI.VCAEngine OK OK OK (as a module)
UI.QTStarter OK OK OK (as a module) Adapt to start up from JNI.
UI.QTCfg OK OK OK (as a module)
UI.Vision OK OK OK (as a module)
UI.WebCfg OK OK OK (as a module)
UI.WebCfgD OK OK OK (as a module) Move the images to the OpenSCADA folder and try its and the module. A strong dependence from GD removed.
UI.WebVision OK OK OK (as a module) The library LibGD test on a trend of the primitive "Diagram" and a widget of the primitive "ElFigure" of the project AGLKS. Dependence to LibGD expanded by: -lpng -ljpeg -lfontconfig -lexpat -lfreetype
UI.WebUser OK OK OK (as a module)
Special.FLibSYS OK OK OK - Conditional test and using to SSL, for md5().
Special.SystemTests OK OK OK (as a module)
Special.FLibMath OK OK OK (as a module) Performance tests.
Special.FLibComplex1 OK OK OK (as a module)

In the process of adaptation OpenSCADA to work on Android there was performed the significant approaches in the "autotool" based build environment OpenSCADA which can help further for adaption to work on other software platforms:

  • Generic cleaning.
  • Common adaption for static linking with the dependent libraries.
  • The "pthread" library checking by a macro AX_PTHREAD but it's too different on the like kind software environments.
  • Core libraries moved from direct pointing to checking, for: -lm, -ldl, -lcrypt, -lz, -lpcre. Which allows to pass libraries implemented in other system libraries and disable it at all in the correct way.

4 Qt5

Qt5 is a cross-platform GUI toolkit and framework which historically used by OpenSCADA only as the GUI toolkit in Qt-based modules. Qt5 is a complex one and it has different problems on different versions and building options. For build examples of Qt5 next procedure was used.

/home/roman/Android/Ndk/sources/qt5/bin/qmake
make
make install INSTALL_ROOT=/home/roman/Android/Projects/icons
/home/roman/Android/Ndk/sources/qt5/bin/androiddeployqt --output /home/roman/Android/Projects/icons
ant clean; ant debug

Followed table represents problems of different version of Qt5 represented on an example "icons":

Version Options Problems
5.7 soft-float Equal to versions 5.8 and 5.9 but have problems at installing where it tries install to "/var".
5.8 GCC 5 Font is normal in bookmarks of the file dialog. May be it is generic problem in 5.7 5.8, (GCC 4.9), 5.9.
5.7, 5.8, 5.9 hard-float All Qt icons miss or too small.
5.9 CrystaX NDK r10, GCC 5 Build error by StdLib C++ some difference:
src/mbgl/util/http_header.cpp: In function 'mbgl::optional<std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long long int> > > mbgl::http::parseRetryHeaders(mbgl::optional<std::__cxx11::basic_string<char> >&, mbgl::optional<std::__cxx11::basic_string<char> >&)':
src/mbgl/util/http_header.cpp:38:67: error: call of overloaded 'stoi(const std::__cxx11::basic_string<char>&)' is ambiguous
             auto secs = std::chrono::seconds(std::stoi(*retryAfter));
5.9.3 NDK r13, GCC 4.9 (standard) Crashes in calls QScrollArea::takeWidget(), fixed after in the builds 5.8.0, 5.9.7, 5.11.3
Up to 5.11.3 NDK r13, GCC 4.9 (standard) Does not propagate font from parent to QLineEdit and most widgets in dynamic, so the font must be set directly for dynamic widgets, and after that there can be problems yet.

5 Appending A. Extended performance tests on Asus Nexus7 II (Qualcomm Snapdragon APQ8064-1AA, Cortex-A15, 1.5 GHz, 4 Cores)

Test Operation sin(Pi), us , in JavaLikeCalc Operation pow(Pi,2), us , in JavaLikeCalc liboscada.so, MiB
armv5te, Soft, VFP2 0.9 1.58 0.15 0.88 13.79
armv5te, Soft, NEON 0.87 1.65 0.14 0.95 13.79
armv5te, Soft, NEON, Thumb 0.88 1.5 0.14 0.9 13
armv7-a, Soft, VFP 0.161 0.803 0.126 0.838 5.9
armv7-a, Hard, VFP2 0.162 0.776 0.138 0.844 13.85
armv7-a, Hard, NEON 0.168 0.793 0.123 0.854 13.85
armv7-a, Hard, NEON, Thumb 0.17 0.85 0.15 0.87 12.82

6 Appending B. List of the generic progress of the task

  • switched for building with the target and source version 1.7 of ant in the file "Sdk/tools/ant/build.xml" and by OpenJDK 17;
  • switched for building with the target and source version 1.6 of ant in the file "Sdk/tools/ant/build.xml" and by OpenJDK 11;
  • the default font "Helvetica,12,-1" with QScrollBar CSS rule are removed;
  • the environment variable QT_SCALE_FACTOR is set to 1.5;
  • fix the right mouse key emulation in the context-menu call from the runtime interface;
  • build the final signed package;
  • some Android specific expandings of the project OpenSCADA:
  • make the generic APK package including all DB (LibsDB, AGLKS, Boiler) and the function of OpenSCADA projects creation from the user;
  • perform some redesign for the main page of UI.QTStarter but the title image is too small for big resolutions of screens;
  • expand the module UI.QTStarter for the OpenSCADA projects management function;
  • expand for the module DAQ.System by the Android sensors;
> was made through QtSensors.
  • expand the projects manager of OpenSCADA to forcibly use the user project directory on the external storage;
  • Asus Nexus 7 2013: update to Android 5, 6 and try the OpenSCADA build for the original NDKr13 and ABI 21;
  • try and fit some styles and properties of Qt5 for Android;
  • append for the right mouse key emulation, holding the left one (original sensor screen touch) during about 2 seconds;
  • try for starting on Android 9 (Google Pixel XL).
  • OpenSCADA main functions related to Qt restore and fix: Qt5 builds with soft-float but hard-float causes the mostly problems; two branches were created, based on CrystaX NDK r10 (from ABI 19) and Original Ndk r13 (from ABI 21); default interface style was set to "fusion";
  • the Java package (APK) resolve for different data files placing and fill in by: OpenSCADA icon and main images, configuration files, files of translation of the interface, files of DB and other of the libraries and models;
  • adapt OpenSCADA to Qt5 on Android and build as a Java package (APK); get the program's locale from Java environment and set it to environment LANG;
  • build and observe an example of Qt5 as a Java package (APK);
  • initial build OpenSCADA with Qt5;
  • build Qt5: in the default configuration, with the early built libraries;
  • rebuild all already built parts in the original Ndk (outward the standalone one);
  • compile for needed external libraries: OpenSSL, SQLite, GD [expat,libpng,jpeg,fontconfig,freetype], intl, iconv;
  • compile for all OpenSCADA key modules to include/builtin them in the core;
  • make the performance tests for Soft and Hard float;
  • initially (minimum) build and execute OpenSCADA for console (without GUI): PCRE, OpenSCADA Core, builtin modules: Transport.Sockets, Protocol.SelfSystem, DAQ.JavaLikeCalc, Special.FLibMath;
  • compiling for tests, education and execution;
  • read a book about Android NDK, using of Android NDK and Crystalx-NDK;
  • purchase a modern internet tablet with Android.