src/qt/README.md is unclear/incomplete regarding “Setup Qt Creator” #240

issue benliepert openend this issue on March 5, 2021
  1. benliepert commented at 4:53 pm on March 5, 2021: none

    I’m going through the gui/src/qt/README.md to set up a development environment in Ubuntu. I had 2 issues:

    1. I got errors for every “#include <qt/. . .>”. I believe this is because creator has no sense of where the qt directory is when it’s the absolute path of the project (step 4), as the root directory of the project is named “bitcoin-qt”. Removing “qt/” from relevant includes, or importing the project with absolute path of gui/ or gui/src resolves this.

    2. I got “file not found” errors for all of the Qt core #includes (QApplication, QDebug, QSettings, etc)

    For what it’s worth, I had identical behavior in Arch Linux.

  2. hebasto commented at 5:17 pm on March 5, 2021: member
  3. hebasto added the label Doc on Mar 5, 2021
  4. jarolrod commented at 8:21 pm on March 5, 2021: member

    Just went through the whole build process and qtcreator set up on a clean install of Ubuntu 20.04.1. Tested that I can run the executable from qtcreator, I can make changes and build with qtcreator. Cannot replicate the errors described.

    Screen Shot 2021-03-05 at 3 08 28 PM

    Here are some notes on setting up the project in qt creator:

    • you must build bitcoin before importing the project into qtcreator
    • when building bitcoin and you get to the configure stage, add the --enable-debug flag
    • At Step 4, you must enter the absolute path to the qt director: /home/{USER}/gui/src/qt
    • Leave the default include files as is! You may need to re-select the forms folder to ensure the ui files are included (if you wish to edit those), that’s all.
    • Make sure that you go to Projects -> Manage Kits and verify that the correct values are selected as described in step 7

    Performing these steps should get you up and running. After verifying these steps, please let us know if this is still a problem.

  5. benliepert commented at 10:32 pm on March 5, 2021: none

    I tried with a clean install of Ubuntu 20.04 (virtualbox 6.1.18). I am able to build and run without issues in qtcreator. However, I have the same errors for almost every include:

    file-not-found

    This is my full system history:

     0    1  reboot
     1    2  sudo apt install gcc make
     2    3  cd /media/ben/
     3    4  ll
     4    5  cd VBox_GAs_6.1.18/
     5    6  ll
     6    7  ./VBoxLinuxAdditions.run 
     7    8  sudo ./VBoxLinuxAdditions.run 
     8    9  shutdown now
     9   10  sudo apt install git
    10   11  git clone git@github.com:bitcoin-core/gui.git
    11   12  git clone https://github.com/bitcoin-core/gui.git
    12   13  cd gui/
    13   14  ll
    14   15  sudo apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3
    15   16  sudo apt-get install libevent-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-test-dev
    16   17  sudo apt install libsqlite3-dev
    17   18  sudo apt install libminiupnpc-dev libnatpmp-dev
    18   19  sudo apt-get install libzmq3-dev
    19   20  sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools
    20   21  sudo apt-get install libqrencode-dev
    21   22  ./contrib/install_db4.sh `pwd`
    22   23  history
    23   24  export BDB_PREFIX='/home/ben/gui/db4'
    24   25  ./autogen.sh
    25   26  ./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include" --enable-debug
    26   27  make -j6
    27   28  sudo apt install qtcreator
    28   29  qtcreator &
    

    After that, import existing project, title “bitcoin-qt”, path /home/ben/gui/src/qt. Selected the forms folder and added to git. Compilers (GCC), debugger (GDB) and executable are set.

    This is what my end of my ./configure output looks like:

     0Build Options:
     1  with ecmult precomp     = yes
     2  with external callbacks = no
     3  with benchmarks         = no
     4  with tests              = yes
     5  with openssl tests      = no
     6  with coverage           = no
     7  module ecdh             = no
     8  module recovery         = yes
     9  module extrakeys        = yes
    10  module schnorrsig       = yes
    11
    12  asm                     = x86_64
    13  bignum                  = no
    14  ecmult window size      = 15
    15  ecmult gen prec. bits   = 4
    16
    17  valgrind                = no
    18  CC                      = gcc
    19  CFLAGS                  = -O2 -fvisibility=hidden -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef -Wno-unused-function -Wno-long-long -Wno-overlength-strings -W -g
    20  CPPFLAGS                = 
    21  LDFLAGS                 = 
    22
    23
    24Options used to compile and link:
    25  external signer = no
    26  multiprocess    = no
    27  with libs       = yes
    28  with wallet     = yes
    29    with sqlite   = yes
    30    with bdb      = yes
    31  with gui / qt   = yes
    32    with qr       = yes
    33  with zmq        = yes
    34  with test       = yes
    35  with bench      = yes
    36  with upnp       = yes
    37  with natpmp     = yes
    38  use asm         = yes
    39  ebpf tracing    = no
    40  sanitizers      = 
    41  debug enabled   = yes
    42  gprof enabled   = no
    43  werror          = no
    44
    45  target os       = linux
    46  build os        = linux-gnu
    47
    48  CC              = gcc
    49  CFLAGS          = -pthread -g -O2
    50  CPPFLAGS        =  -DDEBUG -DDEBUG_LOCKORDER -DABORT_ON_FAILED_ASSUME   -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -DPROVIDE_FUZZ_MAIN_FUNCTION
    51  CXX             = g++ -std=c++17
    52  CXXFLAGS        =  -O0 -g3 -ftrapv  -fstack-reuse=none -Wstack-protector -fstack-protector-all -fcf-protection=full -fstack-clash-protection  -Wall -Wextra -Wformat -Wformat-security -Wvla -Wswitch -Wredundant-decls -Wunused-variable -Wdate-time -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Woverloaded-virtual -Wsuggest-override  -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-deprecated-copy    -fno-extended-identifiers
    53  LDFLAGS         = -lpthread  -Wl,-z,relro -Wl,-z,now -Wl,-z,separate-code -pie  
    54  ARFLAGS         = cr
    
  6. jarolrod commented at 10:35 pm on March 5, 2021: member
    In project->manage kits, what do you see under Qt versions?
  7. benliepert commented at 10:37 pm on March 5, 2021: none
    Under Manage Kits…->Kits->Desktop (default)-> Qt version: Qt 5.12.8 in PATH (System) There’s also an option for Qt 5.12.8 in PATH (qt5)
  8. jarolrod commented at 10:46 pm on March 5, 2021: member
    @benliepert confirming I can replicate the issue with includes, #1 in OP is fixed by using gui/ as root instead of gui/src/qt, #2 is still an issue and may require what the OP states
  9. benliepert commented at 2:23 am on March 6, 2021: none
    I’m editing my initial comment to avoid confusion, as I was wrong about resolving #2: it seems some Qt constructs aren’t found/known but I can’t see a consistent pattern
  10. jarolrod commented at 5:52 pm on May 1, 2021: member

    @hebasto I think this can be closed.

    Upon the removal of the bitcoin-qt.pro file in https://github.com/bitcoin/bitcoin/pull/21695, it can be said that we do not actively promote the use of Qt Creator as an IDE. That being said it does provide a convenient way to make changes to the *.ui files, and the current instructions will get you to a point where you can do so.

  11. hebasto closed this on May 8, 2021

  12. bitcoin-core locked this on Aug 16, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-21 12:20 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me