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

Compatible changes with g++4.9.2 and cmake. #6043

Closed
wants to merge 1 commit into from
Closed

Compatible changes with g++4.9.2 and cmake. #6043

wants to merge 1 commit into from

Conversation

merryChris
Copy link

No description provided.

@@ -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})
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tchaikov thanks for reminding.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tchaikov I am not sure why I cannot update PR automatically. Sorry for that, and plz have a review at #6045.

@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Author

@merryChris merryChris Nov 18, 2019

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?

Copy link
Contributor

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.

Copy link
Author

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 = {{}})
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

@tchaikov tchaikov Nov 18, 2019

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?

Copy link
Author

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.

Copy link
Contributor

@tchaikov tchaikov Nov 18, 2019

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.

Copy link
Author

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. ;)

Copy link
Contributor

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 .

Copy link
Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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("");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

Copy link
Author

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.

@pdillinger
Copy link
Contributor

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.

@pdillinger pdillinger self-assigned this Nov 18, 2019
@merryChris
Copy link
Author

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?

pdillinger added a commit to pdillinger/rocksdb that referenced this pull request Nov 19, 2019
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
@pdillinger
Copy link
Contributor

Moved to #6053

@pdillinger pdillinger closed this Nov 19, 2019
facebook-github-bot pushed a commit that referenced this pull request Nov 19, 2019
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
@merryChris
Copy link
Author

Moved to #6053

Thanks a lot.

wolfkdy pushed a commit to wolfkdy/rocksdb that referenced this pull request Dec 22, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants