posix headers under MINGW64 - serial-port

I am porting my C++ code from Linux to windows.
The code open a ttyACM*.
I am using MINGW64 for building code on Windows.
gcc generates an error that termios.h is not found.
Is there a MINGW64 library which supports Posix interfaces?
or should I switch to MSVC?

Related

Qt - The compiler may not produce code compatible with the Qt version

I use MSYS2 on Windows 10 and have installed Qt 6.2.0 and Qt Creator 5.0.2.
Then I set up Qt Kit and see this warning:
Qt Kits warning
Warning: The compiler "MinGW-w64 MINGW64 C++ (MSYS2)" (x86-windows-msys-pe-64bit)
may not produce code compatible with the Qt version "Qt 6.2.0 (mingw64)"
(x86-windows-msys-pe-64bit).
How to address this issue?
I use MINGW64 subsystem of MSYS2 that has following related packages installed:
mingw-w64-x86_64-gcc 11.2.0-1
mingw-w64-x86_64-gdb 11.1-1
mingw-w64-x86_64-qt-creator 5.0.2-2
mingw-w64-x86_64-qt6-* 6.2.0-2
I failed to figure out toolchain version that was used to build Qt6 packages in order to provide the same toolchain for building applications. The only information I got is ABI : x86-windows-msys-pe-64bit and QT_VERSION : 6.2.0.
Warning message says both compiler and Qt have similar x86-windows-msys-pe-64bit ABI, but it seems to be insufficient.
Until this point I successfully build, run and debug code, but still would like to get rid of this warning if it makes sense.
It turns out this warning goes away when GCC compiler in Qt Creator Kit settings and GCC compiler used to build Qt installation have exactly the same versions.
Using mingw64/share/qt6/mkspecs/qconfig.pri, as suggested by ssbssa, I've got GCC version Qt installation was built with and supplied Qt Creator Kit with GCC compiler that have the same version. Now I see the warning is gone.

Qt Creator : how to get gcc warnings with a project using Visual C++ compiler?

I have a C++ project using cmake and Visual-C++ compiler.
Though I'd like to make a fake compilation with gcc just to get the warnings of the gcc compiler. This will fail to link because it has to link with external Visual-C++ binary dependencies, but I just need the compilation errors/warnings, not the link part.
Is there a way in Qt Creator to run such a fake build on the fly without changing my CMakeCache ?

QT on Cygwin -- IPC Errors

I've downloaded the source for QT 5.6.0 and I'm attempting to compile/install it on a Cygwin installation for Windows.
The Cygwin build already has Qt4 and Qt3 libraries installed. Trying to upgrade so I can install the latest QtCreator suite.
Here is my Cygwin version via uname -a:
CYGWIN_NT-10.0 J_Mick-Windoze 2.5.1(0.297/5/3) 2016-04-21 22:14 x86_64 Cygwin
When I try to compile QT 5.6.1 via running ./configure -platform cygwin-g++ -prefix $PWD/qtbase -opensource -nomake tests I get the following error:
Running configuration tests (phase 1)...
Done running configuration tests.
Creating qmake...
.In file included from /home/JasonMick/Install_Stuff/qt-everywhere-opensource-src-5.6.0/qtbase/include/QtCore/5.6.0/QtCore/private/qcore_unix_p.h:1:0,
from /home/JasonMick/Install_Stuff/qt-everywhere-opensource-src-5.6.0/qtbase/src/corelib/global/qglobal.cpp:90:
/home/JasonMick/Install_Stuff/qt-everywhere-opensource-src-5.6.0/qtbase/src/corelib/kernel/qcore_unix_p.h: In function ‘key_t qt_safe_ftok(const QByteArray&, int)’:
/home/JasonMick/Install_Stuff/qt-everywhere-opensource-src-5.6.0/qtbase/src/corelib/kernel/qcore_unix_p.h:333:12: error: ‘::ftok’ has not been declared
return ::ftok(filename.constData(), qHash(filename, proj_id));
^
make: *** [qglobal.o] Error 1
Now clearly there is support for cygwin in the QT project as grepping inside configure I see the platform:
PLATFORM=cygwin-g++
...is defined. Doing some reading I read that ftok is a part of the IPC group of shared memory functions. One link regarding a similar error with a different app suggested linking in -lcygwin. I successfully added this to the L_FLAGS variable in the configure file, but it's still giving the same error, even when I specify the Cygwin as the platform via the -platform flag.
I would appreciate any advice as to how to get rid of this issue -- which I believe is attributable to some sort of missing IPC library error.

qtwebengine qmake error: unkown module: webchannel

