LibrePilot Forum

Development => Firmware General => Topic started by: andyp on March 27, 2021, 01:25:48 pm

Title: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andyp on March 27, 2021, 01:25:48 pm
I just tried to complile librepilot with Windows 10 and an error occured, as Python3 uses a different syntax that Python2. Therefore

/make/scripts/version-info.py

has to be ported to Python3. I tried it, but it was easier to use Python2, as there have to be many changed done.

Use

pacman -S mingw-w64-x86_64-python2

to install Python 2 on MSys64. Then go to C:\msys64\mingw64\bin folder or x32 folder and replace Python.exe with the version 2, which is available after installation.

Then the make process works with some warnings.
Title: Re: Compiling Librepilot in Windows 10 - port version-info.py to Python3
Post by: TheOtherCliff on March 29, 2021, 10:18:54 am
Good to know!

How much have you tested?  Does GCS run?  Can you use all the GCS pages?  Have you built / flashed / tested firmware?

A month ago I started the process of getting it building and running on a current Linux install.

After making some ?judicious? choices on versions of QT and Osg(Earth) and some obvious code changes, I got it building, but there are some things that will need more changes.  I got it working 100% (including OsgEarth) by copying over some old system libs here and linking new libraries to some old lib names there (a hack to see how far I could get) to fix the "missing lib popups" at startup and some missing entry points.

Without some old libs, OsgEarth segfaults IIRC.  Next step would be to narrow down which libs must be the old version to narrow down where in code the issues are.  And do a debug build to run it under a debugger.  As I recall, with OsgEarth disabled, GCS functions OK, but segfaults on exit.  Firmware builds fine.
Title: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andyp on April 01, 2021, 11:46:01 pm
You need to install gstreamer development tools as well

pacman -S mingw-w64-x86_64-gst-devtools

Now I am stuck here, seems like a problem in qwt_painter_command.h

compiling C:/msys64/home/admin/librepilot/ground/gcs/src/libs/qwt/src/qwt_date.cpp
compiling C:/msys64/home/admin/librepilot/ground/gcs/src/libs/qwt/src/qwt_date_scale_draw.cpp
compiling C:/msys64/home/admin/librepilot/ground/gcs/src/libs/qwt/src/qwt_date_scale_engine.cpp
compiling C:/msys64/home/admin/librepilot/ground/gcs/src/libs/qwt/src/qwt_dyngrid_layout.cpp
compiling C:/msys64/home/admin/librepilot/ground/gcs/src/libs/qwt/src/qwt_event_pattern.cpp
compiling C:/msys64/home/admin/librepilot/ground/gcs/src/libs/qwt/src/qwt_graphic.cpp
In file included from C:/msys64/home/admin/librepilot/ground/gcs/src/libs/qwt/src/qwt_graphic.cpp:11:
C:/msys64/home/admin/librepilot/ground/gcs/src/libs/qwt/src/qwt_painter_command.h:85:22: error: field 'clipPath' has incomplete type 'QPainterPath'
   85 |         QPainterPath clipPath;
      |                      ^~~~~~~~

In file included from C:/msys64/mingw64/include/QtGui/qtransform.h:43,
                 from C:/msys64/mingw64/include/QtGui/qimage.h:48,
                 from C:/msys64/mingw64/include/QtGui/qpixmap.h:49,
                 from C:/msys64/mingw64/include/QtGui/qpainter.h:48,
                 from C:/msys64/mingw64/include/QtGui/qpaintengine.h:47,
                 from C:/msys64/home/admin/librepilot/ground/gcs/src/libs/qwt/src/qwt_null_paintdevice.h:15,
                 from C:/msys64/home/admin/librepilot/ground/gcs/src/libs/qwt/src/qwt_graphic.h:14,
                 from C:/msys64/home/admin/librepilot/ground/gcs/src/libs/qwt/src/qwt_graphic.cpp:10:
C:/msys64/mingw64/include/QtGui/qmatrix.h:54:7: note: forward declaration of 'class QPainterPath'
   54 | class QPainterPath;
      |       ^~~~~~~~~~~~
mingw32-make[5]: *** [Makefile:1271: qwt_graphic.o] Error 1
mingw32-make[5]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs/qwt/src'
mingw32-make[4]: *** [Makefile:50: sub-src-make_first-ordered] Error 2
mingw32-make[4]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs/qwt'
mingw32-make[3]: *** [Makefile:317: sub-qwt-make_first-ordered] Error 2
mingw32-make[3]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs'
mingw32-make[2]: *** [Makefile:53: sub-libs-make_first-ordered] Error 2
mingw32-make[2]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src'
mingw32-make[1]: *** [Makefile:52: sub-src-make_first-ordered] Error 2
mingw32-make[1]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release'
mingw32-make: *** [Makefile:308: gcs] Error 2
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andyp on April 02, 2021, 12:31:10 am
This has also something to do with python2 and 3, the library gtgui has got a different version

I need to download another lib with msys, but I don't know what library at the moment, need more time ;-)
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andyp on April 02, 2021, 01:04:57 am
Everything has to do, that pacman is installing the newest packages.

Is there a way to install the toolchain from 2015?
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andyp on April 06, 2021, 11:15:02 pm
In file included from C:/msys64/home/admin/librepilot/ground/gcs/src/libs/qwt/src/qwt_graphic.cpp:11:
C:/msys64/home/admin/librepilot/ground/gcs/src/libs/qwt/src/qwt_painter_command.h:85:22: error: field 'clipPath' has incomplete type 'QPainterPath'
   85 |         QPainterPath clipPath;
      |                      ^~~~~~~~

In file included from C:/msys64/mingw64/include/QtGui/qtransform.h:43,
                 from C:/msys64/mingw64/include/QtGui/qimage.h:48,
                 from C:/msys64/mingw64/include/QtGui/qpixmap.h:49,

You need to exchange qwt with the newest lib.

C:/msys64/home/admin/librepilot/ground/gcs/src/libs/qwt/*

replace with https://github.com/opencor/qwt at least version 6.1.5 (6.1.4 is not working)

It is running, see what problems occur now. ;-)
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andyp on April 16, 2021, 12:24:59 pm
The solution of this problem, is that the path C:/msys64/mingw64/bin/osgPlugins-3.6.5 is hardcoded.

Copy or move all files from C:/msys64/mingw64/bin/osgPlugins-3.x.x to C:/msys64/mingw64/bin/osgPlugins-3.6.5.


cp -f "C:/msys64/mingw64/bin/osgPlugins-3.6.5/mingw_osgdb_jpeg.dll" "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/lib/librepilot-gcs/osg/osgPlugins-3.6.5/mingw_osgdb_jpeg.dll"
C:/msys64/mingw64/bin/python2 C:/msys64/home/admin/librepilot/make/copy_dependencies.py --dest "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/bin" --files "C:/msys64/mingw64/bin/osgPlugins-3.6.5/mingw_osgdb_jpeg.dll" --excludes OPENGL32.DLL > "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs/osgearth/deps/mingw_osgdb_jpeg.dll.deps"
cp -f "C:/msys64/mingw64/bin/osgPlugins-3.6.5/mingw_osgdb_osg.dll" "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/lib/librepilot-gcs/osg/osgPlugins-3.6.5/mingw_osgdb_osg.dll"
C:/msys64/mingw64/bin/python2 C:/msys64/home/admin/librepilot/make/copy_dependencies.py --dest "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/bin" --files "C:/msys64/mingw64/bin/osgPlugins-3.6.5/mingw_osgdb_osg.dll" --excludes OPENGL32.DLL > "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs/osgearth/deps/mingw_osgdb_osg.dll.deps"
cp -f "C:/msys64/mingw64/bin/osgPlugins-3.6.5/mingw_osgdb_png.dll" "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/lib/librepilot-gcs/osg/osgPlugins-3.6.5/mingw_osgdb_png.dll"
C:/msys64/mingw64/bin/python2 C:/msys64/home/admin/librepilot/make/copy_dependencies.py --dest "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/bin" --files "C:/msys64/mingw64/bin/osgPlugins-3.6.5/mingw_osgdb_png.dll" --excludes OPENGL32.DLL > "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs/osgearth/deps/mingw_osgdb_png.dll.deps"
cp -f "C:/msys64/mingw64/bin/osgPlugins-3.6.5/mingw_osgdb_tiff.dll" "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/lib/librepilot-gcs/osg/osgPlugins-3.6.5/mingw_osgdb_tiff.dll"
C:/msys64/mingw64/bin/python2 C:/msys64/home/admin/librepilot/make/copy_dependencies.py --dest "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/bin" --files "C:/msys64/mingw64/bin/osgPlugins-3.6.5/mingw_osgdb_tiff.dll" --excludes OPENGL32.DLL > "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs/osgearth/deps/mingw_osgdb_tiff.dll.deps"
cp -f "C:/msys64/mingw64/bin/osgPlugins-3.6.5/mingw_osgdb_zip.dll" "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/lib/librepilot-gcs/osg/osgPlugins-3.6.5/mingw_osgdb_zip.dll"
C:/msys64/mingw64/bin/python2 C:/msys64/home/admin/librepilot/make/copy_dependencies.py --dest "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/bin" --files "C:/msys64/mingw64/bin/osgPlugins-3.6.5/mingw_osgdb_zip.dll" --excludes OPENGL32.DLL > "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs/osgearth/deps/mingw_osgdb_zip.dll.deps"
cp -f "C:/msys64/mingw64/bin/osgPlugins-3.6.5/mingw_osgdb_serializers_osg.dll" "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/lib/librepilot-gcs/osg/osgPlugins-3.6.5/mingw_osgdb_serializers_osg.dll"
C:/msys64/mingw64/bin/python2 C:/msys64/home/admin/librepilot/make/copy_dependencies.py --dest "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/bin" --files "C:/msys64/mingw64/bin/osgPlugins-3.6.5/mingw_osgdb_serializers_osg.dll" --excludes OPENGL32.DLL > "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs/osgearth/deps/mingw_osgdb_serializers_osg.dll.deps"
cp -f "C:/msys64/mingw64/bin/libosgEarth.dll" "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/bin/libosgEarth.dll"
C:/msys64/mingw64/bin/python2 C:/msys64/home/admin/librepilot/make/copy_dependencies.py --dest "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/bin" --files "C:/msys64/mingw64/bin/libosgEarth.dll" --excludes OPENGL32.DLL > "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs/osgearth/deps/libosgEarth.dll.deps"
cp -f "C:/msys64/mingw64/bin/libosgEarthAnnotation.dll" "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/bin/libosgEarthAnnotation.dll"
C:/msys64/mingw64/bin/python2 C:/msys64/home/admin/librepilot/make/copy_dependencies.py --dest "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/bin" --files "C:/msys64/mingw64/bin/libosgEarthAnnotation.dll" --excludes OPENGL32.DLL > "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs/osgearth/deps/libosgEarthAnnotation.dll.deps"
C:/msys64/mingw64/bin/python2 C:/msys64/home/admin/librepilot/make/copy_dependencies.py --dest "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/bin" --files "C:/msys64/mingw64/bin/libosgEarthFeatures.dll" --excludes OPENGL32.DLL > "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs/osgearth/deps/libosgEarthFeatures.dll.deps"
C:/msys64/mingw64/bin/python2 C:/msys64/home/admin/librepilot/make/copy_dependencies.py --dest "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/bin" --files "C:/msys64/mingw64/bin/libosgEarthSymbology.dll" --excludes OPENGL32.DLL > "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs/osgearth/deps/libosgEarthSymbology.dll.deps"
cp -f "C:/msys64/mingw64/bin/libosgEarthUtil.dll" "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/bin/libosgEarthUtil.dll"
C:/msys64/mingw64/bin/python2 C:/msys64/home/admin/librepilot/make/copy_dependencies.py --dest "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/bin" --files "C:/msys64/mingw64/bin/libosgEarthUtil.dll" --excludes OPENGL32.DLL > "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs/osgearth/deps/libosgEarthUtil.dll.deps"
C:/msys64/mingw64/bin/python2 C:/msys64/home/admin/librepilot/make/copy_dependencies.py --dest "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/bin" --files "C:/msys64/mingw64/bin/libopenjp2-7.dll" --excludes OPENGL32.DLL > "C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs/osgearth/deps/libopenjp2-7.dll.deps"
mingw32-make[4]: *** No rule to make target 'C:/msys64/mingw64/bin/osgPlugins-3.6.5/mingw_osgdb_earth.dll', needed by 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/lib/librepilot-gcs/osg/osgPlugins-3.6.5/mingw_osgdb_earth.dll'.  Stop.
mingw32-make[4]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs/osgearth'
mingw32-make[3]: *** [Makefile:446: sub-osgearth-make_first-ordered] Error 2
mingw32-make[3]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/libs'
mingw32-make[2]: *** [Makefile:53: sub-libs-make_first-ordered] Error 2
mingw32-make[2]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src'
mingw32-make[1]: *** [Makefile:52: sub-src-make_first-ordered] Error 2
mingw32-make[1]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release'
mingw32-make: *** [Makefile:308: gcs] Error 2
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andyp on April 16, 2021, 12:28:06 pm
This is the next problem and the solution seems to be.

https://stackoverflow.com/questions/27747986/undefined-reference-to-main-for-shared-library

moc C:/msys64/home/admin/librepilot/ground/gcs/src/plugins/scope/scopegadgetconfiguration.h
compiling moc_scopegadgetconfiguration.cpp
moc C:/msys64/home/admin/librepilot/ground/gcs/src/plugins/scope/scopegadget.h
compiling moc_scopegadget.cpp
moc C:/msys64/home/admin/librepilot/ground/gcs/src/plugins/scope/scopegadgetwidget.h
compiling moc_scopegadgetwidget.cpp
moc C:/msys64/home/admin/librepilot/ground/gcs/src/plugins/scope/scopegadgetfactory.h
compiling moc_scopegadgetfactory.cpp
linking ../../../lib/librepilot-gcs/plugins/LibrePilot/ScopeGadget.dll
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: plotdata.o:plotdata.cpp:(.text+0xb5): undefined reference to `QwtPlotMarker::QwtPlotMarker(QString const&)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: plotdata.o:plotdata.cpp:(.text+0xd5): undefined reference to `QwtPlotItem::setZ(double)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: plotdata.o:plotdata.cpp:(.text+0x11e): undefined reference to `QwtText::QwtText(QString const&, QwtText::TextFormat)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: plotdata.o:plotdata.cpp:(.text+0x191): undefined reference to `QwtText::setColor(QColor const&)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: plotdata.o:plotdata.cpp:(.text+0x210): undefined reference to `QwtText::setBorderPen(QPen const&)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: plotdata.o:plotdata.cpp:(.text+0x23d): undefined reference to `QwtText::setBorderRadius(double)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: plotdata.o:plotdata.cpp:(.text+0x274): undefined reference to `QwtText::setBackgroundBrush(QBrush const&)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: plotdata.o:plotdata.cpp:(.text+0x284): undefined reference to `QwtText::font() const'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: plotdata.o:plotdata.cpp:(.text+0x29d): undefined reference to `QwtText::setFont(QFont const&)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: plotdata.o:plotdata.cpp:(.text+0x2a8): undefined reference to `QwtPlotMarker::setLabel(QwtText const&)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: plotdata.o:plotdata.cpp:(.text+0x2b3): undefined reference to `QwtPlotItem::setTitle(QString const&)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: plotdata.o:plotdata.cpp:(.text+0x2c0): undefined reference to `QwtPlotMarker::setLabelOrientation(Qt::Orientation)'

.....


C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: moc_scopegadgetwidget.o:moc_scopegadgetwidget.cpp:(.rdata$_ZTV17ScopeGadgetWidget[_ZTV17ScopeGadgetWidget]+0x88): undefined reference to `QwtPlot::minimumSizeHint() const'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: moc_scopegadgetwidget.o:moc_scopegadgetwidget.cpp:(.rdata$_ZTV17ScopeGadgetWidget[_ZTV17ScopeGadgetWidget]+0x110): undefined reference to `QwtPlot::resizeEvent(QResizeEvent*)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: moc_scopegadgetwidget.o:moc_scopegadgetwidget.cpp:(.rdata$_ZTV17ScopeGadgetWidget[_ZTV17ScopeGadgetWidget]+0x1b0): undefined reference to `QwtPlot::canvasMap(int) const'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: moc_scopegadgetwidget.o:moc_scopegadgetwidget.cpp:(.rdata$_ZTV17ScopeGadgetWidget[_ZTV17ScopeGadgetWidget]+0x1b8): undefined reference to `QwtPlot::updateLayout()'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: moc_scopegadgetwidget.o:moc_scopegadgetwidget.cpp:(.rdata$_ZTV17ScopeGadgetWidget[_ZTV17ScopeGadgetWidget]+0x1c0): undefined reference to `QwtPlot::drawCanvas(QPainter*)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: moc_scopegadgetwidget.o:moc_scopegadgetwidget.cpp:(.rdata$_ZTV17ScopeGadgetWidget[_ZTV17ScopeGadgetWidget]+0x1c8): undefined reference to `QwtPlot::getCanvasMarginsHint(QwtScaleMap const*, QRectF const&, double&, double&, double&, double&) const'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: moc_scopegadgetwidget.o:moc_scopegadgetwidget.cpp:(.rdata$_ZTV17ScopeGadgetWidget[_ZTV17ScopeGadgetWidget]+0x1d0): undefined reference to `QwtPlot::drawItems(QPainter*, QRectF const&, QwtScaleMap const*) const'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: moc_scopegadgetwidget.o:moc_scopegadgetwidget.cpp:(.rdata$_ZTV17ScopeGadgetWidget[_ZTV17ScopeGadgetWidget]+0x1d8): undefined reference to `QwtPlot::itemToInfo(QwtPlotItem*) const'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: moc_scopegadgetwidget.o:moc_scopegadgetwidget.cpp:(.rdata$_ZTV17ScopeGadgetWidget[_ZTV17ScopeGadgetWidget]+0x1e0): undefined reference to `QwtPlot::infoToItem(QVariant const&) const'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: moc_scopegadgetwidget.o:moc_scopegadgetwidget.cpp:(.rdata$_ZTV17ScopeGadgetWidget[_ZTV17ScopeGadgetWidget]+0x1e8): undefined reference to `QwtPlot::replot()'
collect2.exe: error: ld returned 1 exit status
mingw32-make[4]: *** [Makefile:107: ../../../lib/librepilot-gcs/plugins/LibrePilot/ScopeGadget.dll] Error 1
mingw32-make[4]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/plugins/scope'
mingw32-make[3]: *** [Makefile:342: sub-scope-make_first] Error 2
mingw32-make[3]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/plugins'
mingw32-make[2]: *** [Makefile:139: sub-plugins-make_first-ordered] Error 2
mingw32-make[2]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src'
mingw32-make[1]: *** [Makefile:52: sub-src-make_first-ordered] Error 2
mingw32-make[1]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release'
mingw32-make: *** [Makefile:308: gcs] Error 2
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andyp on April 16, 2021, 01:01:29 pm
No, this isn't.

I deleted the C:\msys64\home\admin\librepilot\ground\gcs\src\libs\qwt\qwt.pri file during qwt update

... and then the libs were not loaded. Ups
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: TheOtherCliff on April 17, 2021, 11:30:24 pm
Was the problem that you accidentally deleted that file?
Is the problem fixed now?

For information, the OSG version and OSGEARTH version are coded one time in the make files and if you want to <try> different versions (as I am leasurely trying to get this building with more current OS and libs) you can find these versions like this (example from librepilot 16.09):

Code: [Select]
find . \( -iname makefile -o -iname '*.mk' \) -exec grep -H 'OSG_VERSION\|OSGEARTH_VERSION' \{\} \;./make/3rdparty/osgearth/osgearth.mk:OSG_VERSION := 3.5.3
./make/3rdparty/osgearth/osgearth.mk:OSG_GIT_TAG := OpenSceneGraph-$(OSG_VERSION)
./make/3rdparty/osgearth/osgearth.mk:OSG_BASE_NAME   := osg-$(OSG_VERSION)
./make/3rdparty/osgearth/osgearth.mk:OSG_PATCH_FILE  := $(ROOT_DIR)/make/3rdparty/osgearth/osg-$(OSG_VERSION).patch
./make/3rdparty/osgearth/osgearth.mk:OSGEARTH_VERSION := 2.7
./make/3rdparty/osgearth/osgearth.mk:OSGEARTH_GIT_TAG := osgearth-$(OSGEARTH_VERSION)
./make/3rdparty/osgearth/osgearth.mk:OSGEARTH_BASE_NAME   := osgearth-$(OSGEARTH_VERSION)
./make/3rdparty/osgearth/osgearth.mk:OSGEARTH_PATCH_FILE  := $(ROOT_DIR)/make/3rdparty/osgearth/osgearth-$(OSGEARTH_VERSION).patch
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andyp on April 29, 2021, 12:50:45 pm
In which makefile?

Now the qwt lib compiles but somehow he cannot find the result. I am stuck here

mingw32-make[4]: Entering directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/plugins/telemetry'
mingw32-make[4]: Nothing to be done for 'first'.
mingw32-make[4]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/plugins/telemetry'
cd opmap/ && ( test -e Makefile || C:/msys64/mingw64/bin/qmake.exe -o Makefile C:/msys64/home/admin/librepilot/ground/gcs/src/plugins/opmap/opmap.pro 'CONFIG+=release osg copy_osg osgearth gstreamer copy_gstreamer silent' 'GCS_BIG_NAME="LibrePilot GCS"' GCS_SMALL_NAME=librepilot-gcs 'ORG_BIG_NAME="LibrePilot"' ORG_SMALL_NAME=librepilot 'WIKI_URL_ROOT="https://librepilot.atlassian.net/wiki/display/LPDOC/"' 'USAGETRACKER_URL="https://usagetracker.librepilot.org/"' GCS_LIBRARY_BASENAME= ) && C:/msys64/mingw64/bin/mingw32-make.exe -f Makefile
mingw32-make[4]: Entering directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/plugins/opmap'
mingw32-make[4]: Nothing to be done for 'first'.
mingw32-make[4]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/plugins/opmap'
cd scope/ && ( test -e Makefile || C:/msys64/mingw64/bin/qmake.exe -o Makefile C:/msys64/home/admin/librepilot/ground/gcs/src/plugins/scope/scope.pro 'CONFIG+=release osg copy_osg osgearth gstreamer copy_gstreamer silent' 'GCS_BIG_NAME="LibrePilot GCS"' GCS_SMALL_NAME=librepilot-gcs 'ORG_BIG_NAME="LibrePilot"' ORG_SMALL_NAME=librepilot 'WIKI_URL_ROOT="https://librepilot.atlassian.net/wiki/display/LPDOC/"' 'USAGETRACKER_URL="https://usagetracker.librepilot.org/"' GCS_LIBRARY_BASENAME= ) && C:/msys64/mingw64/bin/mingw32-make.exe -f Makefile
mingw32-make[4]: Entering directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/plugins/scope'
linking ../../../lib/librepilot-gcs/plugins/LibrePilot/ScopeGadget.dll
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQwt
collect2.exe: error: ld returned 1 exit status

mingw32-make[4]: *** [Makefile:107: ../../../lib/librepilot-gcs/plugins/LibrePilot/ScopeGadget.dll] Error 1
mingw32-make[4]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/plugins/scope'
mingw32-make[3]: *** [Makefile:342: sub-scope-make_first] Error 2
mingw32-make[3]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/plugins'
mingw32-make[2]: *** [Makefile:139: sub-plugins-make_first-ordered] Error 2
mingw32-make[2]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src'
mingw32-make[1]: *** [Makefile:52: sub-src-make_first-ordered] Error 2
mingw32-make[1]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release'
mingw32-make: *** [Makefile:308: gcs] Error 2
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andyp on April 29, 2021, 04:35:56 pm
OK, you need to copy qwt.dll
from C:\msys64\home\admin\librepilot\build\librepilot-gcs_release\src\libs\qwt\lib
to C:\msys64\home\admin\librepilot\build\librepilot-gcs_release\lib\librepilot-gcs
target directory of the dll is somehow wrong.

Now I a stuck here

compiling C:/msys64/home/admin/librepilot/ground/gcs/src/plugins/flightlog/flightlogmanager.cpp
In file included from C:/msys64/home/admin/librepilot/ground/gcs/src/libs/extensionsystem/pluginmanager.h:33,
                 from C:/msys64/home/admin/librepilot/ground/gcs/src/plugins/uavobjectutil/uavobjectutilmanager.h:34,
                 from C:/msys64/home/admin/librepilot/ground/gcs/src/plugins/flightlog/flightlogmanager.h:40,
                 from C:/msys64/home/admin/librepilot/ground/gcs/src/plugins/flightlog/flightlogmanager.cpp:28:
C:/msys64/home/admin/librepilot/ground/gcs/src/libs/aggregation/aggregate.h: In member function 'T* Aggregation::Aggregate::component()':
C:/msys64/home/admin/librepilot/ground/gcs/src/libs/aggregation/aggregate.h:53:20: warning: unnecessary parentheses in declaration of 'lock' [-Wparentheses]
   53 |         QReadLocker(&lock());
      |                    ^
C:/msys64/home/admin/librepilot/ground/gcs/src/libs/aggregation/aggregate.h: In member function 'QList<T*> Aggregation::Aggregate::components()':
C:/msys64/home/admin/librepilot/ground/gcs/src/libs/aggregation/aggregate.h:64:20: warning: unnecessary parentheses in declaration of 'lock' [-Wparentheses]
   64 |         QReadLocker(&lock());
      |                    ^
C:/msys64/home/admin/librepilot/ground/gcs/src/libs/aggregation/aggregate.h: In function 'T* Aggregation::query(QObject*)':
C:/msys64/home/admin/librepilot/ground/gcs/src/libs/aggregation/aggregate.h:102:20: warning: unnecessary parentheses in declaration of 'lock' [-Wparentheses]
  102 |         QReadLocker(&lock());
      |                    ^
C:/msys64/home/admin/librepilot/ground/gcs/src/libs/aggregation/aggregate.h: In function 'QList<T*> Aggregation::query_all(QObject*)':
C:/msys64/home/admin/librepilot/ground/gcs/src/libs/aggregation/aggregate.h:123:16: warning: unnecessary parentheses in declaration of 'lock' [-Wparentheses]
  123 |     QReadLocker(&lock());
      |                ^
C:/msys64/home/admin/librepilot/ground/gcs/src/plugins/flightlog/flightlogmanager.cpp: In member function 'void FlightLogManager::retrieveLogs(int)':
C:/msys64/home/admin/librepilot/ground/gcs/src/plugins/flightlog/flightlogmanager.cpp:232:76: error: taking address of rvalue [-fpermissive]
  232 |                             memcpy(&fields, &logEntry->getData().Data[start], header_len);
      |                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:/msys64/home/admin/librepilot/ground/gcs/src/plugins/flightlog/flightlogmanager.cpp:238:80: error: taking address of rvalue [-fpermissive]
  238 |                                 memcpy(&fields, &logEntry->getData().Data[start], toread);
      |                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
mingw32-make[4]: *** [Makefile:702: flightlogmanager.o] Error 1
mingw32-make[4]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/plugins/flightlog'
mingw32-make[3]: *** [Makefile:905: sub-flightlog-make_first] Error 2
mingw32-make[3]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src/plugins'
mingw32-make[2]: *** [Makefile:139: sub-plugins-make_first-ordered] Error 2
mingw32-make[2]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release/src'
mingw32-make[1]: *** [Makefile:52: sub-src-make_first-ordered] Error 2
mingw32-make[1]: Leaving directory 'C:/msys64/home/admin/librepilot/build/librepilot-gcs_release'
mingw32-make: *** [Makefile:308: gcs] Error 2
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: TheOtherCliff on April 29, 2021, 09:28:16 pm
You are using a current environment (e.g. qt headers and libs) and compiler.  Unfortunately, we haven't had an update by devs more familiar with this and so the best answer is to use old environment / compiler till then.

@jdl uploaded a Windows environment for this and I suggest you start there if you are using Windows.  Else get an old Ubuntu/Mint version and set that up.

=========================

I have played with getting it to build on recent env/compiler and found this particular issue and others.  Here is a quick fix I did for this issue (in 16.09).  My quick guess is that the use of a reference here should be rethought:

Code: [Select]
diff --git a/ground/gcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/gcs/src/plugins/flightlog/flightlogmanager.cpp
index 02a3b0f55..ff05336f1 100644
--- a/ground/gcs/src/plugins/flightlog/flightlogmanager.cpp
+++ b/ground/gcs/src/plugins/flightlog/flightlogmanager.cpp
@@ -222,6 +222,8 @@ void FlightLogManager::retrieveLogs(int flightToRetrieve)
                         const quint32 total_len  = sizeof(DebugLogEntry::DataFields);
                         const quint32 data_len   = sizeof(((DebugLogEntry::DataFields *)0)->Data);
                         const quint32 header_len = total_len - data_len;
+                        // cliff 20210301 6:00 fix compile errors with new compiler
+                        DebugLogEntry::DataFields df;
 
                         DebugLogEntry::DataFields fields;
                         quint32 start = logEntry->getData().Size;
@@ -229,13 +231,21 @@ void FlightLogManager::retrieveLogs(int flightToRetrieve)
                         // cycle until there is space for another object
                         while (start + header_len + 1 < data_len) {
                             memset(&fields, 0xFF, total_len);
-                            memcpy(&fields, &logEntry->getData().Data[start], header_len);
+                            // cliff 20210301 6:00 fix compile errors with new compiler
+                            df = logEntry->getData();
+                            //memcpy(&fields, &logEntry->getData().Data[start], header_len);
+                            // cliff 20210301 6:00 fix compile errors with new compiler
+                            memcpy(&fields, &df.Data[start], header_len);
                             // check wether a packed object is found
                             // note that empty data blocks are set as 0xFF in flight side to minimize flash wearing
                             // thus as soon as this read outside of used area, the test will fail as lenght would be 0xFFFF
                             quint32 toread = header_len + fields.Size;
                             if (!(toread + start > data_len)) {
-                                memcpy(&fields, &logEntry->getData().Data[start], toread);
+                                // cliff 20210301 6:00 fix compile errors with new compiler
+                                df = logEntry->getData();
+                                //memcpy(&fields, &logEntry->getData().Data[start], toread);
+                                // cliff 20210301 6:00 fix compile errors with new compiler
+                                memcpy(&fields, &df.Data[start], toread);
                                 ExtendedDebugLogEntry *subEntry = new ExtendedDebugLogEntry();
                                 subEntry->setData(fields, m_objectManager);
                                 m_logEntries << subEntry;

=====================================

I finally got it all building on the new PC, but as it is, it requires some old libs copied from the old PC to run correctly, and I haven't tracked down why or how to use the new libs.
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andyp on April 29, 2021, 11:07:30 pm
Now I know which makefile you are talking about regarding osg.

Now it seems to run, I have also googled this error and just did not make the modifications you made.
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andyp on April 29, 2021, 11:19:16 pm
OK, download SSL libs and copy them to C:/msys64/mingw64/bin/

libeay32.dll
ssleay32.dll
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andyp on April 29, 2021, 11:38:34 pm
 :)
no big smile  ;) ;) ;)

Processed 1 file, writing output:
warning: Generating version information for language "0000-TradChinese" without standard key "FileVersion"

Output: "C:\msys64\home\admin\librepilot\build\LibrePilot-16.09+r796-g7c9f04d-dirty_x86_64.exe"
Install: 7 pages (448 bytes), 11 sections (6 required) (180576 bytes), 1650 instructions (46200 bytes), 1566 strings (1413832 bytes), 6 language tables (2436 bytes).
Uninstall: 6 pages (384 bytes),
4 sections (1 required) (65664 bytes), 517 instructions (14476 bytes), 552 strings (29012 bytes), 6 language tables (2004 bytes).
Datablock optimizer saved 28943655 bytes (~5.9%).

Using lzma (compress whole) compression.

EXE header size:               70656 / 38400 bytes
Install code:                          (1643892 bytes)
Install data:                          (459621084 bytes)
Uninstall code+data:                   (214344 bytes)
Compressed data:           129938339 / 461479320 bytes
CRC (0xE09C7736):                  4 / 4 bytes

Total size:                130008999 / 461517724 bytes (28.1%)

1 warning:
  Generating version information for language "0000-TradChinese" without standard key "FileVersion"
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andyp on April 29, 2021, 11:45:08 pm
 >:(

C:/Program Files/LibrePilot/lib/librepilot-gcs/plugins/LibrePilot/Config.dll: Cannot load library C:\Program Files\LibrePilot\lib\librepilot-gcs\plugins\LibrePilot\Config.dll: Das angegebene Modul wurde nicht gefunden.

Cannot load plugin because dependency failed to load: ScopeGadget(1.0.0)
Reason: C:/Program Files/LibrePilot/lib/librepilot-gcs/plugins/LibrePilot/ScopeGadget.dll: Cannot load library C:\Program Files\LibrePilot\lib\librepilot-gcs\plugins\LibrePilot\ScopeGadget.dll: Das angegebene Modul wurde nicht gefunden.

C:/Program Files/LibrePilot/lib/librepilot-gcs/plugins/LibrePilot/PfdQml.dll: Cannot load library C:\Program Files\LibrePilot\lib\librepilot-gcs\plugins\LibrePilot\PfdQml.dll: Das angegebene Modul wurde nicht gefunden.

C:/Program Files/LibrePilot/lib/librepilot-gcs/plugins/LibrePilot/ScopeGadget.dll: Cannot load library C:\Program Files\LibrePilot\lib\librepilot-gcs\plugins\LibrePilot\ScopeGadget.dll: Das angegebene Modul wurde nicht gefunden.

Cannot load plugin because dependency failed to load: Config(1.0.0)
Reason: C:/Program Files/LibrePilot/lib/librepilot-gcs/plugins/LibrePilot/Config.dll: Cannot load library C:\Program Files\LibrePilot\lib\librepilot-gcs\plugins\LibrePilot\Config.dll: Das angegebene Modul wurde nicht gefunden.

Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andyp on April 29, 2021, 11:53:01 pm
OK, you need to copy

qwt.dll

to C:\Program Files\LibrePilot\bin

C:/Program Files/LibrePilot/lib/librepilot-gcs/plugins/LibrePilot/PfdQml.dll: Cannot load library C:\Program Files\LibrePilot\lib\librepilot-gcs\plugins\LibrePilot\PfdQml.dll: Das angegebene Modul wurde nicht gefunden.

But the file is there?
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: TheOtherCliff on April 30, 2021, 10:25:17 am
Sorry.  I use Linux, not Windows.

I think that what LibrePilot needs right now is a port to latest environments / OS's.

I think I made a reasonable start on it.  I have made decisions to use recent Mint (Ubuntu), and about which QT / OSG / OSGEarth to use.  As I recall it was latest OsgEarth OsgEarth 3.1, and the Osg 3.6.5 and QT 5.6.1 that went with that.  I made some code and build changes.  It builds (including OsgEarth), but segfaulted in some places.  OsgEarth and some security something SSL3?  I got rid of the segfaults by bringing over some libs from my old dev box.  I haven't worked on it in almost 2 months.

Given the Linux focus of development, I would guess that it would be easiest to get it all working smoothly on Linux, then port to Windows and Macos.  Getting it working on Macos may be a bigger task.  Are the new M1 processors big endian?
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: andregcoimbra on December 30, 2021, 06:24:08 pm
I'm trying compile GCS only but report the error:

C:/msys64/home/.../librepilot/ground/gcs/src/libs/osgearth/osgQtQuick/OSGSkyNode.cpp:37:10: fatal error: osgEarthUtil/Sky: No such file or directory
   37 | #include <osgEarthUtil/Sky>
      |          ^~~~~~~~~~~~~~~~~~


I found information about the osgEarthUtil is deprecated... How can I solve it?
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: TheOtherCliff on December 31, 2021, 08:09:56 am
I recall long ago that I was told to use msys32, not msys64.  That may or may not be true any more.

@JDL posted his complete msys32 environment here, but it is no longer there...
https://forum.librepilot.org/index.php?topic=4876.msg32702#msg32702

I can tell you that one issue with LibrePilot is the old compiler tools needed to build 16.09.  You might try to build the latest "next" where I recall some of the tool requirements have been updated.
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: jdl on December 31, 2021, 09:14:03 am
I've uploaded the archived msys32 environment again and fixed the broken link.

Here is the new link:
https://drive.google.com/u/0/uc?id=1ULDYV4zcf3DUr8-fty9ZfzaM32ZWrUGr&export=download (https://drive.google.com/u/0/uc?id=1ULDYV4zcf3DUr8-fty9ZfzaM32ZWrUGr&export=download)


Cannot guarantee it would stay there forever as I'm short on space in google drive.

Any suggestions where we can store such a large file (5.7GB) permanently?
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: TheOtherCliff on December 31, 2021, 09:43:26 am
Good question...
It would be nice if the source code was updated to build with the current day tools so it was not necessary.

I have an HD copy of the OpenPilot dev webinar that is 1.8G.
Title: Re: Compiling Librepilot in Windows 10 - problems and solutions
Post by: trust on January 01, 2022, 05:09:44 am
I have plenty of space on Google drive- also box accounts which I never use. I've uploaded each version of next that I've tested to google drive. I can view share it with anyone interested, but I can't promise to provide much support.

I too ended up having to use the older python to compile - not a terribly big deal but I attempted to fix it to work with 3 and it was too much effort.

My next version contains all the changes I made for bimode plus a manual mixer function and Telemetry+output mode
The code appears to be about 2Gb
But msys32 is something like 18Gb!