flapjack / flapjackfeeder

Nagios/Icinga event broker module (neb), inserts events to Flapjack's Redis queue
GNU General Public License v2.0
8 stars 5 forks source link

Compiling on Mac OS X fails #1

Open jessereynolds opened 10 years ago

jessereynolds commented 10 years ago

Currently the build instructions in the readme only work for linux I think. Here's what happens when I somewhat naively try building on Mac OS X 10.8.5:

jesse@Heart-of-Gold flapjackfeeder $ (cd src ; gcc -fPIC -g -O2 -DHAVE_CONFIG_H -DNSCORE -o flapjackfeeder.o flapjackfeeder.c -shared -fPIC ../../hiredis/libhiredis.a)
i686-apple-darwin11-llvm-gcc-4.2: ../../hiredis/libhiredis.a: No such file or directory

On Mac, hiredis builds a libhiredis.dylib, not libhiredis.a, so changing that name gets a little bit further:

jesse@Heart-of-Gold flapjackfeeder $ (cd src ; gcc -fPIC -g -O2 -DHAVE_CONFIG_H -DNSCORE -o flapjackfeeder.o flapjackfeeder.c -shared -fPIC ../../hiredis/libhiredis.dylib)
Undefined symbols for architecture x86_64:
  "_find_host", referenced from:
      _npcdmod_handle_data in ccUpaUZW.o
  "_find_service", referenced from:
      _npcdmod_handle_data in ccUpaUZW.o
  "_neb_deregister_callback", referenced from:
      _nebmodule_deinit in ccUpaUZW.o
  "_neb_register_callback", referenced from:
      _nebmodule_init in ccUpaUZW.o
  "_neb_set_module_info", referenced from:
      _nebmodule_init in ccUpaUZW.o
  "_schedule_new_event", referenced from:
      _nebmodule_init in ccUpaUZW.o
  "_strip", referenced from:
      _npcdmod_process_config_var in ccUpaUZW.o
  "_write_to_all_logs", referenced from:
      _npcdmod_process_config_var in ccUpaUZW.o
      _npcdmod_handle_data in ccUpaUZW.o
      _npcdmod_file_roller in ccUpaUZW.o
      _nebmodule_deinit in ccUpaUZW.o
      _nebmodule_init in ccUpaUZW.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
ghost commented 10 years ago

By copying in some build options from the nagios example module I was able to get this building on my Mac, it's a bit of a stab in the dark though -- I'll only close this issue if I can test it working properly. (I'm assuming the symbols will resolve properly when the module is loaded into nagios, I can't see any libraries it's supposed to be linking against or anything.)

(cd src ; gcc -fPIC -g -O2 -DHAVE_CONFIG_H -DNSCORE -o flapjackfeeder.o flapjackfeeder.c -flat_namespace -undefined suppress -shared -fPIC ../../hiredis/libhiredis.a; strip -x flapjackfeeder.o)

The -flat_namespace -undefined suppress and the -x option to strip are the new parts.

ghost commented 10 years ago

No, it shows the following error when loaded into nagios:

Could not load module 'flapjackfeeder.o' -> dlopen(/usr/local/var/lib/nagios/spool/checkresults/nebmod8TJzTl, 10): Symbol not found: _find_host

I've also compiled the helloworld module that comes with nagios as an example, and that can't be loaded either.