mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Merge #20471: build: use C++17 in depends
2f5dfe4a7f
depends: build qt in c++17 mode (fanquake)104e859c97
builds: don't pass -silent to qt when building in debug mode (fanquake)e2c500636c
depends: build zeromq with -std=c++17 (fanquake)2374f2fbef
depends: build Boost with -std=c++17 (fanquake)2dde55702d
depends: build bdb with -std=c++17 (fanquake) Pull request description: In packages where we are passing `-std=c++11` switch to `-std=c++17`, or, `-std=c++1z` in the case of Qt. This PR also contains a [commit](104e859c97
) that improves debug output when building Qt for debugging (`DEBUG=1`). Now we'll get output like this: ```bash g++ -c -pipe -ffunction-sections -O2 -fPIC -std=c++11 -fno-exceptions <lots more> ../../corelib/kernel/qcoreapplication.cpp ``` rather than just: ```bash compiling ../../corelib/kernel/qcoreapplication.cpp ``` Note that when you look at the DEBUG output for these changes when building Qt, you'll see objects being compiled with a mix of C++11 and C++17. The breakdown is roughly: 1. `qmake` built with `-std=c++11`: ```bash Creating qmake... make[1]: Entering directory '<trim>/qt/5.9.8-4110fa99945/qtbase/qmake' g++ -c -o project.o -std=c++11 -ffunction-sections -O2 -g <trim> <trim>/qt/5.9.8-4110fa99945/qtbase/qmake/project.cpp # when qmake, Qt also builds some of it's corelib, such as corelib/global/qmalloc.cpp g++ -c -o qmalloc.o -std=c++11 -ffunction-sections -O2 -g <trim> <trim>/qt/5.9.8-4110fa99945/qtbase/src/corelib/global/qmalloc.cpp ``` 2. `qmake` is run, and passed our build options, including `-c++std`: ```bash make[1]: Entering directory '<trim>/qt/5.9.8-4110fa99945/qtbase' <trim>qt/5.9.8-4110fa99945/qtbase/bin/qmake -o Makefile qtbase.pro -- -bindir <trim>/native/bin -c++std c++1z -confirm-license <trim> ``` 3. After some cleaning and configuring, we actually start to build Qt, as well as it's tools and internal libs: ```bash Building qt... make[1]: Entering directory '<trim>/qt/5.9.8-4110fa99945/qtbase/src' # build libpng, zlib etc gcc -c -m64 -pipe -pipe -O1 <trim> -o .obj/png.o png.c # build libQt5Bootstrap, using C++11, which again compiles qmalloc.cpp make[2]: Entering directory '<trim>/qt/5.9.8-4110fa99945/qtbase/src/tools/bootstrap' g++ -c -pipe -ffunction-sections -O2 -fPIC -std=c++11 <trim> -o .obj/qmalloc.o ../../corelib/global/qmalloc.cpp # build a bunch of tools like moc, rcc, uic, qfloat16-tables, qdbuscpp2xml, using C++11 g++ -c -pipe -O2 -std=c++11 -fno-exceptions -Wall -W <trim> -o .obj/rcc.o rcc.cpp # from here, Qt is compiled with -std=c++1z, including qmalloc.cpp, for the third and final time: g++ -c -include .pch/Qt5Core <trim> -g -Og -fPIC -std=c++1z -fvisibility=hidden <trim> -o .obj/qmalloc.o global/qmalloc.cpp ``` 4. Finally, build tools like `lrelease`, `lupdate`, etc, but back to using -std=c++11 ```bash make[1]: Entering directory '<trim>/qt/5.9.8-4110fa99945/qttools/src/linguist/lrelease' g++ -c -pipe -O2 -std=c++11 -fno-exceptions -Wall -W <trim> -o .obj/translator.o ../shared/translator.cpp ``` If you dump the debug info from the built Qt libs, they should also tell you that they were compiled with `C++17`: ```bash objdump -g bitcoin/depends/x86_64-pc-linux-gnu/lib/libQt5Core.a GNU C++17 9.3.0 -m64 -mtune=generic -march=x86-64 -g -O1 -Og -std=c++17 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fasynchronous-unwind-tables -fstack-protector-strong -fstack-clash-protection -fcf-protection ``` ACKs for top commit: laanwj: Code review ACK2f5dfe4a7f
practicalswift: cr ACK2f5dfe4a7f
: patch looks correct fjahr: Code review ACK2f5dfe4a7f
hebasto: ACK2f5dfe4a7f
, I have reviewed the code and it looks OK, I agree it can be merged. Tree-SHA512: fc5e9d7c7518c68349c8228fb1aead829850373efc960c9b8c079096a83d1dad19c62a9730fce5802322bf07e320960fd47851420d429eda0a87c307f4e8b03a
This commit is contained in:
commit
2e1336dbfe
5 changed files with 6 additions and 6 deletions
|
@ -15,7 +15,7 @@ export BDB_PREFIX="${BASE_ROOT_DIR}/db4"
|
|||
|
||||
export CONTAINER_NAME="ci_native_msan"
|
||||
export PACKAGES="clang-9 llvm-9 cmake"
|
||||
export DEP_OPTS="NO_BDB=1 NO_QT=1 CC='clang' CXX='clang++' CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}' boost_cxxflags='-std=c++11 -fvisibility=hidden -fPIC ${MSAN_AND_LIBCXX_FLAGS}' zeromq_cxxflags='-std=c++11 ${MSAN_AND_LIBCXX_FLAGS}'"
|
||||
export DEP_OPTS="NO_BDB=1 NO_QT=1 CC='clang' CXX='clang++' CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}' boost_cxxflags='-std=c++17 -fvisibility=hidden -fPIC ${MSAN_AND_LIBCXX_FLAGS}' zeromq_cxxflags='-std=c++17 ${MSAN_AND_LIBCXX_FLAGS}'"
|
||||
export GOAL="install"
|
||||
export BITCOIN_CONFIG="--enable-wallet --with-sanitizers=memory --with-asm=no --prefix=${BASE_ROOT_DIR}/depends/x86_64-pc-linux-gnu/ CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}' BDB_LIBS='-L${BDB_PREFIX}/lib -ldb_cxx-4.8' BDB_CFLAGS='-I${BDB_PREFIX}/include'"
|
||||
export USE_MEMORY_SANITIZER="true"
|
||||
|
|
|
@ -11,7 +11,7 @@ $(package)_config_opts=--disable-shared --enable-cxx --disable-replication --ena
|
|||
$(package)_config_opts_mingw32=--enable-mingw
|
||||
$(package)_config_opts_linux=--with-pic
|
||||
$(package)_cflags+=-Wno-error=implicit-function-declaration
|
||||
$(package)_cxxflags=-std=c++11
|
||||
$(package)_cxxflags=-std=c++17
|
||||
$(package)_cppflags_mingw32=-DUNICODE -D_UNICODE
|
||||
endef
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ else
|
|||
$(package)_toolset_$(host_os)=gcc
|
||||
endif
|
||||
$(package)_config_libraries=filesystem,system,thread,test
|
||||
$(package)_cxxflags=-std=c++11 -fvisibility=hidden
|
||||
$(package)_cxxflags=-std=c++17 -fvisibility=hidden
|
||||
$(package)_cxxflags_linux=-fPIC
|
||||
$(package)_cxxflags_android=-fPIC
|
||||
endef
|
||||
|
|
|
@ -26,9 +26,10 @@ $(package)_extra_sources += $($(package)_qttools_file_name)
|
|||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts_release = -release
|
||||
$(package)_config_opts_release += -silent
|
||||
$(package)_config_opts_debug = -debug
|
||||
$(package)_config_opts += -bindir $(build_prefix)/bin
|
||||
$(package)_config_opts += -c++std c++11
|
||||
$(package)_config_opts += -c++std c++1z
|
||||
$(package)_config_opts += -confirm-license
|
||||
$(package)_config_opts += -hostprefix $(build_prefix)
|
||||
$(package)_config_opts += -no-compile-examples
|
||||
|
@ -77,7 +78,6 @@ $(package)_config_opts += -qt-pcre
|
|||
$(package)_config_opts += -qt-harfbuzz
|
||||
$(package)_config_opts += -system-zlib
|
||||
$(package)_config_opts += -static
|
||||
$(package)_config_opts += -silent
|
||||
$(package)_config_opts += -v
|
||||
$(package)_config_opts += -no-feature-bearermanagement
|
||||
$(package)_config_opts += -no-feature-colordialog
|
||||
|
|
|
@ -12,7 +12,7 @@ define $(package)_set_vars
|
|||
$(package)_config_opts += --disable-Werror --disable-drafts --enable-option-checking
|
||||
$(package)_config_opts_linux=--with-pic
|
||||
$(package)_config_opts_android=--with-pic
|
||||
$(package)_cxxflags=-std=c++11
|
||||
$(package)_cxxflags=-std=c++17
|
||||
endef
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
|
|
Loading…
Add table
Reference in a new issue