Nordix / hiredis-cluster

C client library for Valkey/Redis Cluster. This project is used and sponsored by Ericsson. It is a fork of the now unmaintained hiredis-vip.
BSD 3-Clause "New" or "Revised" License
86 stars 42 forks source link

hircluster.c:218:9: 错误: #181

Closed datafu closed 10 months ago

datafu commented 1 year ago

hircluster.c:218:9: 错误:隐式声明函数‘strerror_r’ [-Werror=implicit-function-declaration] strerror_r(errno, cc->errstr, sizeof(cc->errstr)); ^ cc1: all warnings being treated as errors

Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux gcc --version gcc (GCC) 4.9.4

bjosv commented 1 year ago

I have tested to build using ubuntu 20.04 with an older gcc 4.4 and cmake which seems to work (link to job). Are you building using CMake or directly via Makefile? Does it work if you add the define _GNU_SOURCE?

datafu commented 1 year ago

gcc --version gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3) Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

then, I entered hiredis-cluster-0.10.0 and Using make, Just reported an error

[root@radius hiredis-cluster-0.10.0]# make cc -c -O3 -std=c99 -fPIC -Wall -Wextra -pedantic -Werror -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb hircluster.c cc1: warnings being treated as errors hircluster.c: In function ‘__redisClusterSetError’: hircluster.c:218: error: implicit declaration of function ‘strerror_r’ make: *** [hircluster.o] Error 1

bjosv commented 1 year ago

Ah, I see. I ran on master which has some changes that is not yet delivered.

You will very likely be able to build with your old gcc compiler using: CFLAGS="-D_XOPEN_SOURCE=600" make

as in this example for v0.10.0

bjosv commented 10 months ago

Corrected by #157 which is included in 0.11.0.