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

mpack: compilation error on CentOS 6/7 #1441

Closed
nokute78 opened this issue Jul 16, 2019 · 8 comments
Closed

mpack: compilation error on CentOS 6/7 #1441

nokute78 opened this issue Jul 16, 2019 · 8 comments
Assignees

Comments

@nokute78
Copy link
Collaborator

Bug Report

Describe the bug
Compilation error on CentOS 7.
C99 style of mpack causes. gcc of Cent OS 7 can't compile by default.

e.g.

bool mpack_str_check_no_null(const char* str, size_t bytes) {
    for (size_t i = 0; i < bytes; ++i)

To Reproduce

  • Rubular link if applicable:
    None
  • Example log message if applicable:
    None
  • Steps to reproduce the problem:
$ cmake3 .. && make

Expected behavior
Buildable.

Screenshots
None

Your Environment

  • Version used: git master
  • Configuration: none
  • Environment name and version (e.g. Kubernetes? What version?):
  • Server type and version:
  • Operating System and version: CentOS 6/7
  • Filters and plugins: None

Additional context
Workaround is to use -std=gnu99 or c99.

gcc 5 supports gnu11 by default.
https://www.gnu.org/software/gcc/gcc-5/changes.html

Do we need to check compiler and its version?

diff --git a/lib/mpack-amalgamation-1.0/CMakeLists.txt b/lib/mpack-amalgamation-1.0/CMakeLists.txt
index bbf2ecd..b0fd081 100644
--- a/lib/mpack-amalgamation-1.0/CMakeLists.txt
+++ b/lib/mpack-amalgamation-1.0/CMakeLists.txt
@@ -1,6 +1,6 @@
 set(src
   src/mpack/mpack.c
   )
-
+add_definitions(-std=gnu99)
 add_definitions(-DMPACK_EXTENSIONS=1)
 add_library(mpack-static STATIC ${src})
@nokute78 nokute78 changed the title mpack: compilation error on CentOS 7 mpack: compilation error on CentOS 6/7 Jul 16, 2019
@edsiper
Copy link
Member

edsiper commented Jul 17, 2019 via email

@nokute78
Copy link
Collaborator Author

nokute78 commented Jul 17, 2019

Yes.

Note: libjemalloc also uses C99 style declaration. We can build it on CentOS.
It may be better to compile in the same way.

for (size_t i = 0; i < vlen; i++) {

@edsiper
Copy link
Member

edsiper commented Jul 17, 2019

@nokute78 what's the specific compiler version ? I would like to pass the info to mpack author

@nokute78
Copy link
Collaborator Author

Maybe gcc 4.8.x. Default version of CentOS7.
I will tell you tommorow. I can't access my PC now..

By the way , similar issue and PR are already reported on mpack repo.
PR is not merged and closed.
ludocode/mpack#67
ludocode/mpack#68

@edsiper
Copy link
Member

edsiper commented Jul 18, 2019

I've posted the issue in mpack repo:

ludocode/mpack#69

@nokute78
Copy link
Collaborator Author

@edsiper Thank you.

@edsiper
Copy link
Member

edsiper commented Jul 25, 2019

update:

fixed, thanks again.

@edsiper edsiper self-assigned this Jul 25, 2019
@edsiper edsiper closed this as completed Jul 25, 2019
@nokute78
Copy link
Collaborator Author

@edsiper Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants