objectbox / objectbox-go

Embedded Go Database, the fast alternative to SQLite, gorm, etc.
https://objectbox.io
Apache License 2.0
1.07k stars 46 forks source link

Build fails on CentOS 7 due to gcc not running c99 mode #27

Closed Petrify closed 3 years ago

Petrify commented 3 years ago

Description

Running go build on a project using objectbox-go causes a compiler error when using gcc 4.8.5 on CentOS 7.

Basic info

How to reproduce

Install gcc on CentOS yum install gcc Install Objectbox (I used the bash quick install script here) build a project that uses objectbox

Expected behavior

Project builds into executable

Logs, stack traces

# github.com/objectbox/objectbox-go/objectbox
/root/go/pkg/mod/github.com/objectbox/objectbox-go@v1.2.0/objectbox/c-arrays.go: In function 'freeCharArray':
/root/go/pkg/mod/github.com/objectbox/objectbox-go@v1.2.0/objectbox/c-arrays.go:32:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (size_t i = 0; i < size; i++) {
     ^
/root/go/pkg/mod/github.com/objectbox/objectbox-go@v1.2.0/objectbox/c-arrays.go:32:5: note: use option -std=c99 or -std=gnu99 to compile your code
greenrobot-team commented 3 years ago

Side note: apparently CentOS 7 end-of-life is 30 June 2024. https://www.centos.org/download/