I am trying to get qt webengine running on my laptop for the first time, but can't seem to build it. I am following the instructions from here:
https://wiki.qt.io/QtWebEngineHowToTry
On the last few steps, I had to run "qmake -r" on the qtwebengine directory. This is the output:
SSL............................... Using system NSS
ICU............................... Using internal copy (Default, force system ICU with WEBENGINE_CONFIG += use_system_icu)
FFMPEG............................ Using internal copy (Default, force system FFMPEG with WEBENGINE_CONFIG += use_system_ffmpeg)
Proprietary codecs (H264, MP3).... Not enabled (Default, enable with WEBENGINE_CONFIG += use_proprietary_codecs)
Reading /home/kevin/workspace/qtwebengine/src/src.pro
Reading /home/kevin/workspace/qtwebengine/src/core/core.pro
Reading /home/kevin/workspace/qtwebengine/src/core/core_gyp_generator.pro
Project ERROR: Unknown module(s) in QT: webchannel
This error happened right after I installed WebKitGtk+ from here (http://trac.webkit.org/wiki/BuildingGtk) and ran "Tools/gtk/install-dependencies" and "Tools/Scripts/update-webkitgtk-libs". Before I installed WebKitGtk+, qmake would terminate at a later point.
(I installed WebKitGtk+ because, previously, running "qmake -r" on the qtwebengine directly resulted in an "unmet dependency: harfbuzz" error that I tried to fix on my own via google, and the WebKitGtk+ page was the only lead I could find that would supposedly fix that issue... big mistake!).
I am running on a (mostly freshly reformatted) Ubuntu 15.04 laptop. I installed qt5 via apt-get install, but apparently I have both qt4 and qt5 plugins installed, as well as qtchooser (I'm guessing from the WebKitGtk+ installation scripts).
Here is the output of "qmake --version":
QMake version 3.0
Using Qt version 5.4.1 in /usr/lib/x86_64-linux-gnu
Any help would be greatly appreciated, as I'm excited to try out qt webengine!
In case anyone else has the same problem, I fixed it by installing qt 5.5.0 from here http://download.qt.io/official_releases/qt/, and using the associated qmake binary from that installation. I guess installing qt from 'sudo apt-get install' still has some issues that won't work with qtwebengine.

How do I build a QT console app in 64 bit on Mac OSX?

I need to build my QT console application as 64 bit. i.e. x86_64
My config file looks like this:
CONFIG += qt console debug x86_64
CONFIG -= app_bundle
HEADERS = HelperClass.h
SOURCES = HelperClass.cpp \
main.cpp
The compile goes fine without issue. But, when the build gets to the link step, it complains that I don't have the Qt x86_64 architecture.
Excerpt from build:
ld: warning in /Library/Frameworks/QtGui.framework/QtGui, missing required architecture x86_64 in file
ld: warning in /Library/Frameworks/QtCore.framework/QtCore, missing required architecture x86_64 in file
Undefined symbols:
"QIODevice::getChar(char*)", referenced from:
...
Do I need to download the Qt source and build the required architecture for this to work? My install is from the provided binaries for Mac OSX - Qt 4.5.2 on the QT site. I'm guessing that build does not come with 64bit versions of the libraries. Am I correct?
The QT SDK does NOT include by default the 64 bit libraries in Mac OS X (I think it is strange but it is that way). For compiling my apps in x86_64 I just download the standalone libraries with Cocoa (32/64 bits) and I install them after the SDK is installed.
Everything works like a charm then.
From the Qt for Open Source C++ development on Mac OS X page it appears that the 32 and 64 bit libraries should be included:
Mac binary package using Cocoa for Mac OS X 10.5 (32-bit and 64-bit)
http://get.qtsoftware.com/qt/source/qt-mac-cocoa-opensource-4.5.2.dmg
If you are still having trouble you could try to download the source from the same page:
http://get.qtsoftware.com/qt/source/qt-mac-opensource-src-4.5.2.tar.gz
and configure with:
-arch x86_64
See http://doc.trolltech.com/4.5/developing-on-mac.html#universal-binaries
Note that the link above mentions that if no arch is specified it builds 32bit for the current platform.
You can check the libraries using "file":
$ file /Library/Frameworks/QtGui.framework/QtGui
/Library/Frameworks/QtGui.framework/QtGui: Mach-O universal binary with 4 architectures
/Library/Frameworks/QtGui.framework/QtGui (for architecture ppc64): Mach-O 64-bit dynamically linked shared library ppc64
/Library/Frameworks/QtGui.framework/QtGui (for architecture ppc7400): Mach-O dynamically linked shared library ppc
/Library/Frameworks/QtGui.framework/QtGui (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
/Library/Frameworks/QtGui.framework/QtGui (for architecture i386): Mach-O dynamically linked shared library i386
I see the same "ld warning: ... missing required architecture x86_64 in file" errors, so the error message is misleading.

Resources