# QT Application build
### Requirements:
* Install QT 5.12.12. (Check the workdrive or the backup storage for the file).
```
./qt-opensource-linux-x64-5.12.12.run
```
* Install Gstreamer 1.21.1 fromsource. Follow its hackmd for installation
* Pull the latest OctoGUI package from Github
```
git clone git@github.com:octobotics/OctoGUI.git
```
---
### Build Instructions:
* Open OctoGUI in QT Creator.
* After making changes, specify build-debug and build-release paths in the Projects section of QT creator.
* Build debug and build release the app.
* Now, go to the app location.
* Make a new directory (maybe something like qt-build).
* Add the linuxqtdeploy and appimagetool files in the folder.
* Create a new dir inside qt-build (like octo-pkg).
* Copy the shared lib called "Octobotics App" from your app build-debug folder to octo-pkg.
* Now run this command inside the qt-build directory. Specify your qmake path and app dir path where your main.qml is stored.
```
./linuxdeployqt-5-x86_64.AppImage octo-pkg/OctoboticsApp -qmake=/home/octo/Qt5.12.12/5.12.12/gcc_64/bin/qmake -qmldir=/home/octo/app/OctoboticsApp/UI -appimage -bundle-non-qt-libs
```
* Run ./AppRun file and check if the UI is working without any gstreamer errors.
* If the app crashes, you have to change the Gstreamer shared library in octo-pkg/lib folder.
> WHY?
> The app, when building, generates all the shared libs that needs to be included to make it platform independent. So, It generates normal GStreamer 1.0 which doesnt have the nvcodec. As we are using nvh264dec to decode the stream using hardware, we need to build gstreamer from source which gets installed on the platform. So if we change the .so of gstreamer in the octo-pkg/lib, we can use the app in other platforms.
* Now go to your gstreamer .so dir, mostly /usr/lib/x86_64-linux-gnu, and copy the libgstreamer-1.0.so.0.2101.0 or similar file to the octo-pkg/lib.
* You can run ./AppRun and it should work now.
* But the final app image generated wont work because it has been built using the normal gstreamer.
* So get appimagetool from
```=
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod a+x appimagetool-x86_64.AppImage
```
* Go to the qt-build folder and run
```
./appimagetool-x86_64.AppImage octo-pkg
```
* This will build a new appImage from the latest octo-pkg and it should get the app working
## tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt
# Peace!
## tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt