Skip to content

mpack: compilation error on CentOS 6/7 #1441

@nokute78

Description

@nokute78

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})

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions