tenderlove / dnssd

Multicast DNS client for ruby! YAY!
173 stars 35 forks source link

Can't build on Windows (checking for htons in arpa/inet.h... no) #4

Open cstrahan opened 14 years ago

cstrahan commented 14 years ago

Here's the output when I try to install this gem:

C:\Users\Charles>gem install dnssd -- --with-dnssd-dir=c:/progra~1/bonjou~1 --with-dnssd-lib=c:/progra~1/bonjou~1/lib/win32
Building native extensions.  This could take a while...
ERROR:  Error installing dnssd:
        ERROR: Failed to build gem native extension.

C:/Ruby19/bin/ruby.exe extconf.rb --with-dnssd-dir=c:/progra~1/bonjou~1 --with-dnssd-lib=c:/progra~1/bonjou~1/lib/win32
checking for dns_sd.h... yes
checking for main() in -ldnssd... yes
checking for htons in arpa/inet.h... no
checking for htons() in arpa/inet.h... no
couldn't find htons
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.  Check the mkmf.log file for more details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Ruby19/bin/ruby
        --with-warnings
        --without-warnings
        --with-dnssd-dir
        --with-dnssd-include
        --without-dnssd-include=${dnssd-dir}/include
        --with-dnssd-lib=${dnssd-dir}/lib
        --with-dnssdlib
        --without-dnssdlib

Gem files will remain installed in C:/Ruby19/lib/ruby/gems/1.9.1/gems/dnssd-1.3.1 for inspection.
Results logged to C:/Ruby19/lib/ruby/gems/1.9.1/gems/dnssd-1.3.1/ext/dnssd/gem_make.out

Does anyone know how I can resolve this? Shouldn't it be looking in winsock.h, as opposed to arpa/inet.h?

Thanks,

-Charles

drbrain commented 14 years ago

You'll probably need to fix extconf.rb to look for the correct headers then. I don't have windows so I can't help :(

luislavena commented 13 years ago

Hello, this can be cross-compiled and tested using rake-compiler: https://github.com/luislavena/rake-compiler

It needs the proper header exclusion/inclusion for Windows, which can be sorted out without the need of a Windows machine, just time :(

olivierlevon commented 13 years ago

Hello

I encounter the same problem. On Windows, htons and ntohs are in the winsock2.h include file. The following patch should solve the problem :

--- extconf_.rb 2011-04-09 23:58:11.489221900 +0200

+++ extconf.rb 2011-04-09 22:38:54.000000000 +0200

@@ -14,10 +14,12 @@

have_macro('htons', 'arpa/inet.h') ||

have_func('htons', 'arpa/inet.h') ||

+have_func('htons', 'winsock2.h') ||

abort("couldn't find htons")

have_macro('ntohs', 'arpa/inet.h') ||

have_func('ntohs', 'arpa/inet.h') ||

+have_func('ntohs', 'winsock2.h') ||

abort("couldn't find ntohs")

These functions live in netioapi.h on Windows, not net/if.h. The MSDN

I will be pleased to test the new gem and help make it work on Windows...

jacobjennings commented 10 years ago

Asked related question on stack overflow. There seems to be a fork which might address this issue here: https://github.com/Donavan/dnssd But, I'm not sure how to use it. http://stackoverflow.com/questions/20039202/cant-find-gem-specification-to-use-forked-gem