Subject: Re: res_init
From: "Dr. Volker Zell" <[email-masked]>
To: Piotr Gardy <[email-masked]>
Cc: [email-masked]
Date: 12 Mar 2001 13:17:53 +0100

>>>>> "Piotr" == Piotr Gardy <[email-masked]> writes:

    Piotr> Hello!
    Piotr> I'm new on the list so - Hi everybody! :)

    Piotr> I've a question - for last few days i try do compile mtr (0.42) under cygwin 
    Piotr> (cygwin_98-4.10). Cofigure scripts of mtr says, that it couldn't find a 
    Piotr> res_init. Confugure looks for it in system., next in libbind and libresolv. 
    Piotr> So I decided to compile BIND. After that I've got a libbind.a, copied it to 
    Piotr> /lib, but still configure says that res_init is not supporrrted by my system.

    Piotr> It checks for it by:
    Piotr> ###conttest.c##
    Piotr> #include <conftest.h> (nothing special in this file)

    Piotr> int res_init ();

    Piotr> main {
    Piotr> res_init();
    Piotr> return 0;
    Piotr> } 
    Piotr> ############
    Piotr> Compilation of this file says: "unresolved reference: res_init"., even with 
    Piotr> -L/lib -lbind options.

    Piotr> Could you help me? 

If you use

o bind-8.2.2p7 - ftp://ftp.isc.org/isc/bind/src/8.2.2-P7/

or later, you have to change configure to autodetect res_init(). I also
call configure like this

CPPFLAGS="-I/usr/local/bind/include" LIBS="-L/usr/local/bind/lib -lbind" ./configure  >> CONFIGURE-LOG 2>&1

because that's where I have my bind stuff installed.

diff -upr /gnu/mtr-0.42/configure mtr-0.42/configure
--- /gnu/mtr-0.42/configure	Sat Mar  4 09:07:39 2000
+++ mtr-0.42/configure	Mon Mar 12 12:58:38 2001
@@ -2211,9 +2211,9 @@ cat > conftest.$ac_ext <<EOF
 #line 2212 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char res_init();
+#include <arpa/nameser.h>
+#include <netdb.h>
+#include <resolv.h>
 
 int main() {
 res_init()

The following patch lets mtr at least compile (with or without gtk support
depends if you have the gtk stuff installed).

diff -upr /gnu/mtr-0.42/mtr.c mtr-0.42/mtr.c
--- /gnu/mtr-0.42/mtr.c	Sat Mar  4 09:22:32 2000
+++ mtr-0.42/mtr.c	Mon Mar 12 13:07:09 2001
@@ -159,6 +159,7 @@ int main(int argc, char **argv) {
   net_preopen_result = net_preopen ();
 
   /*  Now drop to user permissions  */
+#ifndef __CYGWIN__  
   if(setuid(getuid())) {
     printf("mtr: Unable to drop permissions.\n");
     exit(1);
@@ -169,6 +170,7 @@ int main(int argc, char **argv) {
     printf("mtr: Unable to drop permissions.\n");
     exit(1);
   }
+#endif
   
   display_detect(&argc, &argv);

Anyway my compiled version doesn't work. It starts up fine in both the ncurses and gtk version
but nothing happens. maybe you have more luck.

Ciao
  Volker

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple