Troubleshooting
Common errors
General
-
If you have compilation error that
<QRegex>is not found (I can't remember the exact error sorry), this is because labs need Qt5 probably because you installed Qt6 during PIN or Qmake it not taking the correct version. You can install/use multiple versions at the same time. Look at next point. -
If you have multiple versions of QT installed at the same time (version 5 and 6 for ex.) you can easily switch between them with
qtchooser,Just export this environment variable in your shell configuration
export QT_SELECT=5 # Tell to QTchooser that we want to use QT5 -
On Windows, under WSL2, if you can have the following errors when starting a GUI app:
cannot run Qt apps, "could not connect to display: :0", xcb module found but not loaded: it's probable you need to install some drivers. See more here. And here if necessary here is a stackoverflow post. -
If you have all required dependencies but your build fails inside WSL2, make sure you have the latest version of the distribution.
Lab1
In the timestamps exo
- If you are running
r, make sure you choose the binary./build/PCO_lab01_timestampsor typer timeto filter the list to this element. - On WSL, the
plt.show()insideshow_graphic_from_exec.pycan fail, thus making the python script fails when the diagram should be displayed.
The workaround is to save the graphic as PNG and open it separately. You can change theplt.show()line withplt.savefig("graph.png"). You can then opengraph.pngin your IDE or directly show it in the terminal withicat graph.pngif you have this tool. There might be a fix but this doesn't seem trivial to apply, this minor code change is far easier.
In folder counter, if you get a undefined reference to symbol 'pthread_create@@GLIBC_2.2.5', this is because the CMakeLists.txt is missing a link to pthread so add the flag -lpthread inside target_link_libraries.
Dark theme on Linux causing to have unvisible black text on dark background
See details
This solution has only been tested on KDE Plasma, when a dark theme is enabled like Breeze Dark.
TODO add picture
In some labs, some texts are rendered in black on a black background if you have a black theme. You can always change your global Plasma theme to something Light again, but that's annoying, so here is a way to open a specific app in white theme and keeping the global dark theme. I don't know if that's an issue with the app itself, but the workaround is to change the theme...
You have to know if the app is compiled with Qt5 or Qt6, please adapt all given steps with the correct number. If you have both, it's probably Qt5 that was chosen, you can always check the CMakeLists.txt.
You have to install qt5ct (qt5 configuration tool), i.e. with Fedora:
sudo dnf install qt5ct
Open it and set selected theme to a custom mode that is light (maybe simple), you can see the small preview below, apply and save. (It will write ~/.config/qt5ct/qt5ct.conf).
Now, you start something with this theme, you have to define the environment variable QT_QPA_PLATFORMTHEME to qt5ct, you can do it just for a given process like this: QT_QPA_PLATFORMTHEME="qt5ct" ./build/pco_hospital.
The easiest way to enable this all the time for cmr (and by effect cbr), is to write an alias around the fish function that defines this variable.
alias cmr "QT_QPA_PLATFORMTHEME=qt5ct fish -c 'cmr \$argv'"
Note: No need to change cbr as it will call the cmr alias, not the function.
Manual Fedora setup
Note: these commands are not maintained, only the pco.yml file for the lxup setup is kept up-to-date.
See commands
## Only for the first lab, we need pandas and matplotlib for timestamps exo
sudo dnf install -y python3-pip
pip3 install pandas matplotlib
# Qt5, Cmake and other tools
sudo dnf install -y git cmake qt5-qtbase-devel qtchooser
# GoogleTest
sudo dnf install -y gtest gtest-devel
## Dependency for labo with Train simulation: QtMultimedia
sudo dnf install -y qt5-qtmultimedia qt5-qtmultimedia-devel
## Dependency for labo with Engines: QtSvg
sudo dnf install -y qt5-qtsvg qt5-qtsvg-devel
## Google benchmark on labo with quick sort
sudo dnf install -y google-benchmark google-benchmark-devel
Note: without qtchooser, qmake is accessible via qmake-qt5 only, as latest version of Qt is 6...
Manual Ubuntu setup
See commands
Note: these commands are not maintained, only the pco.yml file for the lxup setup is kept up-to-date.
## Install required packages
sudo apt update
## Only for the first lab, we need pandas and matplotlib for timestamps exo
sudo apt install -y python3-pip
pip3 install pandas matplotlib
# Qt5 basics + GoogleTest
sudo apt install -y build-essential git cmake qtbase5-dev qt5-qmake libgtest-dev
## Dependency for labo with Train simulation: QtMultimedia
## From: https://stackoverflow.com/questions/26948466/project-error-unknown-modules-in-qt-multimedia
sudo apt install -y qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5
## Dependency for labo with Engines: QtSvg
sudo apt install -y libqt5svg5 libqt5svg5-dev
## Google benchmark on labo with quick sort
sudo apt install -y libbenchmark-dev
Arch setup ?
Does anyone has already did this ?
Install pcosynchro library
See the steps
## Compile and install pcosynchro C++ library globally (under /usr/local/include/ and /usr/local/lib)
git clone https://reds-gitlab.heig-vd.ch/reds-public/pco-synchro.git
pushd pco-synchro/lib/pcosynchro/
qmake-qt5 || qmake
make -j8
sudo make install
popd
rm -rf pco-synchro # we don't need the repos anymore, result files are global
If you want to confirm installations, you should see header files in the first command, and the presence of the compiled library in the second command.
ls /usr/local/include/pcosynchro/
ls /usr/local/lib/libpcosynchro.a