-
Notifications
You must be signed in to change notification settings - Fork 1
Fix build on Centos 7 #20
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
Conversation
7f096f9
to
711990c
Compare
CMakeLists.txt
Outdated
@@ -11,6 +11,10 @@ set(CMAKE_MODULE_PATH | |||
|
|||
include(cmake/utils.cmake) | |||
|
|||
# Set CFLAGS/CXXFLAGS | |||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -std=gnu11") |
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.
Maybe enable -Werror only on debug build, just like in tarantool?
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.
Not sure it's a good idea. Tarantool has separate target for Debug build in CI but we don't have that for modules.
I don't see nothing bad to show and prevent as much warnings as possible.
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.
- You can run
cmake . -DCMAKE_BUILD_TYPE=Debug|Release|RelWithDebInfo && make VERBOSE=1
and see different compilation flags. - https://github.com/tarantool/tarantool/blob/efc30ccf8393a1aad19d4c17299842899d003caa/cmake/compiler.cmake#L372-L373 (it comes from this commit and this issue).
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.
Yes, we can, but I think it's more relevant for Tarantool with default Debug mode. But I'm not sure it's so relevant for modules.
E.g. in avro-schema: https://github.com/tarantool/avro-schema/blob/3b2d264e1f7828dda034aa5cae30184f2b9adbfa/CMakeLists.txt#L21-L23
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.
Proportionally to amount of code.
Default cmake flags for different build types are different.
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.
LGTM in general.
Before this patch an attempt to build on CentOS 7 (gcc 4.8.5) failed with error: ``` [ 63%] Building C object src/CMakeFiles/merger.dir/compat/utils.c.o [ 72%] Building C object src/CMakeFiles/merger.dir/merger/merger.c.o /tmp/luarocks_tuple-merger-0.0.1-1-Cwe2jE/tuple-merger/src/merger/merger.c: In function 'luaT_merger_new_parse_sources': /tmp/luarocks_tuple-merger-0.0.1-1-Cwe2jE/tuple-merger/src/merger/merger.c:306:2: error: 'for' loop initial declarations are only allowed in C99 mode for (uint32_t i = 0; i < source_count; ++i) { ^ /tmp/luarocks_tuple-merger-0.0.1-1-Cwe2jE/tuple-merger/src/merger/merger.c:306:2: note: use option -std=c99 or -std=gnu99 to compile your code gmake[5]: *** [src/CMakeFiles/merger.dir/merger/merger.c.o] Error 1 ``` However we can't simply enable c99 mode because "typeof" is gcc extension and otherwise it failed with: ``` /opt/tarantool/tuple-merger/src/merger/merger.c:917:54: error: unused parameter ‘base’ [-Werror=unused-parameter] luaL_merge_source_tuple_destroy(struct merge_source *base) ^ In file included from /opt/tarantool/tuple-merger/src/merger/merger.c:44:0: /opt/tarantool/tuple-merger/src/merger/merger.c: In function ‘luaL_merge_source_tuple_next_impl’: /usr/local/include/tarantool/module.h:201:16: error: expected declaration specifiers or ‘...’ before (’ token const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ /opt/tarantool/tuple-merger/src/merger/merger.c:937:38: note: in expansion of macro ‘container_of’ struct merge_source_tuple *source = container_of(base, ``` So, finally after enable gnu99 mode all seems to be ok. Closes #19
Seems set-env is deprecated this patch replaces it. See for details https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ Following issue should be fixed: ``` Error: Unable to process command '::set-env name=PATH::/Users/runner/work/tuple-merger/tuple-merger/share/bin:/usr/local/opt/pipx_bin:/Users/runner/.cargo/bin:/usr/local/lib/ruby/gems/2.7.0/bin:/usr/local/opt/ruby/bin:/usr/local/opt/curl/bin:/usr/local/bin:/usr/local/sbin:/Users/runner/bin:/Users/runner/.yarn/bin:/usr/local/go/bin:/Users/runner/Library/Android/sdk/tools:/Users/runner/Library/Android/sdk/platform-tools:/Users/runner/Library/Android/sdk/ndk-bundle:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/bin:/bin:/usr/sbin:/sbin:/Users/runner/.dotnet/tools:/Users/runner/.ghcup/bin:/Users/runner/hostedtoolcache/stack/2.5.1/x64' successfully. Error: The `set-env` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ ```
711990c
to
b02a546
Compare
Initially I planed only CentOS 7 build. However finally I faced a problem with github actions.
Please, read description in commit messages.
Closes #19