Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. OpenGLES test project on Android fails to compile
Forum Updated to NodeBB v4.3 + New Features

OpenGLES test project on Android fails to compile

Scheduled Pinned Locked Moved Solved Mobile and Embedded
opengl esandroidcompile-error
4 Posts 2 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Metadr
    wrote on 4 Feb 2016, 22:31 last edited by Metadr 2 Apr 2016, 22:33
    #1

    I did all the configuration steps and provided every directory for jdk, sdk, ant & android ndk.
    I'm trying now to compile a simple test project which builds and run fine while compiling it with the desktop compiler but fails on armv7 since "error: OpenGL.so: No such file or directory"

    extended error:

    23:25:11: Running steps for project OpenGL_ES2...
    23:25:11: Configuration unchanged, skipping qmake step.
    23:25:11: Starting: "D:\Qt\Tools\mingw492_32\bin\mingw32-make.exe" 
    D:\Android\android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -O2 -g -g -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -mthumb -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\OpenGL_ES2 -I. -ID:\Qt\5.5\android_armv7\include -ID:\Qt\5.5\android_armv7\include\QtOpenGL -ID:\Qt\5.5\android_armv7\include\QtWidgets -ID:\Qt\5.5\android_armv7\include\QtGui -ID:\Qt\5.5\android_armv7\include\QtCore -I. -isystem D:\Android\android-ndk-r10e\sources\cxx-stl\gnu-libstdc++\4.9\include -isystem D:\Android\android-ndk-r10e\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a\include -isystem D:\Android\android-ndk-r10e\platforms\android-9\arch-arm\usr\include -ID:\Qt\5.5\android_armv7\mkspecs\android-g++ -o controller.obj ..\OpenGL_ES2\controller.cpp
    In file included from ..\OpenGL_ES2\controller.cpp:1:0:
    ..\OpenGL_ES2\controller.h: In constructor 'MainWindow::MainWindow(QWindow*)':
    ..\OpenGL_ES2\controller.h:36:21: warning: 'MainWindow::m_context' will be initialized after [-Wreorder]
         QOpenGLContext *m_context;
                         ^
    ..\OpenGL_ES2\controller.h:35:21: warning:   'QSurfaceFormat* MainWindow::fmt' [-Wreorder]
         QSurfaceFormat *fmt;
                         ^
    ..\OpenGL_ES2\controller.cpp:3:1: warning:   when initialized here [-Wreorder]
     MainWindow::MainWindow(QWindow *parent) : QWindow(parent),
     ^
    D:\Android\android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ --sysroot=D:\Android\android-ndk-r10e/platforms/android-9/arch-arm/ -Wl,-soname,"libAndroid OpenGL.so" -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libAndroid OpenGL.so main.obj controller.obj moc_controller.obj   -LD:\Android\android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -LD:\Android\android-ndk-r10e/platforms/android-9/arch-arm//usr/lib -LD:/Qt/5.5/android_armv7/lib -lQt5OpenGL -Lc:\utils\android\ndk/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a -Lc:\utils\android\ndk/platforms/android-9/arch-arm//usr/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGLESv2 -lgnustl_shared -llog -lz -lm -ldl -lc -lgcc
    arm-linux-androideabi-g++: error: OpenGL.so: No such file or directory
    makefile:83: recipe for target 'libAndroid' failed
    mingw32-make: *** [libAndroid] Error 1
    23:25:13: The process "D:\Qt\Tools\mingw492_32\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project OpenGL_ES2 (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.5.1))
    When executing step "Make"
    23:25:13: Elapsed time: 00:02.
    

    here's the source.cpp:

    #include "controller.h"
    
    MainWindow::MainWindow(QWindow *parent) : QWindow(parent),
                                              m_context(0),
                                              fmt(new QSurfaceFormat)
    {
        setSurfaceType(QWindow::OpenGLSurface);
        //fmt->setRenderableType(QSurfaceFormat::OpenGLES);
        //fmt->setVersion(2,0);
        //fmt->setProfile(QSurfaceFormat::CoreProfile);
        //I'll need later fmt to try and set an alpha buffer on it
        fmt = new QSurfaceFormat(requestedFormat());
        resize(640,480);
    
        setFormat(requestedFormat());
    
        m_context = new QOpenGLContext(this);
        m_context->setFormat(requestedFormat());
        m_context->create();
    }
    
    
    void MainWindow::render()
    {
        if (!isExposed())  return;
        
            m_context->makeCurrent(this);
            initializeOpenGLFunctions();
    
            
        QTime t;
        t = QTime::currentTime();
        glClearColor(1, 0.5f, 0, 0.5f);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    
    
        m_context->swapBuffers(this);
        QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
    }
    

    Lastly the .pro file:

    TEMPLATE = app
    TARGET = Android OpenGL
    
    QT += core gui opengl
    
    SOURCES += \
        main.cpp \
        controller.cpp
    
    HEADERS += \
        controller.h
    
    CONFIG += mobility
    MOBILITY =
    

    Unfortunately this is the first time I try to build a project targeted for android and it all seems fine while compiling for desktop but it crashes on arm7
    Is something missing in the ndk? I don't even know where i'm supposed to place the missing opengl.so nor how to compile it

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 4 Feb 2016, 22:39 last edited by
      #2

      Hi and welcome to devnet,

      I'd remove the space between Android and OpenGL in your TARGET directive.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • M Offline
        M Offline
        Metadr
        wrote on 4 Feb 2016, 22:58 last edited by Metadr 2 May 2016, 00:02
        #3

        Awkward moment of the day I guess

        Quick unrelated question: Is it possible to have a format that can make the opengl application's background transparent?

        in the desktop it's sufficient to use :
        fmt->setAlphaBufferSize(8);
        for the desired effect

        Anyway, thanks a lot for your help

        EDIT: nevermind, I solved it. you only need to change the manifest and apply android:theme="@android:style/Theme.Translucent" to the application tag

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 5 Feb 2016, 21:06 last edited by
          #4

          Glad you found out and thanks for sharing !

          Since you have it working now please mark the thread as solved using the"Topic Tool" button so that other forum users may know a solution has been found :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          3/4

          4 Feb 2016, 22:58

          • Login

          • Login or register to search.
          3 out of 4
          • First post
            3/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved