Topics

#windows compilation #windows


Jon Beniston
 

Hi,

I've just been trying to compile sdrangel for windows, and I thought it
might be useful to mention a few things I've noticed that might be helpful
to others trying to do the same.

For Cygwin users, it's probably best to not have C:\cygwin\bin in your path:

- Windows native cmake is required to create msvc project files
- Windows native version of git is required. If you use the cygwin version
of git, bladerf build step will fail with
-- Checking libusb version...
-- Failed to load
C:/sdrangel/external/windows/libusb/MS64/dll/libusb-1.0.dll
Because libsub-1.0.dll will get checked out without execute permissions.
- The Windows version of git needs to be configured as "checkout-as-is,
commit-as-is" for line endings, otherwise patches applied in bladeRF build
will fail.
- SoapySDR will fail to build docs with doxygen. Can be worked around by not
having doxygen in your path, as these docs aren't required.
- cmake can erroneously pick up C:\cygwin\lib\cmake\Qt5Core. Not sure how to
fix this other than to temporarily rename the cmake directory (never used
cmake before).


The latest version of Qt (5.15.0) doesn't have a msvc2017 directory, so I
set "CMAKE_CUSTOM_OPTIONS=-DFORCE_SSE41=ON
-DQT_PATH=c:\qt\5.15.0\msvc2019_64", as that is supposed to be compatible
with 2017. However, this fails to compile with the following errors:

C:\sdrangel\sdrgui\gui\glscopegui.cpp(300): warning C4267: 'initializing':
conversion from 'size_t' to 'uint32_t', possible loss of data
[C:\sdrangel\build\sdrgui\sdrgui.vcxproj]
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(177): error C2079: 'path' uses
undefined class 'QPainterPath' [C:\sdrangel\build\sdrgui\sdrgui.vcxproj]
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(178): error C2228: left of '.moveTo'
must have class/struct/union [C:\sdrangel\build\sdrgui\sdrgui.vcxproj]
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(178): note: type is 'int'
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(179): error C2228: left of '.lineTo'
must have class/struct/union [C:\sdrangel\build\sdrgui\sdrgui.vcxproj]
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(179): note: type is 'int'
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(180): error C2228: left of '.lineTo'
must have class/struct/union [C:\sdrangel\build\sdrgui\sdrgui.vcxproj]
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(180): note: type is 'int'
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(181): error C2228: left of '.arcTo'
must have class/struct/union [C:\sdrangel\build\sdrgui\sdrgui.vcxproj]
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(181): note: type is 'int'
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(182): error C2228: left of '.lineTo'
must have class/struct/union [C:\sdrangel\build\sdrgui\sdrgui.vcxproj]
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(182): note: type is 'int'
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(183): error C2228: left of '.arcTo'
must have class/struct/union [C:\sdrangel\build\sdrgui\sdrgui.vcxproj]
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(183): note: type is 'int'
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(184): error C2664: 'void
QPainter::drawPath(const QPainterPath &)': cannot convert argument 1 from
'int' to 'const QPainterPath &' [C:\sdrangel\build\sdrgui\sdrgui.vcxproj]
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(184): note: Reason: cannot convert
from 'int' to 'const QPainterPath'
C:\sdrangel\sdrgui\gui\rollupwidget.cpp(184): note: use of undefined type
'QPainterPath' c:\qt\5.15.0\msvc2019_64\include\qtgui\qpainter.h(69): note:
see declaration of 'QPainterPath' (compiling source file
C:\sdrangel\sdrgui\gui\rollupwidget.cpp)

C:\sdrangel\sdrbase\dsp/dsptypes.h(47): note: see declaration of 'Sample'
(compiling source file
C:\sdrangel\plugins\channeltx\remotesource\remotesourceplugin.cpp)
C:\Qt\5.15.0\msvc2019_64\include\QtCore/qglobal.h(1050): error C2440: '=':
cannot convert from 'int' to 'QDebug::Stream *' (compiling source file
C:\sdrangel\build\pluginssrv\channeltx\remotesource\remotesourcesrv_autogen\
mocs_compilation.cpp)
[C:\sdrangel\build\pluginssrv\channeltx\remotesource\remotesourcesrv.vcxproj
]
C:\Qt\5.15.0\msvc2019_64\include\QtCore/qglobal.h(1050): note: Conversion
from integral type to pointer type requires reinterpret_cast, C-style cast
or function
-style cast (compiling source file
C:\sdrangel\build\pluginssrv\channeltx\remotesource\remotesourcesrv_autogen\
mocs_compilation.cpp)
C:\Qt\5.15.0\msvc2019_64\include\QtCore/qdebug.h(118): note: see reference
to function template instantiation 'T *qExchange<QDebug::Stream*,int>(T &,U
&&)' bein
g compiled
with
[
T=QDebug::Stream *,
U=int
] (compiling source file
C:\sdrangel\build\pluginssrv\channeltx\remotesource\remotesourcesrv_autogen\
mocs_compilation.cpp)
C:\Qt\5.15.0\msvc2019_64\include\QtCore/qglobal.h(1050): error C2440: '=':
cannot convert from 'int' to 'QDebug::Stream *' (compiling source file
C:\Users\jon\sdr
angel\sdrangel\plugins\channeltx\remotesource\remotesource.cpp)
[C:\sdrangel\build\pluginssrv\channeltx\remotesource\remotesourcesrv.vcxproj
]
C:\Qt\5.15.0\msvc2019_64\include\QtCore/qglobal.h(1050): note: Conversion
from integral type to pointer type requires reinterpret_cast, C-style cast
or function
-style cast (compiling source file
C:\sdrangel\plugins\channeltx\remotesource\remotesource.cpp)
c:\qt\5.15.0\msvc2019_64\include\qtcore\qdebug.h(118): note: see reference
to function template instantiation 'T *qExchange<QDebug::Stream*,int>(T &,U
&&)' bein
g compiled
with
[
T=QDebug::Stream *,
U=int
] (compiling source file
C:\sdrangel\plugins\channeltx\remotesource\remotesource.cpp)

I installed an earlier version of QT, 5.14.2, to see if that would help,
however, using -DQT_PATH=c:\qt\5.14.2\msvc2017_64 does not seem sufficient
to use it, as variables like Qt5Core_DIR Still seem to end up pointing to
5.15.0. Perhaps there's an easier way, but I just uninstalled 15.5.0.

5.14.2 still had a couple of the previous errors, so tried 5.13.2, which
worked :)

Cheers,
Jon