sflow / host-sflow

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

FreeBSD Makefile problem with json. #21

Open lagagne opened 7 years ago

lagagne commented 7 years ago

I just built host-sflow from sources for FreeBSD 11.0

The "make" command brings these errors for the json Makefile: Lines 24 and 27: Missing dependency operator. Line 30: Need an operator.

I tried running "gmake" but after leaving the json directory successfully (Nothing to be done for 'all') it doesn't understand the FreeBSD Makefile.

I commented out the "cd src/json; $(MAKE)" from the main Makefile and ran "make" again and successfully completed the installation.

sflow commented 7 years ago

Thanks. It seems like we should allow each platform to compile cJSON in it's own way.

donatid commented 1 year ago

Hello,

I have the same problem installing host-sflow v2.0.51-26 on FreeBSD 13.2, and here is the error messages:

# gmake 
cd src/sflow; gmake
gmake[1]: Entering directory '/root/installer/host-sflow-2.0.51-26/src/sflow'
Makefile:32: warning: ignoring prerequisites on suffix rule definition
gcc -D_GNU_SOURCE -DSTDC_HEADERS -O3 -DNDEBUG -Wall -Wcast-align -I. -c sflow_agent.c
gcc -D_GNU_SOURCE -DSTDC_HEADERS -O3 -DNDEBUG -Wall -Wcast-align -I. -c sflow_sampler.c
gcc -D_GNU_SOURCE -DSTDC_HEADERS -O3 -DNDEBUG -Wall -Wcast-align -I. -c sflow_poller.c
gcc -D_GNU_SOURCE -DSTDC_HEADERS -O3 -DNDEBUG -Wall -Wcast-align -I. -c sflow_notifier.c
gcc -D_GNU_SOURCE -DSTDC_HEADERS -O3 -DNDEBUG -Wall -Wcast-align -I. -c sflow_receiver.c
ar cru libsflow.a sflow_agent.o sflow_sampler.o sflow_poller.o sflow_notifier.o sflow_receiver.o
ranlib libsflow.a
gmake[1]: Leaving directory '/root/installer/host-sflow-2.0.51-26/src/sflow'
cd src/json; gmake
gmake[1]: Entering directory '/root/installer/host-sflow-2.0.51-26/src/json'
gcc -std=c89 -c -fPIC -pedantic -Wall -Werror -Wstrict-prototypes -Wwrite-strings -Wshadow -Winit-self -Wcast-align -Wformat=2 -Wmissing-prototypes -Wstrict-overflow=2 -Wcast-qual -Wc++-compat -Wundef -Wswitch-default -Wconversion -fstack-protector cJSON.c
In file included from cJSON.c:42:
cJSON.c: In function 'print_number':
cJSON.c:561:15: error: conversion from 'double' to 'float' may change value [-Werror=float-conversion]
  561 |     if (isnan(d) || isinf(d))
      |               ^
cJSON.c:561:27: error: conversion from 'double' to 'float' may change value [-Werror=float-conversion]
  561 |     if (isnan(d) || isinf(d))
      |                           ^
cc1: all warnings being treated as errors
gmake[1]: *** [Makefile:83: cJSON.o] Error 1
gmake[1]: Leaving directory '/root/installer/host-sflow-2.0.51-26/src/json'
gmake: *** [Makefile:15: hsflowd] Error 2

When using make:

 # make 
cd src/sflow; make
`libsflow.a' is up to date.
cd src/json; make
make[1]: "/root/installer/host-sflow-2.0.51-26/src/json/Makefile" line 33: Invalid line type
make[1]: "/root/installer/host-sflow-2.0.51-26/src/json/Makefile" line 35: Invalid line type
make[1]: "/root/installer/host-sflow-2.0.51-26/src/json/Makefile" line 37: Invalid line type
make[1]: "/root/installer/host-sflow-2.0.51-26/src/json/Makefile" line 49: Invalid line type
make[1]: "/root/installer/host-sflow-2.0.51-26/src/json/Makefile" line 53: Invalid line type
make[1]: Fatal errors encountered -- cannot continue
make[1]: stopped in /root/installer/host-sflow-2.0.51-26/src/json
*** Error code 1

Stop.
make: stopped in /root/installer/host-sflow-2.0.51-26

Although I can disable the json as mentioned by @lagagne, I hope this issue can be fixed. Thank you.