Solved fatal error: 'QSerialPort' file not found

Hi All,
I'm not sure if this is posted in the correct location. OP please move if not.

Maybe someone with QT knowledge could help me out. I am attempting to build a Amateur Radio QT application called DroidStar on FreeBSD 13.0. The code is C++ and it builds fine until it reaches this header. Does anyone know where this header and lib is? I have pkg install qt5-serialport so that package is installed but it doesn't seem to have the library header that the code is requesting. This code was built on Linux but I am wanting to port it to FreeBSD however I need to just do a normal build before I attempt a port. Below is the error I am seeing. It seems like it would be a simple fix if I could find the header and lib that it's wanting.
This code was built on Linux but I am wanting to port it to FreeBSD however I need to just do a normal build before I attempt a port.

C++:
../../DroidStar/serialambe.h:22:10: fatal error: 'QSerialPort' file not found
#include <QSerialPort>
         ^~~~~~~~~~~~~
1 error generated.
*** Error code 1

The source can be found at https://github.com/nostar/DroidStar
 
I will take a look at this. It's not my code but I can see that as a thing since there is a difference in hier between Linux and Freebsd
 
On Linux it's normal to dump the files in /usr/include and /usr/lib, those directories are included by default with the compilers. On FreeBSD however ports/packages always install with a /usr/local prefix, so those libraries and include files are kept in /usr/local/include and /usr/local/lib. That's a common issue when porting code from Linux to FreeBSD, you always have to add -I/usr/local/include and -L/usr/local/lib.
 
I will take a look at this. It's not my code but I can see that as a thing since there is a difference in hier between Linux and Freebsd
Okay so looking at the make file I am seeing the following for includes and libs

C++:
INCPATH       = -I../../DroidStar -I. -I/usr/local/include/qt5 -I/usr/local/include/qt5/QtQuickControls2 -I/usr/local/include/qt5/QtQuick -I/usr/local/include/qt5/QtMultimedia -I/usr/local/include/qt5/QtGui -I/usr/local/include/qt5/QtQmlModels -I/usr/local/include/qt5/QtQml -I/usr/local/include/qt5/QtNetwork -I/usr/local/include/qt5/QtCore -I. -I/usr/local/include -I/usr/local/include -I/usr/local/lib/qt5/mkspecs/freebsd-clang
...
LIBS          = $(SUBLIBS) -L/usr/local/lib -limbe_vocoder -ldl /usr/local/lib/qt5/libQt5QuickControls2.so /usr/local/lib/qt5/libQt5Quick.so /usr/local/lib/qt5/libQt5Multimedia.so /usr/local/lib/qt5/libQt5Gui.so /usr/local/lib/qt5/libQt5QmlModels.so /usr/local/lib/qt5/libQt5Qml.so /usr/local/lib/qt5/libQt5Network.so /usr/local/lib/qt5/libQt5Core.so -lGL

Unlike the other libs I don't see the Serial lib spelled out in the generated Makefile for the LIBS and INCPATH directive. The few lines of instruction have you do a qmake to generate the Makefile stash. This Makefile is very long and somewhat complex. I will try compiling this on my linux box. This code is fairly new.
 
Ok, those paths, at first glance, look good.

Look at the output from pkg info -l qt5-serialport. That port has the include file and the library, take note of the paths of the files. It appears to be in a sub-directory of /usr/local/include/qt5 and that directory isn't in the INCPATH. Try adding -I/usr/local/include/qt5/QtSerialPort to INCPATH, see if that helps.
 
Hi SirDice, Yep that worked awesome. I also had to add the /usr/local/lib/qt5/libQt5SerialPort.so to the LIBS line but it built and actually I was able to run it on FreeBSD 13. Thank you so much for your help SirDice ... I figured it was something simple like this. I have to do some more testing but my goal is to build a port/pkg for this. I attempted to build ports before but not with much success since figuring out how to compile the code is hard enough but to figure out the make file for the port is pretty involved. I know and can read Makefiles but I guess I just don't know them well enough.. Anyway thanks for your help you're awesome :) I wonder why qmake didn't put these in the Makefile? :-/

Does anyone have a good template for a Makefile for a port that basically clones a repo, run qmake then make and make install? It's been a while since I attempted to build a port. The last time didn't go so well. I get totally lost in the FreeBSD Porters Handbook.
 
Back
Top