Skip to content

Commit 2e1336d

Browse files
committed
Merge #20471: build: use C++17 in depends
2f5dfe4 depends: build qt in c++17 mode (fanquake) 104e859 builds: don't pass -silent to qt when building in debug mode (fanquake) e2c5006 depends: build zeromq with -std=c++17 (fanquake) 2374f2f depends: build Boost with -std=c++17 (fanquake) 2dde557 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](bitcoin/bitcoin@104e859) 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 ACK bitcoin/bitcoin@2f5dfe4 practicalswift: cr ACK 2f5dfe4: patch looks correct fjahr: Code review ACK 2f5dfe4 hebasto: ACK 2f5dfe4, I have reviewed the code and it looks OK, I agree it can be merged. Tree-SHA512: fc5e9d7c7518c68349c8228fb1aead829850373efc960c9b8c079096a83d1dad19c62a9730fce5802322bf07e320960fd47851420d429eda0a87c307f4e8b03a
2 parents 7ae86b3 + 2f5dfe4 commit 2e1336d

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

ci/test/00_setup_env_native_msan.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export BDB_PREFIX="${BASE_ROOT_DIR}/db4"
1515

1616
export CONTAINER_NAME="ci_native_msan"
1717
export PACKAGES="clang-9 llvm-9 cmake"
18-
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}'"
18+
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}'"
1919
export GOAL="install"
2020
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'"
2121
export USE_MEMORY_SANITIZER="true"

depends/packages/bdb.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ $(package)_config_opts=--disable-shared --enable-cxx --disable-replication --ena
1111
$(package)_config_opts_mingw32=--enable-mingw
1212
$(package)_config_opts_linux=--with-pic
1313
$(package)_cflags+=-Wno-error=implicit-function-declaration
14-
$(package)_cxxflags=-std=c++11
14+
$(package)_cxxflags=-std=c++17
1515
$(package)_cppflags_mingw32=-DUNICODE -D_UNICODE
1616
endef
1717

depends/packages/boost.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ else
2323
$(package)_toolset_$(host_os)=gcc
2424
endif
2525
$(package)_config_libraries=filesystem,system,thread,test
26-
$(package)_cxxflags=-std=c++11 -fvisibility=hidden
26+
$(package)_cxxflags=-std=c++17 -fvisibility=hidden
2727
$(package)_cxxflags_linux=-fPIC
2828
$(package)_cxxflags_android=-fPIC
2929
endef

depends/packages/qt.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ $(package)_extra_sources += $($(package)_qttools_file_name)
2626

2727
define $(package)_set_vars
2828
$(package)_config_opts_release = -release
29+
$(package)_config_opts_release += -silent
2930
$(package)_config_opts_debug = -debug
3031
$(package)_config_opts += -bindir $(build_prefix)/bin
31-
$(package)_config_opts += -c++std c++11
32+
$(package)_config_opts += -c++std c++1z
3233
$(package)_config_opts += -confirm-license
3334
$(package)_config_opts += -hostprefix $(build_prefix)
3435
$(package)_config_opts += -no-compile-examples
@@ -77,7 +78,6 @@ $(package)_config_opts += -qt-pcre
7778
$(package)_config_opts += -qt-harfbuzz
7879
$(package)_config_opts += -system-zlib
7980
$(package)_config_opts += -static
80-
$(package)_config_opts += -silent
8181
$(package)_config_opts += -v
8282
$(package)_config_opts += -no-feature-bearermanagement
8383
$(package)_config_opts += -no-feature-colordialog

depends/packages/zeromq.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ define $(package)_set_vars
1212
$(package)_config_opts += --disable-Werror --disable-drafts --enable-option-checking
1313
$(package)_config_opts_linux=--with-pic
1414
$(package)_config_opts_android=--with-pic
15-
$(package)_cxxflags=-std=c++11
15+
$(package)_cxxflags=-std=c++17
1616
endef
1717

1818
define $(package)_preprocess_cmds

0 commit comments

Comments
 (0)