abaw / mdns2dns

It's a simple program to response MDNS queries by looking up answer with DNS servers. This is used to solve .local domain names in some private networks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can't build on ubuntu 15.10

amery opened this issue · comments

trying to build it on ubuntu 15.10 it fails apparently because changes on the API of the dns library, but I don't know haskell :-(

$ sudo apt-get install cabal-install libghc-network-multicast-dev libghc-zlib-dev
$ dpkg -l | grep -e ghc -e cabal
ii  cabal-install                               1.22.0.1-4                               amd64        command-line interface for Cabal and Hackage
ii  ghc                                         7.8.4-9                                  amd64        The Glasgow Haskell Compilation system
ii  libghc-cabal-dev                            1.22.1.1-2build2                         amd64        Framework for packaging Haskell software
ii  libghc-network-dev                          2.6.2.1-1                                amd64        Haskell low-level network library
ii  libghc-network-multicast-dev                0.0.11-3build4                           amd64        Haskell multicast networking
ii  libghc-zlib-dev                             0.5.4.2-2build2                          amd64        Compression and decompression in the gzip and zlib formats
$ rm -rf ~/.ghc/
$ cabal install mdns2dns.cabal
$ cabal install mdns2dns.cabal 
Resolving dependencies...
Configuring appar-0.1.4...
Configuring byteorder-1.0.4...
Configuring random-1.1...
Configuring stm-2.4.4...
Configuring tagged-0.8.2...
Configuring transformers-0.4.3.0...
Configuring text-1.2.1.3...
Building byteorder-1.0.4...
Building stm-2.4.4...
Building appar-0.1.4...
Building random-1.1...
Building tagged-0.8.2...
Building transformers-0.4.3.0...
Building text-1.2.1.3...
Installed byteorder-1.0.4
Installed appar-0.1.4
Configuring iproute-1.7.0...
Building iproute-1.7.0...
Installed stm-2.4.4
Installed tagged-0.8.2
Installed random-1.1
Installed iproute-1.7.0
Installed transformers-0.4.3.0
Configuring mmorph-1.0.4...
Configuring mtl-2.2.1...
Configuring primitive-0.6.1.0...
Configuring transformers-compat-0.4.0.4...
Building mmorph-1.0.4...
Building mtl-2.2.1...
Building primitive-0.6.1.0...
Building transformers-compat-0.4.0.4...
Installed transformers-compat-0.4.0.4
Configuring transformers-base-0.4.4...
Building transformers-base-0.4.4...
Installed mmorph-1.0.4
Installed transformers-base-0.4.4
Configuring monad-control-1.0.0.4...
Building monad-control-1.0.0.4...
Installed mtl-2.2.1
Configuring exceptions-0.8.0.2...
Building exceptions-0.8.0.2...
Installed primitive-0.6.1.0
Configuring vector-0.11.0.0...
Installed monad-control-1.0.0.4
Configuring lifted-base-0.2.3.6...
Building vector-0.11.0.0...
Building lifted-base-0.2.3.6...
Installed exceptions-0.8.0.2
Installed lifted-base-0.2.3.6
Configuring resourcet-1.1.6...
Building resourcet-1.1.6...
Installed resourcet-1.1.6
Installed text-1.2.1.3
Configuring hashable-1.2.3.3...
Configuring blaze-builder-0.4.0.1...
Building hashable-1.2.3.3...
Building blaze-builder-0.4.0.1...
Installed hashable-1.2.3.3
Configuring nats-1.1...
Configuring unordered-containers-0.2.5.1...
Building unordered-containers-0.2.5.1...
Building nats-1.1...
Installed blaze-builder-0.4.0.1
Configuring streaming-commons-0.1.14.2...
Installed nats-1.1
Building streaming-commons-0.1.14.2...
Installed streaming-commons-0.1.14.2
Installed unordered-containers-0.2.5.1
Configuring semigroups-0.18...
Building semigroups-0.18...
Installed semigroups-0.18
Configuring void-0.7.1...
Building void-0.7.1...
Installed void-0.7.1
Configuring conduit-1.2.5.1...
Building conduit-1.2.5.1...
Installed vector-0.11.0.0
Configuring scientific-0.3.4.2...
Building scientific-0.3.4.2...
Installed conduit-1.2.5.1
Installed scientific-0.3.4.2
Configuring attoparsec-0.13.0.1...
Building attoparsec-0.13.0.1...
Installed attoparsec-0.13.0.1
Configuring conduit-extra-1.1.9.1...
Building conduit-extra-1.1.9.1...
Installed conduit-extra-1.1.9.1
Configuring dns-2.0.1...
Building dns-2.0.1...
Installed dns-2.0.1
Configuring mdns2dns-0.1.0.0...
Building mdns2dns-0.1.0.0...
Failed to install mdns2dns-0.1.0.0
Build log ( /home/amery/.cabal/logs/mdns2dns-0.1.0.0.log ):
Configuring mdns2dns-0.1.0.0...
Building mdns2dns-0.1.0.0...
Preprocessing executable 'mdns2dns' for mdns2dns-0.1.0.0...
[1 of 1] Compiling Main             ( Main.hs, dist/build/mdns2dns/mdns2dns-tmp/Main.o )

