Jump to content


Photo

Cross Compiling GCS


  • Please log in to reply
6 replies to this topic

#1 phil_w

phil_w

    Member

  • Members
  • PipPip
  • 20 posts
  • Country: flag of Australia Australia

Posted 22 May 2011 - 04:51 AM

Starting a new thread just for cross compiling issues in addtion to the general discussion on thread "GCS on hand held linux hardware with 7" LCD". Cross compiling is used to compile the GCS for embedded platforms.

This thread is to capture ideas/issues on cross compiling and not general discussion of hardware,platforms etc

Some general notes;
- Cross compile is done from the openpilotgcs.pro and not ground.pro. The reason is that uavobjectgenerator needs to be compiled on the host, ie not cross compiled, as it is used/run on the host PC to process the uavobject xml files.

notes copied from other thread on the first effort at doing a cross compile;

1/ Open GL had to be excluded from the compile. Embedded systems typically use Open GL ES so we should really make OpenGL a compile time option and not just selectable on the config page of the built software.

2/ GLC lib is excluded as it uses OpenGL and hence no Model view plugin.

3/ GCS control is excluded. Some compile error library issues with SDL gamepad, still need to be sorted out.

4/ rawHID was an issue as rawHID.pro had some code that looked for linux-g++. When cross compiling some sources and lib were missed, perhaps this needs to be changed to linux-*. I edited the code to force inclusion for cross compile.

also...
5/Notify plugin excluded at this stage...some more work needed on this to get the drivers sorted.

So if anyone has any ideas,concerns,issues specific to cross compiling please add your comments....please keep this thread for cross compiling and not general discussion of hardware,platforms etc.

Regards Phil

#2 peabody124

peabody124

    Banned

  • Banned
  • PipPipPip
  • 5870 posts
  • LocationHouston, TX
  • Country: flag of United States United States


Posted 22 May 2011 - 05:27 AM

I think it's great you are working on cross-compiling. There probably won't be as much interest on this as there should be, so my best suggestion would be to push us patches and we will merge them as possible.

To comment on your specific issues:

1/ Open GL had to be excluded from the compile. Embedded systems typically use Open GL ES so we should really make OpenGL a compile time option and not just selectable on the config page of the built software.

is there a cross-compatible way to write OpenGL/OpenGL ES. Will we just have to disable OpenGL on cross platform versions or can we make it work?

GLC lib is excluded as it uses OpenGL and hence no Model view plugin.

2) Patch to make this an easy compile time option (not sure good way to do on QT)

4/ rawHID was an issue as rawHID.pro had some code that looked for linux-g++. When cross compiling some sources and lib were missed, perhaps this needs to be changed to linux-*. I edited the code to force inclusion for cross compile.

If you want to try this switch out or post a patch we can see how it affects linux.

5/Notify plugin excluded at this stage...some more work needed on this to get the drivers sorted.

Does phonon work on embedded systems?

P.s. if you look like git access to work on this in a branch, PM corvuscorvax with you ssh public key.
Testing crumple zones

#3 phil_w

phil_w

    Member

  • Members
  • PipPip
  • 20 posts
  • Country: flag of Australia Australia

Posted 22 May 2011 - 10:38 AM

1/ Is there a cross-compatible way to write OpenGL/OpenGL ES.--ANS I think it would be a big job to allow for OpenGL ES and perhaps not worthwhile. So perhaps just a compile time option to exclude OpenGL is the way to go. I have not looked in detail at porting to OpenGL ES apart from running a test application that determines what needs to be modified. The app is called GLexamine, here is the output for GLC_lib;

/media/Projects/GLC_lib$ GLexamine
./glc_lib/geometry/glc_line.cpp:92: glBegin(GL_LINES);
./glc_lib/geometry/glc_point.cpp:108: glBegin(GL_POINTS);
./glc_lib/geometry/glc_pointsprite.cpp:110: glPushAttrib(GL_ALL_ATTRIB_BITS);
./glc_lib/geometry/glc_pointsprite.cpp:188: glBegin(GL_POINTS);
./glc_lib/sceneGraph/glc_3dviewinstance.cpp:312: glColor3ubv(m_colorId); // D'ont use Alpha component
./glc_lib/sceneGraph/glc_3dviewinstance.cpp:383: glColor3ubv(colorId);
./glc_lib/viewport/glc_imageplane.cpp:74: glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
./glc_lib/viewport/glc_imageplane.cpp:75: glBegin(GL_QUADS);
./glc_lib/viewport/glc_repcrossmover.cpp:89: glColor4d(m_MainColor.redF(), m_MainColor.greenF(), m_MainColor.blueF(), m_MainColor.alphaF());
./glc_lib/viewport/glc_repcrossmover.cpp:93: glBegin(GL_LINES);
./glc_lib/viewport/glc_viewport.cpp:117: glClearDepth(1.0f); // Depth Buffer Setup


2) rawHID.pro ... I can test this on my system. Should not be an issue, ie using linux-* instead of linux-g++


3/Notify, phonon Yes there is phonon, I just have not spent the time yet to sort that part out.

Note that when I excluded OpenGL from the build I also commented out calls to QGLWidget used in plugins when opengl is selected. Here is a list of the edits that I did to get it to compile, (PWedit is my marker), note the first one is the addition of the cross compiled qt libraries;

/ground/openpilotgcs/openpilotgcs.pri:# PWedit INCLUDEPATH to ARM qt and GL libraries at /opt/qt-arm/include
/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/opmapwidget.h://PWedit #include <QtOpenGL/QGLWidget>
/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapwidget.pro:#PWedit QT += opengl
/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/opmapwidget.cpp://PWedit setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));

/ground/openpilotgcs/src/plugins/dial/dialgadgetwidget.cpp://PWedit #include <QtOpenGL/QGLWidget>
/ground/openpilotgcs/src/plugins/dial/dialgadgetwidget.cpp://PWedit setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
/ground/openpilotgcs/src/plugins/dial/dial.pro:#PWedit QT += opengl

/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetwidget.cpp://PWedit #include <QtOpenGL/QGLWidget>
/ground/openpilotgcs/src/plugins/pipxtreme/pipxtremegadgetwidget.cpp://PWedit m_widget->graphicsView_Spectrum->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
/ground/openpilotgcs/src/plugins/pipxtreme/pipxtreme.pro:#PWedit QT += opengl
2/ground/openpilotgcs/src/plugins/rawhid/rawhid.pro:#PWedit for linux cross compile ie non linux-g++ sources and libs

/ground/openpilotgcs/src/plugins/lineardial/lineardialgadgetwidget.cpp://PWedit #include <QtOpenGL/QGLWidget>
/ground/openpilotgcs/src/plugins/lineardial/lineardialgadgetwidget.cpp://PWedit setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
/ground/openpilotgcs/src/plugins/lineardial/lineardial.pro:#PWedit QT += opengl

/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro:#PWedit QT += opengl
/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadget.h://PWedit #include "sdlgamepad/sdlgamepad.h"

/ground/openpilotgcs/src/plugins/gcscontrol/joystickcontrol.cpp://PWedit #include <QtOpenGL/QGLWidget>
/ground/openpilotgcs/src/plugins/gcscontrol/joystickcontrol.cpp://PWedit setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));

/ground/openpilotgcs/src/plugins/pfd/pfd.pro:#PWedit QT += opengl
/ground/openpilotgcs/src/plugins/pfd/pfdgadgetwidget.cpp://PWedit #include <QtOpenGL/QGLWidget>
/ground/openpilotgcs/src/plugins/pfd/pfdgadgetwidget.cpp://PWedit setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));


yes I have had git access setup. Thanks Phil

Edited by phil_w, 22 May 2011 - 11:02 AM.


#4 CheBuzz

CheBuzz

    Ex-Member

  • Banned
  • PipPipPip
  • 397 posts
  • Country: flag of United States United States


Posted 22 May 2011 - 06:31 PM

There are already plans to move OpenGL to be a global option. But I have no experience with using Qt for cross-compiling. I will have to look into how to do this.

#5 phil_w

phil_w

    Member

  • Members
  • PipPip
  • 20 posts
  • Country: flag of Australia Australia

Posted 23 May 2011 - 01:17 AM

What you do is cross compile the qt libraries first.

Here is the guide that I used;
http://treyweaver.blogspot.com/2010/10/setting-up-qt-development-environment.html

I used qt everywhere 4.6.3.

For gcs cross compile i did not use qt creator because I have found it hard to keep track of what it was using/doing. QT creator has some catches, eg it sometimes switches back to default build directory without you knowing, after you change a setting, it can also be hard to keep track of which mkspec it is using. Very annoying. So I just use qmake on the command line. I still use qt creator as editor but do build on command line.

Some warning, it may just be me, but setting this up takes a lot of time and fiddling!

There are already plans to move OpenGL to be a global option. But I have no experience with using Qt for cross-compiling. I will have to look into how to do this.


Edited by phil_w, 23 May 2011 - 01:18 AM.


#6 PT_Dreamer

PT_Dreamer

    GCS Core Developer

  • Members
  • PipPipPip
  • 1979 posts
  • LocationCaparica, Portugal
  • Country: flag of Portugal Portugal


Posted 24 May 2011 - 06:33 PM

After looking at Qt docs I don't see why QtOpenGL shouldn't work with OpenGL ES.


http://doc.qt.nokia....t/qtopengl.html
http://doc.qt.nokia....nux-opengl.html
Life is just a game, but atleast the graphics are awesome!

#7 phil_w

phil_w

    Member

  • Members
  • PipPip
  • 20 posts
  • Country: flag of Australia Australia

Posted 25 May 2011 - 01:36 AM

Some links;

http://www.khronos.org/opengles/

http://doc.qt.nokia.com/latest/opengl-hellogl-es.html


After looking at Qt docs I don't see why QtOpenGL shouldn't work with OpenGL ES.


http://doc.qt.nokia....t/qtopengl.html
http://doc.qt.nokia....nux-opengl.html