Repository navigation
Require C++17 - #9481
Require C++17#9481pdillinger wants to merge 17 commits into
Conversation
Summary: Drop support for some old compilers by requiring C++17 standard (or higher). See meta#9388 Test Plan: CI config updated TODO: finish sanitizing CircleCI config
mrambacher
left a comment
There was a problem hiding this comment.
This generally looks good to me.
For the Linux boxes, I wonder if using "-j$(nproc)" might be a better paradigm. The parallelism seems to inconsistent.
|
|
||
| simple_example: librocksdb simple_example.cc | ||
| $(CXX) $(CXXFLAGS) [email protected] -o$@ ../librocksdb.a -I../include -O2 -std=c++11 $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS) | ||
| $(CXX) $(CXXFLAGS) [email protected] -o$@ ../librocksdb.a -I../include -O2 -std=c++17 $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS) |
There was a problem hiding this comment.
What happens if the examples do not specify a --std? Won't it build with the default for the compiler? And if that is less than 17, what will happen?
If we are requiring that std be set and be at least 17, then that probably also needs to be updated on the README/build instructions. If 17 is the lowest we are supporting (and most/all compilers default to it or higher), then I do not know this line is necessary.
| - install-gflags | ||
| - upgrade-cmake | ||
| - run: (mkdir build && cd build && cmake -DWITH_GFLAGS=1 .. && make V=1 -j20 && ctest -j20) 2>&1 | .circleci/cat_ignore_eagain | ||
| - run: (mkdir build && cd build && cmake -DWITH_GFLAGS=1 .. && make V=1 -j20 && ctest -j20) |
There was a problem hiding this comment.
Can you please add a comment (could be in the PR and not the config file) as to why you are dropping the redirection everywhere?
I'm not touching this at this time.
You'll get errors like undefined |
|
@pdillinger has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
| - install-gflags | ||
| - upgrade-cmake | ||
| - run: (mkdir build && cd build && cmake -DWITH_GFLAGS=1 .. && make V=1 -j20 && ctest -j20) 2>&1 | .circleci/cat_ignore_eagain | ||
| - run: (mkdir build && cd build && cmake -DWITH_GFLAGS=1 .. && make V=1 -j20 && ctest -j20) |
There was a problem hiding this comment.
Should this be -j 32? Every other use of 2xlarge used -j32
There was a problem hiding this comment.
This PR is not about parallelism in CircleCI
| - install-gflags | ||
| - install-benchmark | ||
| - run: (mkdir build && cd build && cmake -DWITH_GFLAGS=1 -DWITH_BENCHMARK=1 .. && make V=1 -j20 && ctest -j20) 2>&1 | .circleci/cat_ignore_eagain | ||
| - run: (mkdir build && cd build && cmake -DWITH_GFLAGS=1 -DWITH_BENCHMARK=1 .. && make V=1 -j20 && ctest -j20) |
There was a problem hiding this comment.
This PR is not about parallelism in CircleCI
| - pre-steps | ||
| - install-benchmark | ||
| - run: DEBUG_LEVEL=0 make microbench 2>&1 | .circleci/cat_ignore_eagain | ||
| - run: DEBUG_LEVEL=0 make microbench |
There was a problem hiding this comment.
This PR is not about parallelism in CircleCI
| name: "Build examples" | ||
| command: | | ||
| OPT=-DTRAVIS V=1 make -j4 static_lib && cd examples && make -j4 | ../.circleci/cat_ignore_eagain | ||
| OPT=-DTRAVIS V=1 make -j4 static_lib && cd examples && make -j4 |
There was a problem hiding this comment.
This PR is not about parallelism in CircleCI
| if(HAVE_THREAD_LOCAL) | ||
| add_definitions(-DROCKSDB_SUPPORT_THREAD_LOCAL) | ||
| endif() | ||
| # Thread-local is part of C++11 (TODO: clean up this flag) |
There was a problem hiding this comment.
C++17 or part of the C++ standard. (It is a bit confusing to say C++11 when we say we support 17 only.
There was a problem hiding this comment.
C++11 is factually accurate. I'm pointing out that the check has been effectively obsolete for a long time.
|
|
||
| * **Linux - Ubuntu** | ||
| * Upgrade your gcc to version at least 4.8 to get C++11 support. | ||
| * Upgrade your gcc to version at least 7 to get C++17 support. |
There was a problem hiding this comment.
Should this mention clang?
There was a problem hiding this comment.
It's not the default compiler on Ubuntu
There was a problem hiding this comment.
Understood that it is not the default compiler. Nowhere in INSTALL does it say we support clang (on any platform) and what the minimum clang version is. Can we add that somewhere?
There was a problem hiding this comment.
It's near the top, "We do depend on newer gcc/clang with C++17 support (GCC >= 7, Clang >= 5)."
| #ifdef __cpp_lib_string_view | ||
| // Create a slice that refers to the same contents as "sv" | ||
| /* implicit */ | ||
| Slice(std::string_view sv) : data_(sv.data()), size_(sv.size()) {} |
There was a problem hiding this comment.
Should this pass in a const std::string_view& ?
|
@pdillinger has updated the pull request. You must reimport the pull request before landing. |
1 similar comment
|
@pdillinger has updated the pull request. You must reimport the pull request before landing. |
|
@pdillinger has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
1 similar comment
|
@pdillinger has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This reverts commit fd3e0f4.
Summary: After meta#9481, we are using newer default compiler for build-format-compatible CircleCI nightly job, which fails on building 2.2.fb.branch branch because it tries to use a pre-compiled libsnappy.a that is checked into the repo (!). This works around that by setting SNAPPY_LDFLAGS=-lsnappy, which is only understood by such old versions. Test Plan: Run check_format_compatible.sh on Ubuntu 20 AWS machine, watch nightly run
Summary: ... seen only in internal clang-analyze runs after #9481 * Mostly, this works around falsely reported leaks by using std::unique_ptr in some places where clang-analyze was getting confused. (I didn't see any changes in C++17 that could make our Status implementation leak memory.) * Also fixed SetBGError returning address of a stack variable. * Also fixed another false null deref report by adding an assert. Also, use SKIP_LINK=1 to speed up `make analyze` Pull Request resolved: #9515 Test Plan: Was able to reproduce the reported errors locally and verify they're fixed (except SetBGError). Otherwise, existing tests Reviewed By: hx235 Differential Revision: D34054630 Pulled By: pdillinger fbshipit-source-id: 38600ef3da75ddca307dff96b7a1a523c2885c2e
Summary: After #9481, we are using newer default compiler for build-format-compatible CircleCI nightly job, which fails on building 2.2.fb.branch branch because it tries to use a pre-compiled libsnappy.a that is checked into the repo (!). This works around that by setting SNAPPY_LDFLAGS=-lsnappy, which is only understood by such old versions. Pull Request resolved: #9517 Test Plan: Run check_format_compatible.sh on Ubuntu 20 AWS machine, watch nightly run Reviewed By: hx235 Differential Revision: D34055561 Pulled By: pdillinger fbshipit-source-id: 45f9d428dd082f026773bfa8d9dd4dad66fc9378
Summary: Drop support for some old compilers by requiring C++17 standard (or higher). See meta#9388 First modification based on this is to remove some conditional compilation in slice.h (also better for ODR) Also in this PR: * Fix some Makefile formatting that seems to affect ASSERT_STATUS_CHECKED config in some cases * Add c_test to NON_PARALLEL_TEST in Makefile * Fix a clang-analyze reported "potential leak" in lru_cache_test * Better "compatibility" definition of DEFINE_uint32 for old versions of gflags * Fix a linking problem with shared libraries in Makefile (`./random_test: error while loading shared libraries: librocksdb.so.6.29: cannot open shared object file: No such file or directory`) * Always set ROCKSDB_SUPPORT_THREAD_LOCAL and use thread_local (from C++11) * TODO in later PR: clean up that obsolete flag * Fix a cosmetic typo in c.h (meta#9488) Pull Request resolved: meta#9481 Test Plan: CircleCI config substantially updated. * Upgrade to latest Ubuntu images for each release * Generally prefer Ubuntu 20, but keep a couple Ubuntu 16 builds with oldest supported compilers, to ensure compatibility * Remove .circleci/cat_ignore_eagain except for Ubuntu 16 builds, because this is to work around a kernel bug that should not affect anything but Ubuntu 16. * Remove designated gcc-9 build, because the default linux build now uses GCC 9 from Ubuntu 20. * Add some `apt-key add` to fix some apt "couldn't be verified" errors * Generally drop SKIP_LINK=1; work-around no longer needed * Generally `add-apt-repository` before `apt-get update` as manual testing indicated the reverse might not work. Travis: * Use gcc-7 by default (remove specific gcc-7 and gcc-4.8 builds) * TODO in later PR: fix s390x "Assembler messages: Error: invalid switch -march=z14" failure AppVeyor: * Completely dropped because we are dropping VS2015 support and CircleCI covers VS >= 2017 Also local testing with old gflags (out of necessity when using ROCKSDB_NO_FBCODE=1). Reviewed By: mrambacher Differential Revision: D33946377 Pulled By: pdillinger fbshipit-source-id: ae077c823905b45370a26c0103ada119459da6c1
Summary: ... seen only in internal clang-analyze runs after meta#9481 * Mostly, this works around falsely reported leaks by using std::unique_ptr in some places where clang-analyze was getting confused. (I didn't see any changes in C++17 that could make our Status implementation leak memory.) * Also fixed SetBGError returning address of a stack variable. * Also fixed another false null deref report by adding an assert. Also, use SKIP_LINK=1 to speed up `make analyze` Pull Request resolved: meta#9515 Test Plan: Was able to reproduce the reported errors locally and verify they're fixed (except SetBGError). Otherwise, existing tests Reviewed By: hx235 Differential Revision: D34054630 Pulled By: pdillinger fbshipit-source-id: 38600ef3da75ddca307dff96b7a1a523c2885c2e
Summary: After meta#9481, we are using newer default compiler for build-format-compatible CircleCI nightly job, which fails on building 2.2.fb.branch branch because it tries to use a pre-compiled libsnappy.a that is checked into the repo (!). This works around that by setting SNAPPY_LDFLAGS=-lsnappy, which is only understood by such old versions. Pull Request resolved: meta#9517 Test Plan: Run check_format_compatible.sh on Ubuntu 20 AWS machine, watch nightly run Reviewed By: hx235 Differential Revision: D34055561 Pulled By: pdillinger fbshipit-source-id: 45f9d428dd082f026773bfa8d9dd4dad66fc9378
Summary: Drop support for some old compilers by requiring C++17 standard
(or higher). See #9388
First modification based on this is to remove some conditional compilation in slice.h (also
better for ODR)
Also in this PR:
some cases
./random_test: error while loading shared libraries: librocksdb.so.6.29: cannot open shared object file: No such file or directory)Test Plan: CircleCI config substantially updated.
compilers, to ensure compatibility
around a kernel bug that should not affect anything but Ubuntu 16.
Ubuntu 20.
apt-key addto fix some apt "couldn't be verified" errorsadd-apt-repositorybeforeapt-get updateas manual testing indicated thereverse might not work.
Travis:
AppVeyor:
VS >= 2017
Also local testing with old gflags (out of necessity when using ROCKSDB_NO_FBCODE=1).