sflow / host-sflow

host-sflow agent
http://sflow.net
Other
146 stars 55 forks source link

32bit/i686 __stack_chk_fail_local compile error #23

Open acoul opened 7 years ago

acoul commented 7 years ago

Greetings,

on a 32bit gentoo-latest (Gentoo Base System release 2.3) I am getting the following error:

gcc -std=gnu99 -I. -I../json -I../sflow -fPIC -g -O2 -D_GNU_SOURCE -DHSP_VERSION=2.0.9 -DUTHEAP -DHSP_OPTICAL_STATS -DHSP_MOD_DIR=/etc/hsflowd/modules -Wall -Wstrict-prototypes -Wunused-value -Wunused-function -c mod_json.c ld -o mod_json.so mod_json.o -shared mod_json.o: In function evt_packet_tock': /inet/netflow/host-sflow/src/Linux/mod_json.c:1280: undefined reference tostack_chk_fail_local' mod_json.o: In function getApplication': /inet/netflow/host-sflow/src/Linux/mod_json.c:284: undefined reference to__stack_chk_fail_local' mod_json.o: In function readJSON': /inet/netflow/host-sflow/src/Linux/mod_json.c:1250: undefined reference tostack_chk_fail_local' ld: mod_json.so: hidden symbol `__stack_chk_fail_local' isn't defined ld: final link failed: Bad value make[1]: *** [Makefile:251: mod_json.so] Error 1

the following patch resolves this issue

src/Linux/Makefile -LD=ld +LD=gcc

I am also getting this warning:

util.c: In function ‘hashHash’: util.c:1545:58: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] else if(oh->options & UTHASH_IDTY) return (uint32_t)((uint64_t)obj); ..........................................................................................^

sflow commented 7 years ago

Thanks. It's tricky because of the way that src/json/ is shared across all platforms (Linux, Solaris, FreeBSD, Darwin, ...) but perhaps we should allow each platform the discretion to compile and link cJSON in it's own way.