* [PATCH] cmake: fix sync_file_range detection @ 2018-10-06 14:51 Vladimir Davydov 2018-10-08 3:04 ` Alexander Turenko 2018-10-16 18:55 ` [tarantool-patches] " Konstantin Osipov 0 siblings, 2 replies; 9+ messages in thread From: Vladimir Davydov @ 2018-10-06 14:51 UTC (permalink / raw) To: alexander.turenko; +Cc: tarantool-patches sync_file_range is declared only if _GNU_SOURCE macro is defined. Also, in order to be used in a source file, HAVE_SYNC_FILE_RANGE must be present in config.h.cmake. Fixes commit caae99e5eaa0 ("Refactor xlog writer"). --- https://github.com/tarantool/tarantool/commits/dv/cmake-fix-gnu-symbol-detection CMakeLists.txt | 2 ++ src/trivia/config.h.cmake | 1 + 2 files changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf68d187..b26d2abf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,8 @@ include(cmake/profile.cmake) include(cmake/module.cmake) include(cmake/thread.cmake) +list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) + check_symbol_exists(MAP_ANON sys/mman.h HAVE_MAP_ANON) check_symbol_exists(MAP_ANONYMOUS sys/mman.h HAVE_MAP_ANONYMOUS) check_include_file(sys/time.h HAVE_SYS_TIME_H) diff --git a/src/trivia/config.h.cmake b/src/trivia/config.h.cmake index 66ddba99..8894b436 100644 --- a/src/trivia/config.h.cmake +++ b/src/trivia/config.h.cmake @@ -167,6 +167,7 @@ #cmakedefine HAVE_SCHED_YIELD 1 #cmakedefine HAVE_POSIX_FADVISE 1 #cmakedefine HAVE_MREMAP 1 +#cmakedefine HAVE_SYNC_FILE_RANGE 1 #cmakedefine HAVE_PRCTL_H 1 -- 2.11.0 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] cmake: fix sync_file_range detection 2018-10-06 14:51 [PATCH] cmake: fix sync_file_range detection Vladimir Davydov @ 2018-10-08 3:04 ` Alexander Turenko 2018-10-08 8:00 ` Vladimir Davydov 2018-10-16 18:55 ` [tarantool-patches] " Konstantin Osipov 1 sibling, 1 reply; 9+ messages in thread From: Alexander Turenko @ 2018-10-08 3:04 UTC (permalink / raw) To: Vladimir Davydov; +Cc: tarantool-patches On Sat, Oct 06, 2018 at 05:51:48PM +0300, Vladimir Davydov wrote: > sync_file_range is declared only if _GNU_SOURCE macro is defined. > Also, in order to be used in a source file, HAVE_SYNC_FILE_RANGE > must be present in config.h.cmake. > > Fixes commit caae99e5eaa0 ("Refactor xlog writer"). > --- > https://github.com/tarantool/tarantool/commits/dv/cmake-fix-gnu-symbol-detection > > CMakeLists.txt | 2 ++ > src/trivia/config.h.cmake | 1 + > 2 files changed, 3 insertions(+) > > diff --git a/CMakeLists.txt b/CMakeLists.txt > index bf68d187..b26d2abf 100644 > --- a/CMakeLists.txt > +++ b/CMakeLists.txt > @@ -69,6 +69,8 @@ include(cmake/profile.cmake) > include(cmake/module.cmake) > include(cmake/thread.cmake) > > +list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) > + cmake/os.cmake already has `add_definitions("-D_GNU_SOURCE")`, is that not sufficient? > check_symbol_exists(MAP_ANON sys/mman.h HAVE_MAP_ANON) > check_symbol_exists(MAP_ANONYMOUS sys/mman.h HAVE_MAP_ANONYMOUS) > check_include_file(sys/time.h HAVE_SYS_TIME_H) > diff --git a/src/trivia/config.h.cmake b/src/trivia/config.h.cmake > index 66ddba99..8894b436 100644 > --- a/src/trivia/config.h.cmake > +++ b/src/trivia/config.h.cmake > @@ -167,6 +167,7 @@ > #cmakedefine HAVE_SCHED_YIELD 1 > #cmakedefine HAVE_POSIX_FADVISE 1 > #cmakedefine HAVE_MREMAP 1 > +#cmakedefine HAVE_SYNC_FILE_RANGE 1 > > #cmakedefine HAVE_PRCTL_H 1 > > -- > 2.11.0 > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] cmake: fix sync_file_range detection 2018-10-08 3:04 ` Alexander Turenko @ 2018-10-08 8:00 ` Vladimir Davydov 2018-10-08 9:23 ` Alexander Turenko 0 siblings, 1 reply; 9+ messages in thread From: Vladimir Davydov @ 2018-10-08 8:00 UTC (permalink / raw) To: Alexander Turenko; +Cc: tarantool-patches On Mon, Oct 08, 2018 at 06:04:08AM +0300, Alexander Turenko wrote: > On Sat, Oct 06, 2018 at 05:51:48PM +0300, Vladimir Davydov wrote: > > sync_file_range is declared only if _GNU_SOURCE macro is defined. > > Also, in order to be used in a source file, HAVE_SYNC_FILE_RANGE > > must be present in config.h.cmake. > > > > Fixes commit caae99e5eaa0 ("Refactor xlog writer"). > > --- > > https://github.com/tarantool/tarantool/commits/dv/cmake-fix-gnu-symbol-detection > > > > CMakeLists.txt | 2 ++ > > src/trivia/config.h.cmake | 1 + > > 2 files changed, 3 insertions(+) > > > > diff --git a/CMakeLists.txt b/CMakeLists.txt > > index bf68d187..b26d2abf 100644 > > --- a/CMakeLists.txt > > +++ b/CMakeLists.txt > > @@ -69,6 +69,8 @@ include(cmake/profile.cmake) > > include(cmake/module.cmake) > > include(cmake/thread.cmake) > > > > +list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) > > + > > cmake/os.cmake already has `add_definitions("-D_GNU_SOURCE")`, is that > not sufficient? Looks like not. I checked - sync_page_range isn't used on Linux without this patch. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] cmake: fix sync_file_range detection 2018-10-08 8:00 ` Vladimir Davydov @ 2018-10-08 9:23 ` Alexander Turenko 2018-10-08 10:30 ` Vladimir Davydov 0 siblings, 1 reply; 9+ messages in thread From: Alexander Turenko @ 2018-10-08 9:23 UTC (permalink / raw) To: Vladimir Davydov; +Cc: tarantool-patches On Mon, Oct 08, 2018 at 11:00:12AM +0300, Vladimir Davydov wrote: > On Mon, Oct 08, 2018 at 06:04:08AM +0300, Alexander Turenko wrote: > > On Sat, Oct 06, 2018 at 05:51:48PM +0300, Vladimir Davydov wrote: > > > sync_file_range is declared only if _GNU_SOURCE macro is defined. > > > Also, in order to be used in a source file, HAVE_SYNC_FILE_RANGE > > > must be present in config.h.cmake. > > > > > > Fixes commit caae99e5eaa0 ("Refactor xlog writer"). > > > --- > > > https://github.com/tarantool/tarantool/commits/dv/cmake-fix-gnu-symbol-detection > > > > > > CMakeLists.txt | 2 ++ > > > src/trivia/config.h.cmake | 1 + > > > 2 files changed, 3 insertions(+) > > > > > > diff --git a/CMakeLists.txt b/CMakeLists.txt > > > index bf68d187..b26d2abf 100644 > > > --- a/CMakeLists.txt > > > +++ b/CMakeLists.txt > > > @@ -69,6 +69,8 @@ include(cmake/profile.cmake) > > > include(cmake/module.cmake) > > > include(cmake/thread.cmake) > > > > > > +list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) > > > + > > > > cmake/os.cmake already has `add_definitions("-D_GNU_SOURCE")`, is that > > not sufficient? > > Looks like not. I checked - sync_page_range isn't used on Linux without > this patch. It looks similar to the cmake issue [1]. Maybe it is better to set CMAKE_REQUIRED_DEFINITIONS in sync with add_definitions (in os.cmake), what do you think? [1]: https://cmake.org/Bug/view.php?id=13208 WBR, Alexander Turenko. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] cmake: fix sync_file_range detection 2018-10-08 9:23 ` Alexander Turenko @ 2018-10-08 10:30 ` Vladimir Davydov 2018-10-08 13:14 ` Alexander Turenko 0 siblings, 1 reply; 9+ messages in thread From: Vladimir Davydov @ 2018-10-08 10:30 UTC (permalink / raw) To: Alexander Turenko; +Cc: tarantool-patches On Mon, Oct 08, 2018 at 12:23:58PM +0300, Alexander Turenko wrote: > On Mon, Oct 08, 2018 at 11:00:12AM +0300, Vladimir Davydov wrote: > > On Mon, Oct 08, 2018 at 06:04:08AM +0300, Alexander Turenko wrote: > > > On Sat, Oct 06, 2018 at 05:51:48PM +0300, Vladimir Davydov wrote: > > > > sync_file_range is declared only if _GNU_SOURCE macro is defined. > > > > Also, in order to be used in a source file, HAVE_SYNC_FILE_RANGE > > > > must be present in config.h.cmake. > > > > > > > > Fixes commit caae99e5eaa0 ("Refactor xlog writer"). > > > > --- > > > > https://github.com/tarantool/tarantool/commits/dv/cmake-fix-gnu-symbol-detection > > > > > > > > CMakeLists.txt | 2 ++ > > > > src/trivia/config.h.cmake | 1 + > > > > 2 files changed, 3 insertions(+) > > > > > > > > diff --git a/CMakeLists.txt b/CMakeLists.txt > > > > index bf68d187..b26d2abf 100644 > > > > --- a/CMakeLists.txt > > > > +++ b/CMakeLists.txt > > > > @@ -69,6 +69,8 @@ include(cmake/profile.cmake) > > > > include(cmake/module.cmake) > > > > include(cmake/thread.cmake) > > > > > > > > +list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) > > > > + > > > > > > cmake/os.cmake already has `add_definitions("-D_GNU_SOURCE")`, is that > > > not sufficient? > > > > Looks like not. I checked - sync_page_range isn't used on Linux without > > this patch. > > It looks similar to the cmake issue [1]. > > Maybe it is better to set CMAKE_REQUIRED_DEFINITIONS in sync with > add_definitions (in os.cmake), what do you think? I don't think so. We typically set CMAKE_REQUIRED_* before checking for symbols. BTW, I should have probably used set() instead of list(APPEND). ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] cmake: fix sync_file_range detection 2018-10-08 10:30 ` Vladimir Davydov @ 2018-10-08 13:14 ` Alexander Turenko 2018-10-08 14:42 ` Vladimir Davydov 0 siblings, 1 reply; 9+ messages in thread From: Alexander Turenko @ 2018-10-08 13:14 UTC (permalink / raw) To: Vladimir Davydov; +Cc: tarantool-patches On Mon, Oct 08, 2018 at 01:30:09PM +0300, Vladimir Davydov wrote: > On Mon, Oct 08, 2018 at 12:23:58PM +0300, Alexander Turenko wrote: > > On Mon, Oct 08, 2018 at 11:00:12AM +0300, Vladimir Davydov wrote: > > > On Mon, Oct 08, 2018 at 06:04:08AM +0300, Alexander Turenko wrote: > > > > On Sat, Oct 06, 2018 at 05:51:48PM +0300, Vladimir Davydov wrote: > > > > > sync_file_range is declared only if _GNU_SOURCE macro is defined. > > > > > Also, in order to be used in a source file, HAVE_SYNC_FILE_RANGE > > > > > must be present in config.h.cmake. > > > > > > > > > > Fixes commit caae99e5eaa0 ("Refactor xlog writer"). > > > > > --- > > > > > https://github.com/tarantool/tarantool/commits/dv/cmake-fix-gnu-symbol-detection > > > > > > > > > > CMakeLists.txt | 2 ++ > > > > > src/trivia/config.h.cmake | 1 + > > > > > 2 files changed, 3 insertions(+) > > > > > > > > > > diff --git a/CMakeLists.txt b/CMakeLists.txt > > > > > index bf68d187..b26d2abf 100644 > > > > > --- a/CMakeLists.txt > > > > > +++ b/CMakeLists.txt > > > > > @@ -69,6 +69,8 @@ include(cmake/profile.cmake) > > > > > include(cmake/module.cmake) > > > > > include(cmake/thread.cmake) > > > > > > > > > > +list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) > > > > > + > > > > > > > > cmake/os.cmake already has `add_definitions("-D_GNU_SOURCE")`, is that > > > > not sufficient? > > > > > > Looks like not. I checked - sync_page_range isn't used on Linux without > > > this patch. > > > > It looks similar to the cmake issue [1]. > > > > Maybe it is better to set CMAKE_REQUIRED_DEFINITIONS in sync with > > add_definitions (in os.cmake), what do you think? > > I don't think so. We typically set CMAKE_REQUIRED_* before checking for > symbols. Now I see. Okay. > > BTW, I should have probably used set() instead of list(APPEND). Other places use set(), yep. I would use it for consistency. The patch is LGTM (w/ set() or list(), does not matter much). WBR, Alexander Turenko. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] cmake: fix sync_file_range detection 2018-10-08 13:14 ` Alexander Turenko @ 2018-10-08 14:42 ` Vladimir Davydov 0 siblings, 0 replies; 9+ messages in thread From: Vladimir Davydov @ 2018-10-08 14:42 UTC (permalink / raw) To: Alexander Turenko; +Cc: tarantool-patches On Mon, Oct 08, 2018 at 04:14:00PM +0300, Alexander Turenko wrote: > The patch is LGTM (w/ set() or list(), does not matter much). I changed list() to set() and pushed the patch to 1.10. Thanks. ^ permalink raw reply [flat|nested] 9+ messages in thread
* [tarantool-patches] Re: [PATCH] cmake: fix sync_file_range detection 2018-10-06 14:51 [PATCH] cmake: fix sync_file_range detection Vladimir Davydov 2018-10-08 3:04 ` Alexander Turenko @ 2018-10-16 18:55 ` Konstantin Osipov 2018-10-17 7:13 ` Vladimir Davydov 1 sibling, 1 reply; 9+ messages in thread From: Konstantin Osipov @ 2018-10-16 18:55 UTC (permalink / raw) To: tarantool-patches; +Cc: alexander.turenko * Vladimir Davydov <vdavydov.dev@gmail.com> [18/10/06 19:34]: > sync_file_range is declared only if _GNU_SOURCE macro is defined. > Also, in order to be used in a source file, HAVE_SYNC_FILE_RANGE > must be present in config.h.cmake. > > Fixes commit caae99e5eaa0 ("Refactor xlog writer"). > --- > https://github.com/tarantool/tarantool/commits/dv/cmake-fix-gnu-symbol-detection > > CMakeLists.txt | 2 ++ > src/trivia/config.h.cmake | 1 + > 2 files changed, 3 insertions(+) > > diff --git a/CMakeLists.txt b/CMakeLists.txt > index bf68d187..b26d2abf 100644 > --- a/CMakeLists.txt > +++ b/CMakeLists.txt > @@ -69,6 +69,8 @@ include(cmake/profile.cmake) > include(cmake/module.cmake) > include(cmake/thread.cmake) > > +list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) > + Uhm, why are we defining this here and not where we check for sync file range? > check_symbol_exists(MAP_ANON sys/mman.h HAVE_MAP_ANON) > check_symbol_exists(MAP_ANONYMOUS sys/mman.h HAVE_MAP_ANONYMOUS) > check_include_file(sys/time.h HAVE_SYS_TIME_H) -- Konstantin Osipov, Moscow, Russia, +7 903 626 22 32 http://tarantool.io - www.twitter.com/kostja_osipov ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [tarantool-patches] Re: [PATCH] cmake: fix sync_file_range detection 2018-10-16 18:55 ` [tarantool-patches] " Konstantin Osipov @ 2018-10-17 7:13 ` Vladimir Davydov 0 siblings, 0 replies; 9+ messages in thread From: Vladimir Davydov @ 2018-10-17 7:13 UTC (permalink / raw) To: Konstantin Osipov; +Cc: tarantool-patches, alexander.turenko On Tue, Oct 16, 2018 at 09:55:26PM +0300, Konstantin Osipov wrote: > * Vladimir Davydov <vdavydov.dev@gmail.com> [18/10/06 19:34]: > > sync_file_range is declared only if _GNU_SOURCE macro is defined. > > Also, in order to be used in a source file, HAVE_SYNC_FILE_RANGE > > must be present in config.h.cmake. > > > > Fixes commit caae99e5eaa0 ("Refactor xlog writer"). > > --- > > https://github.com/tarantool/tarantool/commits/dv/cmake-fix-gnu-symbol-detection > > > > CMakeLists.txt | 2 ++ > > src/trivia/config.h.cmake | 1 + > > 2 files changed, 3 insertions(+) > > > > diff --git a/CMakeLists.txt b/CMakeLists.txt > > index bf68d187..b26d2abf 100644 > > --- a/CMakeLists.txt > > +++ b/CMakeLists.txt > > @@ -69,6 +69,8 @@ include(cmake/profile.cmake) > > include(cmake/module.cmake) > > include(cmake/thread.cmake) > > > > +list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) > > + > > Uhm, why are we defining this here and not where we check for sync > file range? We check for all symbols, including sync_file_range, right below. Some of them (e.g. mremap) might need _GNU_SOURCE too so I reckon we'd better define this macro before all the checks. > > > check_symbol_exists(MAP_ANON sys/mman.h HAVE_MAP_ANON) > > check_symbol_exists(MAP_ANONYMOUS sys/mman.h HAVE_MAP_ANONYMOUS) > > check_include_file(sys/time.h HAVE_SYS_TIME_H) ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-10-17 7:13 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-10-06 14:51 [PATCH] cmake: fix sync_file_range detection Vladimir Davydov 2018-10-08 3:04 ` Alexander Turenko 2018-10-08 8:00 ` Vladimir Davydov 2018-10-08 9:23 ` Alexander Turenko 2018-10-08 10:30 ` Vladimir Davydov 2018-10-08 13:14 ` Alexander Turenko 2018-10-08 14:42 ` Vladimir Davydov 2018-10-16 18:55 ` [tarantool-patches] " Konstantin Osipov 2018-10-17 7:13 ` Vladimir Davydov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox