Status Desktop
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Building Status Desktop ## Building ### 0. Prerequesites On windows you can simply run the [`scripts/windows_build_setup.ps1`](https://github.com/status-im/status-desktop/blob/master/scripts/windows_build_setup.ps1) script in a PowerShell with Administrator privileges. ``` Install Chocolatey --> https://chocolatey.org/install#individual Install Make --> https://community.chocolatey.org/packages/make Install cmake --> https://community.chocolatey.org/packages/cmake Install mingw --> https://community.chocolatey.org/packages/mingw Install GNU wget --> https://community.chocolatey.org/packages/Wget/1.20.3.20190531 Install Go --> https://go.dev/doc/install ``` On Mac Install brew and run the following commands ``` # Brew Install Brew and follow the instructions on https://brew.sh/ - brew install cmake - brew install pkg-config # Go - (used to build status-go) - brew install go # JQ and Node - brew install jq - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash # Then add this to .zshrc - export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm # finally, run - nvm install --lts # or - nvm install 14 - nvm use 14 # update npm - npm install -g npm@latest ``` On Linux Install these dependency first: ``` # Debian/Ubuntu: - sudo apt install libpcsclite-dev - sudo apt install libpcre3-dev - sudo apt install build-essential - sudo apt install mesa-common-dev libglu1-mesa-dev - sudo apt install libssl-dev - sudo apt install cmake * Go - (used to build status-go) Install GO -Follow the instructions in https://golang.org/doc/install * JQ and Node - sudo apt install jq - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash # Then add this to .bashrc - export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm # finally, run - nvm install lts # or - nvm install 14 - nvm use 14 # update npm - npm install -g npm@latest ``` ### 1. Install QT, and add it to the PATH * QT (Mac,Windows,Linux) **IMPORTANT:** Due to [a bug](https://github.com/status-im/status-desktop/commit/7b07a31fa6d06c730cf563475d319f0217a211ca) in version `5.15.0`, this project is locked to version `5.14.2`. Make sure to select version `5.14.2` when installing Qt via the installer. Install QT from https://www.qt.io/download-qt-installer and add it to the PATH ``` # Linux export PATH=$PATH:/path/to/Qt/5.14.2/gcc_64/bin export QTDIR="/path/to/Qt/5.14.2/gcc_64" export PATH="${QTDIR}/bin:${PATH}" # macos (~/.zshrc) export PATH=$PATH:/path/to/Qt/5.14.2/clang_64/bin export QTDIR="/path/to/Qt/5.14.2/clang_64" export PATH="${QTDIR}/bin:${PATH}" # On MacOS in addtion to above the below needs to be set export GITHUB_USER=<user name> export GITHUB_TOKEN=<personal access token from github> # Windows ***On Windows***: Ensure that the following env vars point correctly: - QTDIR --> [PATH_TO_QT installation]/5.14.2/msvc2017_64 - QTBASE --> [PATH_TO_QT installation] - QTPATH --> [PATH_TO_QT installation]/5.14.2 And add the following bin paths to PATH: - [PATH_TO_QT installation]/5.14.2/msvc2017_64/bin - [PATH_TO_QT installation]/Tools/mingw730_64/bin - [PATH_TO_QT installation]/Tools/CMake_64/bin ``` ### 2. Clone the repo and build dependencies (Mac, Windows,linux) Ideally, run these on a Bash terminal rather than Powershell: ``` git clone https://github.com/status-im/status-desktop cd status-desktop make update ``` *Note:* It might take a while to compile Nim For more output use `make V=1 ...`. Use 4 CPU cores with `make -j4 ...`. Users with manually installed Qt5 packages need to run `make QTDIR="/path/to/Qt" ...` After successful 'make update', do a 'make run'. This should launch the desktop app **Troubleshooting**: If the `make` command fails due to already installed Homebrew packages, such as: ``` Error: protobuf 3.11.4 is already installed To upgrade to 3.11.4_1, run `brew upgrade protobuf`. make[1]: *** [install-os-dependencies] Error 1 make: *** [vendor/status-go/build/bin/libstatus.a] Error 2 ``` This can be fixed by uninstalling the package e.g. `brew uninstall protobuf` followed by rerunning `make`. ***On MacOS***: If you get build error similar to the one below ``` ld: warning: argument missing after -rpath ld: can't map file, errno=22 file '/Users/khushboo/Documents/Status/status-desktop/vendor/status-go/build/bin' for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: execution of an external program failed: 'clang @nim_status_client_linkerArgs.txt' make: *** [nim_status_client] Error 1 ``` Copy /path/to/Qt/5.14.2/clang_64/lib/* inside /Users/qt/work/install/lib Or If you see build error similar to this ``` find: vendor/status-go/build/bin/libstatus.dylib: No such file or directory \e[92mBuilding:\e[39m status-go make: *** [vendor/status-go/build/bin/libstatus.dylib] Error 2 ``` And when you try `make V=1 run` you also see error like ``` go119.go:6:13: cannot use "quic-go doesn't build on Go 1.19 yet." (untyped string constant) as int value in variable declaration make[1]: *** [statusgo-shared-library] Error 2 make: *** [vendor/status-go/build/bin/libstatus.dylib] Error 2 ``` You need to install Go version 1.18 ``` brew install go@1.18 # Unlink current version brew unlink go # And then you can link a different version brew link go@1.18 ``` ***On Linux***: If you see this warnings in logs ``` qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get_peer_certificate ...QML Image: SSL handshake failed ...QML AnimatedImage: Error Reading Animated Image File https://... ``` and instead of images in Chat you see `Error loading the image` you need to manually install openssl1.1 ``` # Fetch the tarball: wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz # Unpack the tarball with tar -zxf openssl-1.1.1g.tar.gz && cd openssl-1.1.1g # Issue the command ./config # Issue the command make # Run tests to check for possible errors. make test # Backup current openssl binary: sudo mv /usr/bin/openssl ~/tmp # Issue the command sudo make install # Create symbolic link from newly install binary to the default location: sudo ln -s /usr/local/bin/openssl /usr/bin/openssl # Update symlinks and rebuild the library cache sudo ldconfig ``` ### 3. Build and run the app ``` make run # or LD_LIBRARY_PATH=vendor/DOtherSide/lib make run ``` **NB**: if you run the app at the same time as another Desktop instance (eg a release build), ports will conflict. To solve that, use the `SHIFT_PORT` enironment variable. ``` export SHIFT_PORT=1 && make run ``` The number is what the base port is added with. For example, the default port for WAKU v2 is `60000`, so with `SHIFT_PORT=1`, the port is now `60001`. Using `SHIFT_PORT`, you can easily spin up more than one instance, so long as they don't point to the same data folder (eg different clones). ### Build the app without running it ``` make ``` ### Running with log level **Application in release mode does not produce logs.** During the development process, all logs are displayed and saved to the log file. A developer can change the log level when starting the application. In order to do that, the LOG_LEVEL environment variable should be set. Possible log levels: TRACE, DEBUG, INFO, NOTICE, WARN, ERROR, FATAL, and NONE. Example: ``` make run LOG_LEVEL=ERROR # display only ERROR and FATAL logs ``` ## Development When modifying `.nim` files that are not tracked by `make`, e.g. `vendor/*.nim`, then `REBUILD_NIM=true` can be supplied to `make` to ensure a rebuild of `bin/nim_status_client`. ``` make REBUILD_NIM=true run ``` It is *not* necessary to supply `REBUILD_NIM=true` after `make update`. When modifying `ui/` files that are not tracked by `make`, e.g. `ui/shared/img/*.svg`, then `REBUILD_UI=true` can be supplied to `make` to ensure a rebuild of `resources.rcc`. ``` make REBUILD_UI=true run ``` It is possible to supply both `make` variables, if needed: ``` make REBUILD_NIM=true REBUILD_UI=true run ``` ### Developer environment considerations To have `nim` code parsing, set the environment variables before opening your IDE. E.g. for VScode run `./env.sh code .` in the source root folder ### Dependencies considerations `status-go` - `status-go` library (`libstatus.dylib`) builds only if missing. Therefore, you must remove the library if you make `status-go` changes, switch branches and change HEAD with a different library version. - to remove the lib and trigger recompilation `rm vendor/status-go/build/bin/libstatus.dylib` - `make clean` sometimes fails to remove all the build artefacts for some dependencies. If unrelated compile errors persist, try removing the `vendors` folder entirely, update missing dependencies `make update`, compile and run the app: `make run` ### Data folder The developer builds (using `make run`) compiled with `make` will generate and use the `Status` data folder in the root of the source tree as the user folder. The release binaries (CI or `make pkg`) will use a user location to create and load user data. See [here](https://status.im/user_guides/desktop_beta_install.html). For testing purposes, use a custom data folder by passing `-d` flag. ### Debugging aids Helper environment variables to change the communication ports when running multiple instances on the same host - Options - [`PORT_SHIFT`](https://github.com/status-im/status-desktop/pull/8554) increments with the provided value the default ports for: - waku V2 ports (will change incoming TCP and Discovery V5 UDP) - community history archive torrents port ## Cold Reload ### "Cold" reload using VSCode We can setup a "cold" reload, whereby the app will be rebuilt and restarted when changes in the source are saved. This will not save state, as the app will be restarted, but it will save us some time from manually restarting the app. We can handily force an app rebuild/relaunch with the shortcut `Cmd+Shift+b` (execute the default build task, which we'll setup below). To enable a meagre app reload during development, first creates a task in `.vscode/tasks.json`. This task sets up the default build task for the workspace, and depends on the task that compiles our nim: ```json ({ "label": "Build Nim Status Client", "type": "shell", "command": "nim", "args": [ "c", "-L:lib/libstatus.dylib", "-L:-lm", "-L:\"-framework Foundation -framework Security -framework IOKit -framework CoreServices\"", "--outdir:./bin", "src/nim_status_client.nim" ], "options": { "cwd": "${workspaceRoot}" } }, { "label": "Run nim_status_client", "type": "shell", "command": "bash", "args": ["./run.sh"], "options": { "cwd": "${workspaceRoot}/.vscode" }, "dependsOn": ["Build Nim Status Client"], "group": { "kind": "build", "isDefault": true } }) ``` Next, add a `.vscode/run.sh` file, changing the `DOtherSide` lib path to be specific to your environment: ```bash export LD_LIBRARY_PATH="/Users/emizzle/repos/github.com/filcuc/DOtherSide/build/lib" ../bin/nim_status_client ``` # Auto build on save (for the "cold" reload effect) Finally, to get trigger this default build task when our files our saved, we need to enable a task to be run while `.nim` files are saved, and when `.qml` files are saved. ### Build on save To build on save of our source files, first install the "Trigger Task on Save" VS Code extension to detect changes to our changable files, which will trigger a build/run. Once installed, update `settings.json` like so: ```json "files.autoSave": "afterDelay", "triggerTaskOnSave.tasks": { "Run nim_status_client": ["ui/**/*", "src/*.nim"] }, "triggerTaskOnSave.restart": true, "triggerTaskOnSave.showStatusBarToggle": true ``` # Building QT 5.15 on macOs M1 (experimental, still does not work) > Do not follow these instructions. They're kept here for when we revisit compiling > desktop to M1, instead of using Rosetta ``` brew install python brew install perl git clone git://code.qt.io/qt/qt5.git cd qt5 git checkout 5.15 perl init-repository --module-subset=default ``` Edit the file `qtbase/mkspecs/common/macx.conf b/mkspecs/common/macx.conf` and set the following values - `QMAKE_MACOSX_DEPLOYMENT_TARGET = 11.0` - `QMAKE_APPLE_DEVICE_ARCHS = arm64` - `QT_MAC_SDK_VERSION_MIN = 11.0` TODO: configure. This does not build webengine for some reason ``` qt5/configure \ -opensource \ -prefix DIR_TO_BUILD_QT_GOES_HERE \ -feature-relocatable \ -release \ -optimize-size \ -force-debug-info \ -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql -no-sql-tds \ -nomake examples \ -nomake tests \ -no-freetype -no-harfbuzz \ -no-openssl -securetransport \ -no-icu \ -no-fontconfig make -j8 make install ``` # Building arm64 Desktop on macOs (experimental, still does not work) ``` TODO: rramos: i got desktop to run building QT, but I could not get webengine to compile. Also status-go failed with the error described here https://github.com/golang/go/issues/48437 (I added a condition in ./Makefile, QR-code-generator/c/Makefile and status-go/Makefile to crosscompile to amd-64 in the meantime) ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully