gen2brain / go-unarr

Go bindings for unarr (decompression library for RAR, TAR, ZIP and 7z archives)
zlib License
282 stars 44 forks source link

Cannot compile on centos 7 #34

Closed mciricean closed 2 years ago

mciricean commented 2 years ago

works fine on v0.1.3 bit not with v0.1.4 or above

centos:7.9.2009 in docker GOVERSION="go1.18.5"

# github.com/gen2brain/go-unarr/unarrc
    In file included from /go/pkg/mod/github.com/gen2brain/go-unarr@v0.1.5/unarrc/common_crc32.go:4:0:
    /go/pkg/mod/github.com/gen2brain/go-unarr@v0.1.5/unarrc/external/unarr/common/crc32.c: In function 'ar_crc32':
    /go/pkg/mod/github.com/gen2brain/go-unarr@v0.1.5/unarrc/external/unarr/common/crc32.c:25:9: error: 'for' loop initial declarations are only allowed in C99 mode
             for (unsigned int i = 128; i; i >>= 1) {
             ^
    /go/pkg/mod/github.com/gen2brain/go-unarr@v0.1.5/unarrc/external/unarr/common/crc32.c:25:9: note: use option -std=c99 or -std=gnu99 to compile your code
    /go/pkg/mod/github.com/gen2brain/go-unarr@v0.1.5/unarrc/external/unarr/common/crc32.c:27:13: error: 'for' loop initial declarations are only allowed in C99 mode
                 for (unsigned int j = 0; j < 256; j += 2 * i) {
                 ^
    /go/pkg/mod/github.com/gen2brain/go-unarr@v0.1.5/unarrc/external/unarr/common/crc32.c:32:27: error: redefinition of 'i'
             for (unsigned int i = 0; i < 256; i++) {
                               ^
    /go/pkg/mod/github.com/gen2brain/go-unarr@v0.1.5/unarrc/external/unarr/common/crc32.c:25:27: note: previous definition of 'i' was here
             for (unsigned int i = 128; i; i >>= 1) {
                               ^
    /go/pkg/mod/github.com/gen2brain/go-unarr@v0.1.5/unarrc/external/unarr/common/crc32.c:32:9: error: 'for' loop initial declarations are only allowed in C99 mode
             for (unsigned int i = 0; i < 256; i++) {
             ^
    /go/pkg/mod/github.com/gen2brain/go-unarr@v0.1.5/unarrc/external/unarr/common/crc32.c:33:13: error: 'for' loop initial declarations are only allowed in C99 mode
                 for (unsigned int j = 1; j < 8; j++) {
                 ^
gen2brain commented 2 years ago

Can you check again with https://github.com/gen2brain/go-unarr/commit/c496c9640ec91c5369f97ddf76fba457b9107072?

mciricean commented 2 years ago

looks good, no compilation issue

gen2brain commented 2 years ago

Ok, thanks for reporting.