Main.hs:52:28: Not in scope: data constructor ‘DNSFormat’

Main.hs:56:21:
    ‘qdCount’ is not a (visible) field of constructor ‘DNSHeader’

Main.hs:57:21:
    ‘anCount’ is not a (visible) field of constructor ‘DNSHeader’

Main.hs:58:21:
    ‘nsCount’ is not a (visible) field of constructor ‘DNSHeader’

Main.hs:59:21:
    ‘arCount’ is not a (visible) field of constructor ‘DNSHeader’
cabal: Error: some packages failed to install:
mdns2dns-0.1.0.0 failed during the building phase. The exception was:
ExitFailure 1

Hi,
I fixed the compilation error and tested in ubuntu 15.10 through docker. Please try it again. You just need to type "cabal install" inside the mdns2dns directory.

Hi, sorry for not replying earlier. I updated by copy, cleared ~/.ghc and cabal install again, but failed

Configuring mdns2dns-0.1.0.0...
Building mdns2dns-0.1.0.0...
Preprocessing executable 'mdns2dns' for mdns2dns-0.1.0.0...
[1 of 1] Compiling Main             ( Main.hs, dist/build/mdns2dns/mdns2dns-tmp/Main.o )

Main.hs:77:5:
    Couldn't match expected type ‘Maybe a1 -> IO a0’
                with actual type ‘IO ()’
    The function ‘addMembership’ is applied to three arguments,
    but its type ‘Socket -> HostName -> IO ()’ has only two
    In a stmt of a 'do' block: addMembership sock (show mdnsIp) Nothing
    In the second argument of ‘($)’, namely
      ‘do { seed <- makeResolvSeed defaultResolvConf;
            sock <- socket AF_INET Datagram defaultProtocol;
            setSocketOption sock ReuseAddr 1;
            bind sock serverAddr;
            .... }’

I also tried with stack (apt-get install haskell-stack) as recommended on the readme, but it doesn't like that I have ghc 7.8.4 instead of 7.10.2
GHC version mismatched, found 7.8.4 (x86_64), but expected version 7.10.2 (x86_64) (based on resolver setting in /home/amery/projects/3rd-party/mdns2dns/stack.yaml). And stack setup wants to overwrite what I have installed on the system :-/

Hi, "stack setup" won't overwrite the GHC on your system. It installs the GHC it needs to some location in your home directory. So it won't overwrite what you have in the system.

The error message you encountered was caused by a different version of network package. Stack is used to solve this kind of dependnecy problems. So please go ahead with "stack setup" and "stack install".

I wish I could. It fails while installing a the new ghc claiming lack of space (having several GB free on every partition) and failing to do anything inside strace to be able to see where is it trying to untar it.

I created a release to include a binary I built for you to test. Please try it.

https://github.com/abaw/mdns2dns/releases/download/v0.1/mdns2dns works as a charm! thank you!

TMPDIR=$PWD/tmp stack setup seems to do the trick. 1GB free in /tmp (tmpfs) doesn't seem enough :| ... tomorrow I'll tell you about the native building using $TMPDIR and stack.

thanks again @abaw

I can confirm it compiles fine now. thank you!

@amery You are welcome!! Hope this little program could help you.

@abaw it works perfectly. I can finally have functional name resolution in this foo.local network. thank you!