viktorgino / headunit-desktop

HeadUnit Desktop is a car PC software built with Qt 5 and QML
https://github.com/viktorgino/headunit-desktop/wiki
GNU General Public License v3.0
285 stars 64 forks source link

build error #62

Closed embetrix closed 2 years ago

embetrix commented 2 years ago

I get the following build error:

I installed before all the packages dependencies on ubuntu 20.04 and run

$ git submodule update --init --recursive
$ protoc --proto_path=modules/android-auto/headunit/hu/ --cpp_out=modules/android-auto/headunit/hu/generated.x64/ modules/android-auto/headunit/hu/hu.proto
$ mkdir build && cd build
$ qmake ../headunit-desktop.pro
 $ make
cd app/ && ( test -e Makefile || /usr/lib/qt5/bin/qmake -o Makefile /workspaces/headunit-desktop/app/app.pro ) && make -f Makefile 
make[1]: Entering directory '/workspaces/headunit-desktop/build/app'
g++ -c -pipe -Wno-unused-parameter -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../../app -I. -I/workspaces/headunit-desktop/app/includes -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtQuick -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtQml -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o main.o ../../app/main.cpp
../../app/main.cpp: In function 'int main(int, char**)':
../../app/main.cpp:26:5: error: 'QElapsedTimer' was not declared in this scope; did you mean 'QBasicTimer'?
   26 |     QElapsedTimer time;
      |     ^~~~~~~~~~~~~
      |     QBasicTimer
../../app/main.cpp:27:10: error: request for member 'start' in 'time', which is of non-class type 'time_t(time_t*) throw ()' {aka 'long int(long int*)'}
   27 |     time.start();
      |          ^~~~~
../../app/main.cpp:56:35: error: 'SkipEmptyParts' is not a member of 'Qt'
   56 |         plugins = p.split(" ",Qt::SkipEmptyParts);
      |                                   ^~~~~~~~~~~~~~
../../app/main.cpp:59:46: error: request for member 'elapsed' in 'time', which is of non-class type 'time_t(time_t*) throw ()' {aka 'long int(long int*)'}
   59 |     qDebug("%lld ms : loading plugins", time.elapsed());
      |                                              ^~~~~~~
../../app/main.cpp:62:44: error: request for member 'elapsed' in 'time', which is of non-class type 'time_t(time_t*) throw ()' {aka 'long int(long int*)'}
   62 |     qDebug("%lld ms : loading theme", time.elapsed());
      |                                            ^~~~~~~
../../app/main.cpp:67:43: error: request for member 'elapsed' in 'time', which is of non-class type 'time_t(time_t*) throw ()' {aka 'long int(long int*)'}
   67 |     qDebug("Loading took : %lld ms", time.elapsed());
      |                                           ^~~~~~~
make[1]: *** [Makefile:553: main.o] Error 1
make[1]: Leaving directory '/workspaces/headunit-de
aselafernando commented 2 years ago

I have built it successfully on Debian 11 with the following:

#!/bin/bash

sudo apt install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools qtdeclarative5-dev qtmultimedia5-dev libqt5multimedia5-plugins \
libqt5xmlpatterns5-dev libqt5bluetooth5 qtconnectivity5-dev libqt5charts5 libqt5serialport5 \
qml-module-qtquick2 qml-module-qtquick-layouts qml-module-qtquick-dialogs qml-module-qtquick-controls2 \
qml-module-qtquick-extras qml-module-qtquick-window2 qml-module-qtmultimedia qml-module-qt-labs-settings \
qml-module-qt-labs-folderlistmodel qml-module-qt-labs-platform qml-module-qtbluetooth qml-module-qtcharts \
qml-module-qtgraphicaleffects

sudo apt install build-essential protobuf-compiler libusb-1.0-0-dev libssl-dev openssl libglib2.0-dev \
libboost-dev libudev-dev libtag1-dev libprotobuf-dev libgstreamer1.0-dev gstreamer1.0-plugins-base-apps \
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-alsa libgstreamer-plugins-base1.0-dev \
gstreamer1.0-pulseaudio libfaad-dev libfftw3-dev librtlsdr-dev libairspy-dev libusb-1.0-0-dev mesa-common-dev \
libglu1-mesa-dev zlib1g-dev  portaudio19-dev libsndfile1-dev libsamplerate0-dev ofono ofono-dev \
pulseaudio bluez bluez-obexd pulseaudio-module-bluetooth qtconnectivity5-dev qtquickcontrols2-5-dev \
qml-module-qtbluetooth libkf5bluezqt-dev qml-module-org-kde-bluezqt qtbase5-private-dev libcanberra-dev \
libqt5charts5 libqt5charts5-dev qml-module-qtcharts libqt5serialport5-dev \
libgconf2-dev libpulse-dev libmp3lame-dev libsoapysdr-dev libmpg123-dev

sudo apt install automake git alsa-utils

git clone git://git.kernel.org/pub/scm/network/ofono/phonesim.git
cd phonesim
./bootstrap-configure
make -j5 && sudo make install
cd ..

git clone --recursive https://github.com/viktorgino/headunit-desktop.git
cd headunit-desktop
protoc --proto_path=modules/android-auto/headunit/hu/ --cpp_out=modules/android-auto/headunit/hu/generated.x64/ modules/android-auto/headunit/hu/hu.proto
mkdir build && cd build
qmake PREFIX=~/hud ../headunit-desktop.pro
make -j5 && sudo make install
cd ../../
viktorgino commented 2 years ago

@aselafernando are these steps any different from the Wiki page?

aselafernando commented 2 years ago

@viktorgino on Debian 11 the package qt5-default doesn't exist, it has been replaced with the 3 qtbase5-dev qtchooser qt5-qmake. Likewise ofono-phonesim doesn't exist anymore. However you can get the sources to compile and add it it in.

viktorgino commented 2 years ago

@aselafernando amazing thanks I've updated the build instructions. I'm also adding the setup instructions for Raspbian Lite so everything works as it needs to

viktorgino commented 2 years ago

https://github.com/viktorgino/headunit-desktop/wiki/Setting-up-Headunit-Desktop-on-embedded-systems