Nheko-Reborn / nheko

Desktop client for Matrix using Qt and C++20.
https://nheko-reborn.github.io/
GNU General Public License v3.0
1.93k stars 201 forks source link

How to create a development environment on linux #522

Closed salahmak closed 3 years ago

salahmak commented 3 years ago

Hi, I'm looking into exploring the code of nheko and contributing to the project, but i'm getting kinda confused on what's the best way to create a development environment for it. I mean, I'm looking for the best way to compile the app after changing some code, i have tried some ways but I keep getting a large executable (around 200mb) which i don't think is good for development purposes, I think i have all build dependencies listed in the readme installed, and here are the approaches I have considered so far:

cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug
cmake --build build

when using the commands above to compile, it compiles some sources and at around 41% it fails with this error: https://pastebin.com/H0gFrHsM

so then i have tried the second approach:

cmake -S. -Bbuild -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF -DUSE_BUNDLED_OPENSSL=OFF
cmake --build build --config Debug

this gets the job done, it compiled the project after a long time but it then linked everything to the executable, which resulted in a huge executable (230mb) which i don't think is practical since I am just launching the app locally also i have noticed that the installed executable under /usr/bin is only 8mb, so that's why I have decided to ask here for the best approach to build the app since I'm not so familiar with cmake.

Thanks in advance

deepbluev7 commented 3 years ago

If you have most of the dependencies available, using just the bundled mtxclient and otherwise disabling hunter is usually a good idea. In your first case it failed, because the mtxclient version on your system is too old, the following command may work:

cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DUSE_BUNDLED_MTXCLIENT=ON -DUSE_BUNDLED_LMDBXX=ON
cmake --build build

This works, because hunter is not needed for all dependencies, some are just plain FetchContent cmake projects.

Otherwise it is usually easier to provide such support via matrix, so I'd suggest you join #nheko:neko.im, so that we can work out any issues.

There is also nothing wrong with your second approach. Yes, the binary will be huge, because everything is built into the executable and you are building a debug version, but that doesn't cause that many issues in a development build and makes debugging a bit easier.

salahmak commented 3 years ago

i'm trying to register on the neko.im homeserver but it won't for some reason (I'm new to the matrix world, so it is kinda confusing)

deepbluev7 commented 3 years ago

The nheko.im server currently doesn't have open registration, but you can join that room from any matrix homeserver (unless the admins disabled federation).