-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Compatible changes with g++4.9.2 and cmake. #6043
Conversation
@@ -1070,6 +1069,7 @@ if(WITH_TESTS) | |||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) | |||
set(TESTUTILLIB testutillib${ARTIFACT_SUFFIX}) | |||
add_library(${TESTUTILLIB} STATIC ${TESTUTIL_SOURCE}) | |||
target_link_libraries(${TESTUTILLIB} ${LIBS}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@merryChris this makes sense, as some source files (db/db_test_util.h
for instance) in ${TESTUTILLIB}
actually references headers used by ROCKSDB_STATIC_LIB/ROCKSDB_SHARED_LIB
, but i'd suggest move the cmake changes into a separated commit. and explain the reason why we need this change in the commit message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine, I will pick up the cmake changes in a separated commit. Close this pr temporarily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@merryChris JFYI, there is no need to create a new PR for addressing comments in existing one. you can always git push -f
to your remote branch for updating a PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tchaikov thanks for reminding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -1,7 +1,7 @@ | |||
# Read rocksdb version from version.h header file. | |||
|
|||
function(get_rocksdb_version version_var) | |||
file(READ "${CMAKE_SOURCE_DIR}/include/rocksdb/version.h" version_header_file) | |||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/include/rocksdb/version.h" version_header_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I'm trying to build a distributed storage system based on rocksdb, and my codebase directory structure just like this.
/path/to/rocskdb_xxx$ tree -L 1
.
|-build.sh
|-CMakeLists.txt
|-my_code/
|-rocksdb/
|-something_else
My project name is rocksdb_xxx. While I'm building it at the root path, the cmake file path above is /path/to/rocskdb_xxx/include/rocksdb/version.h
, which doesn't work. ${CMAKE_CURRENT_SOURCE_DIR}
is a friendly option path, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see. presumably you include rocksdb project using add_subdirectory()
which points CMAKE_SOURCE_DIR
to /path/to/rocskdb_xxx
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that's it.
@@ -184,7 +184,7 @@ class TestSnapshotChecker : public SnapshotChecker { | |||
public: | |||
explicit TestSnapshotChecker( | |||
SequenceNumber last_committed_sequence, | |||
const std::unordered_map<SequenceNumber, SequenceNumber>& snapshots = {}) | |||
const std::unordered_map<SequenceNumber, SequenceNumber>& snapshots = {{}}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please move this change to a separated commit, and explain the rationale behind this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will separate them into two pr. Plz refer to the issue #3522, it may not friendly for g++4.9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the existing code is compliant to C++11. and why would you want to compile compile the test with a 4 years old compiler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sigh, it seems a sad history problem. If you would not like to make a compatibility, it's okay to make a local fit for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it's the maintainers' call to include your fix or not. i am just wondering why. the reason i was curious is that, normally, the reason why we need to stick to an older version of compiler is just we have to compile our executables/libraries for supported older platforms/distros. but the tests are not in this scope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Briefly speaking, almost all projects/libs in our company are complied with g++4.9.2. As for me, I have to maintain compatible api lib version under g++4.9.2, 5.4.0, and 6.3.0, which also troubles me a lot. But this is life anyway. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but compaction_iterator_test.cc
is not included by rocksdb library. so even if it does not compile, you can still compile and link against rocksdb using GCC 4.9.2 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we want to make use of built-in db_bench_tool
as data generator, with the option WITH_TESTS=ON
. But as you see, ${TESTS}
sources like compaction_iterator_test
is involved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pdillinger thanks for the link! so it's C++14 compliant.
@@ -606,7 +606,8 @@ double FilterBench::RandomQueryTest(uint32_t inside_threshold, bool dry_run, | |||
} | |||
|
|||
if (!dry_run) { | |||
fp_rate_report_ = std::ostringstream(); | |||
fp_rate_report_.clear(); | |||
fp_rate_report_.str(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reson as above, and here is the conversation with @pdillinger #5968.
If you get the cmake updates out of this PR (now in #6045) I'll pull in the compaction_iterator_test.cc and filter_bench.cc updates. |
That's it. Do I need to separate these two changes into another PR, since sorry that I cannot update this PR anymore? |
Summary: Taken from @merryChris in facebook#6043 Stackoverflow ref on {{}} vs. {}: https://stackoverflow.com/questions/26947704/implicit-conversion-failure-from-initializer-list Note that .clear() does not empty out an ostringstream, but .str("") suffices because we don't have to worry about clearing error flags. Test Plan: make check, manual run of filter_bench
Moved to #6053 |
Summary: Taken from merryChris in #6043 Stackoverflow ref on {{}} vs. {}: https://stackoverflow.com/questions/26947704/implicit-conversion-failure-from-initializer-list Note to reader: .clear() does not empty out an ostringstream, but .str("") suffices because we don't have to worry about clearing error flags. Pull Request resolved: #6053 Test Plan: make check, manual run of filter_bench Differential Revision: D18602259 Pulled By: pdillinger fbshipit-source-id: f6190f83b8eab4e80e7c107348839edabe727841
Thanks a lot. |
Summary: Taken from merryChris in facebook#6043 Stackoverflow ref on {{}} vs. {}: https://stackoverflow.com/questions/26947704/implicit-conversion-failure-from-initializer-list Note to reader: .clear() does not empty out an ostringstream, but .str("") suffices because we don't have to worry about clearing error flags. Pull Request resolved: facebook#6053 Test Plan: make check, manual run of filter_bench Differential Revision: D18602259 Pulled By: pdillinger fbshipit-source-id: f6190f83b8eab4e80e7c107348839edabe727841
No description provided.