Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
benliepert opened this issue Mar 5, 2021 · 8 comments
Closed
Labels

Comments

@benliepert
Copy link

benliepert commented Mar 5, 2021

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.

@hebasto
Copy link
Member

hebasto commented Mar 5, 2021

cc @jarolrod

@hebasto hebasto added the Doc label Mar 5, 2021
@jarolrod
Copy link
Member

jarolrod commented Mar 5, 2021

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.

@benliepert
Copy link
Author

benliepert commented Mar 5, 2021

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:

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

Build Options:
  with ecmult precomp     = yes
  with external callbacks = no
  with benchmarks         = no
  with tests              = yes
  with openssl tests      = no
  with coverage           = no
  module ecdh             = no
  module recovery         = yes
  module extrakeys        = yes
  module schnorrsig       = yes

  asm                     = x86_64
  bignum                  = no
  ecmult window size      = 15
  ecmult gen prec. bits   = 4

  valgrind                = no
  CC                      = gcc
  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
  CPPFLAGS                = 
  LDFLAGS                 = 


Options used to compile and link:
  external signer = no
  multiprocess    = no
  with libs       = yes
  with wallet     = yes
    with sqlite   = yes
    with bdb      = yes
  with gui / qt   = yes
    with qr       = yes
  with zmq        = yes
  with test       = yes
  with bench      = yes
  with upnp       = yes
  with natpmp     = yes
  use asm         = yes
  ebpf tracing    = no
  sanitizers      = 
  debug enabled   = yes
  gprof enabled   = no
  werror          = no

  target os       = linux
  build os        = linux-gnu

  CC              = gcc
  CFLAGS          = -pthread -g -O2
  CPPFLAGS        =  -DDEBUG -DDEBUG_LOCKORDER -DABORT_ON_FAILED_ASSUME   -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -DPROVIDE_FUZZ_MAIN_FUNCTION
  CXX             = g++ -std=c++17
  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
  LDFLAGS         = -lpthread  -Wl,-z,relro -Wl,-z,now -Wl,-z,separate-code -pie  
  ARFLAGS         = cr

@jarolrod
Copy link
Member

jarolrod commented Mar 5, 2021

In project->manage kits, what do you see under Qt versions?

@benliepert
Copy link
Author

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)

@jarolrod
Copy link
Member

jarolrod commented Mar 5, 2021

@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

@benliepert
Copy link
Author

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

@jarolrod
Copy link
Member

jarolrod commented May 1, 2021

@hebasto I think this can be closed.

Upon the removal of the bitcoin-qt.pro file in bitcoin/bitcoin#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.

@hebasto hebasto closed this as completed May 8, 2021
@bitcoin-core bitcoin-core locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants