benoitc / dnssd_erlang

Erlang interface to Apple's Bonjour DNS Service Discovery implementation
Apache License 2.0
46 stars 16 forks source link

crash when avahi or apple bonjour sdk isn't installed #8

Closed benoitc closed 12 years ago

benoitc commented 12 years ago

Actually when you try to install on a machine where avahi isn't installed, the build of the application embedding dnssd_erlang will stop totally.

I think there could be a way to detect if the lib is not there and provide a dummy app that would return error on initially to have some lazy build. Maybe using a rebar plugin ?

Other way would be building it against static libs but i'm not sure it's actually possible.

andrewtj commented 12 years ago

Though I can see why it might be useful to not have the build fail when the dnssd app isn't core to the parent app, I'm not sure that this is the place to prevent the build failure.

rebar's dynamic configuration could be used in this app or it's parent to prevent the failure.

If it's possible to set an environment variable from the parent app (eg: DNSSD_ERLANG_FAIL_AT_RUNTIME) I'm okay with providing an off by default workaround here that would let the build proceed, application:start(dnssd) succeed and make all the operations return {error, missing_lib}.

How does that sound?

benoitc commented 12 years ago

I ignored this configuration settings. Maybe it's enough. Having "{error, missing_lib}" error would be definitely helpful anyway :)

andrewtj commented 12 years ago

If you still need this I can probably get to it at the end of this week. Just to be clear here's what I'm planning on doing: